I got this to (somewhat) work. The problem has been that contractPrint() exported a text field and i parsed it as such, while proper CONTRACT struct needs an int in this place.

So, the trick with assigning a ptr to the dataset to Contracts works.

However,
Quote:
C=contract(CALL,3,priceClose())

still generates
Quote:
Error 016: Invalid date 0

And then selects some arbitrary contract strike.

Does contract() make any assumption on the order of expiries (or something else) in the option chain?