RollContracts: RollContracts

Description Usage Arguments Details Value Examples

Description

This function rolls contracts into 'Nearby', '1st Deferred', and '2nd Deferred'. It removes contracts more distant than 2 Deferred. It takes as arguments, x, a list of data.tables and r, an integer representing the date on which the nearby contract should be rolled. The data.tables in the list can contain raw trades and quotes data after reading in with bboread(), or it can be already aggregated in some way. For example, if you calculate mean price per day and number of quotes as soon as you read in, you can still call RollContracts() on this list.

Usage

1
RollContracts(accum, r = 20)

Arguments

r

an integer that specifies the date in the month prior to expiration you want to roll. 20 is the default.

x

a list of data.tables with at least two columns named 'TradeDate' and 'DeliveryDate'

Details

All September Maturities are deleted to avoid, new-crop vs old-crop delivery effects.

Value

An list of data.tables with a column called 'Deferreds' that specifies if the contract is the Nearby, 1st Deferred, or 2nd Deferred.

Examples

1
2
3
4
accum <- as.list(NULL)
accum[[1]] <- corn_110110
accum[[2]] <- corn_110110                 # accum is a list of two 'days' worth of BBO data
accum <- RollContracts(accum, r = 20)

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