backtest option strategies with quandl FOPs data

Posted By: jzastrow

backtest option strategies with quandl FOPs data - 02/05/18 13:08

Hi, I want to use Quandl future options data (https://www.quandl.com/data/OWF-OptionWorks-Futures-Options/documentation/methodology) with zorro.

Is this possible with the "S" version to backtest option strategies?
Posted By: Dalla

Re: backtest option strategies with quandl FOPs data - 02/05/18 14:01

You can, there's even a three part series on Financial Hacker that walks you through algo trading options using Zorro
http://www.financial-hacker.com/algorithmic-options-trading/
Posted By: jzastrow

Re: backtest option strategies with quandl FOPs data - 02/05/18 15:01

I read about the .t8 files.

Do I have to create those on my own?
Posted By: jcl

Re: backtest option strategies with quandl FOPs data - 02/06/18 15:07

Yes. You can use the dataParse function for this. The format string depends on the source data that you got from an options data provider. After parsing the data, you often need to modify some fields to the format needed in a CONTRACT struct. Here is an example:

Code:
string Extract = "AAPL";
string InName = "NBBO.csv";
string Format = "+,,,%m/%d/%Y,,,i7,f6,s8,,f1,f2,,,f4,f5";
string OutFormat = "%Y-%m-%d,f,f,f,f,f,f,i,i";

void main()
{
	dataNew(1,0,0);
	int Records = dataParse(1,Format,InName,Extract);
	printf("n%d Records parsed",Records);
	for(i=0; i<Records; i++) {
// fix expiry (is stored in wrong order)
		int Expiry = dataInt(1,i,7);
		int MMDD = Expiry/10000;
		int YYYY = Expiry-MMDD*10000;
		dataSet(1,i,7,YYYY*10000+MMDD);
// fix type (is stored as characters 'P' or 'C')
		string Type = dataStr(1,i,8);
		dataSet(1,i,8,ifelse(*Type == 'P',PUT,CALL));
// display progress bar and check [Stop] button
		if(!progress(100*i/Records,0)) break; 
	}
	dataSave(1,strf("History%s.t8",Extract));
}

Posted By: jzastrow

Re: backtest option strategies with quandl FOPs data - 02/07/18 12:16

The ZHistory tool does not support t8 files. Is there another tool to verify the file content?
Posted By: jcl

Re: backtest option strategies with quandl FOPs data - 02/07/18 14:40

Not yet, but you can save it as CSV, and then open it with a text editor or the ZHistory editor.

For converting a t8 file to CSV:

string InName = "SPY.t8";
string OutName = "SPY.csv";
string Format = "%Y/%m/%d,i7,f6,i8,f1,f2";

void main()
{
dataLoad(1,InName,9);
dataSaveCSV(1,Format,OutName);
}
Posted By: jzastrow

Re: backtest option strategies with quandl FOPs data - 02/07/18 14:58

I still have problems understanding Zorro handling futures data and therefore option prices.

assetHistory("SPY",FROM_YAHOO|UNADJUSTED);

At any time different futures are traded in parallel with different expire dates e.g CL18H, CL18J. The assetHistory function seems only to support operating with the "unadjusted continuous contract", where the price data is taken from the current front-contract?!
Posted By: jcl

Re: backtest option strategies with quandl FOPs data - 02/07/18 15:03

assetHistory is for downloading prices. It has nothing to do with option contracts. They are not available for free download. You normally have to buy them.
Posted By: jzastrow

Re: backtest option strategies with quandl FOPs data - 02/07/18 16:57

Following the options example the history data of the underlying
are only used to have a timeframe to loop over?
Posted By: jzastrow

Re: backtest option strategies with quandl FOPs data - 02/07/18 17:00

I’m creating the t8 files from the Quandl Optionworks data.
Also subscribed to Zorro S
Posted By: Spirit

Re: backtest option strategies with quandl FOPs data - 02/07/18 22:21

iVolatility has some free options data, but only as example for testing, from 2016.
© 2024 lite-C Forums