I am trying to get the option chain to a dataset before trimming as needed.
Quote:
string Format="s,sss8,i7,f6,f5,f1,f2,f3,f4";
char* exClass="EU";
CONTRACTS* C;

for (ii=0;ii<NumContracts;ii++)
{
C=Contracts+ii;

if (strstr((string)C,exClass))
contractPrint(C,TO_CSV);
}

dataParse(2,Format,"C:ZorroLogTradeOptions.csv");

file_delete("C:ZorroLogTradeOptions.csv");

ii=0;

while(C = dataStr(2,ii++,0))
contractPrint(C,TO_CSV);

All good except for one character lost in the class string.
Quote:
Downloading chain..
!Get Future Option Chain EUR-FOP--0----USD
Chain of 3044 EUR contracts
3044 contracts
Parse C:ZorroLogTradeOptions.csv..
EUU,FutureCall,20180907,1.1650,0.0000,0.0000,0.0000,125000,0
EU FutureCall 20180907 1.16500 0.00000 0.00000 0.00000 125000.00000 0.00000


And then the last contractPrint() prints nothing for the class at all.
Why would this happen? The manual states "s" parses a 3-character text field, and as you can see this is the case.

Is there a more elegant way of getting from Contracts to a dataset?
Given that formation of a more relevant contracts set is a typical step, it might make sense to store the retrieved option chain as a dataset (rather then an internal list of structs), seamlessly with [Test] mode.
contractUpdate() would then just return a handle to such dataset.
And both contract() and dataset functions will be available at once.

Last edited by Zheka; 09/05/18 16:47.