build_spread_symbols: build symbols for exchange guaranteed (calendar) spreads


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.frame containing at least columns primary_id, month_cycle, amd contracts_ahead, see Details


if not NULL, will read input data from the file named by this argument, in the same folrmat as data, above


if not NULL, will write out put to this file as a CSV


date to start building from, of type Date or an ISO-8601 date string, defaults to Sys.Date


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.


Ilya Kipnis <Ilya.Kipnis<at>>

See Also

load.instruments build_series_symbols

Questions? Problems? Suggestions? or email at

All documentation is copyright its authors; we didn't write any of that.