decimalprices: Convert eighth of a cent grain prices to decimal

Description Usage Arguments Value Examples

Description

Convert eighth of a cent grain prices to decimal

Usage

1

Arguments

x

is a column of a datatable of Grain contract BBO raw data from CME Group's Datamine. Formatted as.character() from the start it will have 7 characters. Positions: 4 hundreds, 5 tens, 6 ones, and 7 8th of a cent since futures quotes are in cents per bushel and the ticks are 8ths of a cent this function will only work for corn prices < $100/bushel. At this date, grain prices above $100/ bushel are unimaginable.

This function is intended to be vectorized over a data.table object as in the example below.

Value

The column of the orginal datatable with the TrPrice column converted to numeric in decimal format.

Examples

1
2
3
4
5
accum <- as.list(NULL)
accum[[1]] <- as.data.table(bboread('XCBT_C_FUT_110110.TXT'))
accum[[2]] <- as.data.table(bboread('XCBT_C_FUT_110110.TXT'))                 # accum is a list of two 'days' worth of BBO data
corn_110110 <- data.table::rbindlist(accum)
corn_110110[, Price := decimalprices(corn_110110$TrPrice)]

ProfMalloryResearch/BBOToolkit documentation built on May 8, 2019, 3:23 a.m.