View source: R/build_symbols.R
| build_spread_symbols | R Documentation |
The columns needed by this version of the function are primary_id,
month_cycle, and code contracts_ahead.
build_spread_symbols(
data = NULL,
file = NULL,
outputfile = NULL,
start_date = Sys.Date()
)
data |
data.frame containing at least columns |
file |
if not NULL, will read input data from the file named by this argument, in the same folrmat as |
outputfile |
if not NULL, will write out put to this file as a CSV |
start_date |
date to start building from, of type |
primary_id should match the primary_id
of the instrument describing the root contract.
month_cycle should contain a comma delimited string describing the
month sequence to use, e.g. "F,G,H,J,K,M,N,Q,U,V,X,Z" for all months
using the standard futures letters, or "H,M,U,Z" for quarters, or
"Mar,Jun,Sep,Dec" for quarters as three-letter month abbreviations, etc.
The correct values will vary based on your data source.
contracts_ahead should contain a comma-delimited string describing
the cycle on which the guaranteed calendar spreads are to be consructed,
e.g. '1' for one-month spreads, '1,3' for one and three month spreads,
'1,6,12' for 1, 6, and 12 month spreads, etc.
For quarterly symbols, the correct contracts_ahead may be
something like '1,2,3' for quarterly, bi-annual, and annual spreads.
active_months is a numeric field indicating how many months including
the month of the start_date the contract is available to trade.
This number will be used as the upper limit for symbol generation.
If type is also specified, it should be a specific instrument type,
e.g. 'future_series','option_series','guaranteed_spread' or 'calendar_spread'
One of data or file must be populated for input data.
If 'outputfile' is 'NULL', a data frame with columns 'symbol' and 'type', containing the constructed spread identifiers and their instrument types. If 'outputfile' is supplied, the data frame is written to that CSV file and the function returns 'NULL' invisibly.
Ilya Kipnis <Ilya.Kipnis<at>gmail.com>
load.instruments
build_series_symbols
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.