AssetHistory () for contracts

Posted By: Zheka

AssetHistory () for contracts - 10/01/18 14:33

JCL,

it would be great if AssetHistory/BrokerHistory2 could recognize that the input symbol is a "contract" and in such cases accept and fill a *t8 struct instead of *t6.

Is this something you will consider implementing?
Posted By: jcl

Re: AssetHistory () for contracts - 10/01/18 15:31

Not only that, you'll be declared a Zorro hero when you can lead us to a broker that has options contract history for download.
Posted By: Zheka

Re: AssetHistory () for contracts - 10/01/18 17:19

IB maintains contract's history, supposedly- until option expiration.
Practically, I can download 1-1.5 months of history for weeklies/monthlies. I did not try Quarterlies' or longer term to see if it indeed covers the full duration of a contract.
Even if it is only 1.5 month or less, one can build a database over time.

However, to store it properly, one needs to manually convert the received dataset from t6 to t8. Also, IB plug-in does not currently allow to SET_MARKETVAL to obtain historical spread.
(And it is slow - see my IB-plug-in wish list in another thread)

Hence my request.

semi-Hero? tongue
Posted By: jcl

Re: AssetHistory () for contracts - 10/02/18 08:05

Ok, semi-hero when it's for live contracts only. But t8 files are for options chains, so they cannot be generated with a single contract symbol. For a t8 file, write a script that first downloads histories for all contracts in the chain, then retrieves strike and expiration from the file names and puts all downloaded t1 or t6 files together to a single t8 file.
Posted By: Zheka

Re: AssetHistory () for contracts - 10/02/18 11:20

Sure.
What I ask for is that assetHistory() recognizes that the input symbol is an OPT/FOP, gets an expiry and a strike from the symbol name and fills in and returns a *T8, rather than a *T6.

(A programmer would then cycle through the strikes for a single contract, append the datasets and dataSort(); then repeat for other expiries, as desired).
Posted By: jcl

Re: AssetHistory () for contracts - 10/02/18 11:25

I see no real use of this feature. You already have expiry and strike available in the script that does the downloads and generates the final t8 file. What difference does it make when it reads the prices out of t8 instead of t6 files?
Posted By: Zheka

Re: AssetHistory () for contracts - 10/02/18 12:58

assetHistory() with a VOLATILE flag returns a handle to the downloaded dataset.

The end user would just do a dataAppend(1,ii) in a cycle (of strikes) and dataSort(1) afterwards, instead of having to manually go through each T6 struct and writing to a T8 struct (before appending).

Efficiency and elegance.
Posted By: jcl

Re: AssetHistory () for contracts - 10/02/18 14:10

Same with t6:

CONTRACT* C = dataAppendRow(MyT8Handle,9);

then fill the contract from the current T6 dataset.

New functions make sense when they save the user some work, like 20-30 script lines, but not 2-3 lines. But if any questions come up with that script, just ask.
© 2024 lite-C Forums