3 registered members (7th_zorro, Aku_Aku, 1 invisible),
579
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Loading the options chain with additional data
[Re: asdvao]
#468268
09/27/17 15:53
09/27/17 15:53
|
Joined: Sep 2017
Posts: 6
asdvao
OP
Newbie
|
OP
Newbie
Joined: Sep 2017
Posts: 6
|
What would be the appropriate way to backtest while using additional data contained in a data set?
Is it somehow possible to run the backtest directly off the dataset? That is, is it possible to use the contractUpdate on the dataset containing more data columns? In that case, is it correct to presume that the first few fields have to be in the same order as in the T8/CONTRACT struct definition?
If not, would the most appropriate way be to load the full dataset, and save its subset containing the data consisting of the fields from the CONTRACT struct to a T8 file? Then, each invocation of the run function during a backtest, one would need to look up the additional information from the backtest?
Last edited by asdvao; 09/27/17 15:54.
|
|
|
Re: Loading the options chain with additional data
[Re: jcl]
#468295
09/28/17 11:45
09/28/17 11:45
|
Joined: Sep 2017
Posts: 6
asdvao
OP
Newbie
|
OP
Newbie
Joined: Sep 2017
Posts: 6
|
Thanks jcl, this clears it up somewhat.
Suppose I want to try a simple strategy using the additional data. Suppose I have options.t8 and options_with_additional.t99, where the latter is simply a superset of the former (i.e. the T99 also includes, beside additional data, the data that's already in T8).
I'd first load up both datasets, and update the contract chain with contractUpdate to the T8 dataset.
After that, I need to find the date for which I'm wanting to trade, and get the appropriate rows from the dataset using dataFind and the bar date (wdate?). Then, I'd loop thru the dataset, and figure out which contract(s) I want to trade. With this information, for each contract I want to trade, I'd create the CONTRACT struct, and try to find a matching contract within the chain (contract() function), and enter the appropriate positions.
Would this be a sensible approach?
Alternatively, from what I can figure from your answer, you were suggesting first going thru the contracts, and then use dataFind to use the appropriate greeks. In this approach, it's not clear how would I loop thru all the possible contracts to identify the ones that I want to trade.
Last edited by asdvao; 09/28/17 11:48.
|
|
|
Re: Loading the options chain with additional data
[Re: jcl]
#468303
09/28/17 14:05
09/28/17 14:05
|
Joined: Jul 2017
Posts: 784
Zheka
User
|
User
Joined: Jul 2017
Posts: 784
|
I somehow missed on the might of free-form datasets! Got into details and here are the questions: 1. Would "99" in suggested "greeks.t99" typically be a Handle? 2. In [Test] or [Train] mode the chain is copied from a dataset containing CONTRACT records, which is either automatically obtained from a Name.t8 file, or copied from a previously loaded dataset with the given Handle What should be the format of records in dataset with a list of CONTRACT structs to be used in ContractUpdate()? 3. You seem to favor using big single files to store all of the options/ greeks data for an asset. Why? Would storing data in many files e.g. 'by expiry' be less efficient in practice? Or is it because of the file name convention used? 4. Do i understand correctly that *.t8 files would update in real-time but a "dataset" would not? IB streams greeks and IV together with prices in RT https://interactivebrokers.github.io/tws-api/option_computations.html#gsc.tab=0So, why not just add 4-5 fields to the *.t8 struct? (and avoid having to use several datasets, locating matching records,etc)
Last edited by Zheka; 09/28/17 14:07.
|
|
|
Re: Loading the options chain with additional data
[Re: Zheka]
#468304
09/28/17 14:16
09/28/17 14:16
|
Joined: Jul 2017
Posts: 784
Zheka
User
|
User
Joined: Jul 2017
Posts: 784
|
I also would like to clarify the example on the "Datasets" page in the manual: // parse iVolatility historical option chain data and store the resulting array void main() { string Format = "+,,%m/%d/%y,,,i,f,s,s,f,f,f,,f"; int records = dataParse(1,Format,"iVolatility_SPY_2014_1.csv"); records += dataParse(1,Format,"iVolatility_SPY_2014_2.csv"); records += dataParse(1,Format,"iVolatility_SPY_2015_1.csv"); records += dataParse(1,Format,"iVolatility_SPY_2015_2.csv"); records += dataParse(1,Format,"iVolatility_SPY_2016_1.csv"); printf("n%d records parsed",records); dataSave(1,"SPY_Options.t8"); } The Format is different from the *.t8 struct. How would it map to it?
|
|
|
|