It is not possible with datasave to store the option chain on my computer. The options are downloaded but not stored.
This is the error message:
!Open IB Socket 3.16
!Account XXXXXXXXXXXXX, at UTC 06-09 14:57
Downloading options for SPX...
!Get Chain SPX-OPT--0.00--SMART/--USD..
Chain of 23763 SPX contracts
Saved 0 option contracts for SPX to History\SPX_Options_-760358231088839475-76035823.t8
I verified this:
Datasave works (tested with artificial options creating)
IBKR is connected correctly, api connection green and accepted
Directory is writable
Subscribed to SPX option data
Any suggestions?
// SPX Option Chain Downloader for Zorro + IBKR
#include <contract.c>
function run()
{
BarPeriod = 1440;
LookBack = 0;
StartDate = NOW;
set(LOGFILE);
assetList("AssetsIB");
asset("SPX");
Multiplier = 100;
printf("\nDownloading options for %s...", Asset);
// Download option chain (CALLs + PUTs)
if (!contractUpdate(Asset, 0, CALL|PUT)) {
printf("\nError: Failed to download option chain for %s", Asset);
quit("Download failed.");
return;
}
// Build filename with date
string filename = strf("History\\%s_Options_%04d%02d%02d.t8",
Asset, wdate(1), wdate(2), wdate(3));
// Save contracts to file
int saved = dataSave(1, filename);
printf("\nSaved %d option contracts for %s to %s", saved, Asset, filename);
quit("Download complete.");
}