Dear readers, I hope you enjoyed the holiday break. I wish you a happy New Year – may it bring you progress and success in your automated trading endeavours!
I wanted to start this year with an idea I left off last year, when investigating robustness: Using the median as a more robust tool than the ubiquitous mean (or average). This will be covered in the next post via a TradersStudio simulation results. To do that, I had to re-import some data from CSI Unfair Advantage to TradersStudio. I thought a “how-to” post on this would be useful – if only as an aide-memoire for next time (note-taking and documentation are important after all…)
Extract CSI Data
The first step is to extract the data from the CSI database into text files
(by the way, CSI have a 20% discount running until the end of January – just check their homepage).
This can be done with code using the Unfair Advantage API.
Pick all the instruments to be extracted and create a “contracts.param” file containing the CSI number for those instruments in the first column (comma-separated file with other columns being ignored). The CSI numbers can be found on their website (like here for the CME Futures) or in their Unfair Advantage software UI. Running the EXE code will generate one file for each instrument (proportionally back-adjusted contract) in the following format:
19900403,199006,0,240,110,918,503,2,0,1.59,1.655,1.58,1.635,1.635,1.635,1.635 19900404,199006,0,84,127,656,721,3,0,1.6,1.65,1.599,1.62,1.62,1.62,1.62 19900405,199006,0,57,112,554,885,4,0,1.615,1.635,1.61,1.615,1.615,1.615,1.615 19900406,199006,0,62,136,436,1092,5,0,1.615,1.635,1.61,1.625,1.625,1.625,1.625
Load in TradersStudio
The second step is to load the files in TradersStudio. Copy all generated text files in a dedicated data directory (you might have to rename them as TradersStudio allowed filename length is fairly short, i.e. 10-15 characters).
Create the relevant mapping file (txtinfo.txt) in the data directory. The mapping file should read:
delimit=, skip=0 dt=1 ti=0 op=10 hi=11 lo=12 cl=13 vol=6 oi=7 dtformat=CCYYMMDD tiformat=
In TradersStudio, menu Data Manager/Add Data Links, point to the relevant data directory with the following options:
If all goes well, this will load the data in the system (errors I encountered were due to file names being too long).
Data Universe: Contract meta-data
The third step is to populate the meta-data (margin, min tick move, etc.) for each instrument in TradersStudio. This is done via the menu Data Manager/Data Universe.
Once done, the instruments can be used just by adding them to any session.
As mentioned earlier the next post will be a test comparing moving average and moving median indicators.
Note: You can receive a 10% discount on CSI data subscriptions (use coupon code LIBERTY)