new contractCPD function crashes in main() at bar 0

Posted By: Tamas

new contractCPD function crashes in main() at bar 0 - 02/06/19 17:17

Hi,
I don't seem to be able to trace what's wrong here. The new contractCPD function (as explained on the financial-hacker's new blog) seems to be crashing with the below message, here is the diagnostic information. I can't get more details from the contractCPD function...

I am using the script as it is from the 2018 repository and have data subscription to the followings:

CME Real-Time
COMEX Real-Time
IEX Depth of Book
NYSE Arca Options
US Equity and Options Add-On Streaming Bundle
US Reg NMS Snapshot
US Securities Snapshot and Futures Value Bundle

Here is the trace information:

Load AssetsIB
Open: HistoryAssetsIB.csv rb
Load SPY
BrokerAsset SPY:
BrokerAsset SPY: : 272.7700 11400.162800 ms
!SPY: 272.77000 0.03000 1
Alloc SPY prices
SPY: 0..8765
Asset SPY status SPY:L 182818200 1
Asset SPY status SPY:S 182818200 1
!Get Option Chain SPY-OPT--0--SMART--USD
Chain of 3243 SPY contracts
3243 contracts today
Current price 272.77
Wait time approx 17 minutes
BrokerAsset
Error 111: Crash in function: main() at bar 0

Any help would be much appreciated.
Posted By: Tamas

Re: new contractCPD function crashes in main() at bar 0 - 02/06/19 17:41

And yes, I am using Zorro 2.01.6.
Posted By: AndrewAMD

Re: new contractCPD function crashes in main() at bar 0 - 02/06/19 18:26

Post your script.
Posted By: Tamas

Re: new contractCPD function crashes in main() at bar 0 - 02/06/19 20:47

// Get today's market sentiment //////////////////////////////////////

void main()
{
Verbose = 31;
if(version() < 1.98 || !is(TRADEMODE) || Broker != "IB") {
printf("Need Zorro 1.99+ in IB Trade Mode!");
return;
}
StartDate = NOW;
LookBack = 0;
assetList("AssetsIB");
asset("SPY");

// load today's contract chain
contractUpdate(0,0,CALL|PUT);
printf("n%i contracts today",NumContracts);
if(!NumContracts) return;

// get min and max strike
contract(CALL,45,0);
var StrikeMin = ContractStrike;
contract(CALL,45,9999);
var StrikeMax = ContractStrike;
printf("nStrike range %.2f...%.2f",StrikeMin,StrikeMax);

// get underlying price
var Price,Current = priceClose(0);
printf("nCurrent price %.2f",Current);

// plot CPD histogram
printf("nWait time approx %i minutes",1+NumContracts/200);
contractCPD(45);
int N = 0;
for(Price = 0.75*Current; Price <= 1.25*Current; N++,Price += 0.01*Current) {
if(N == 25)
plotBar("Current",N,floor(Price),cpd(Price),BARS|LBL2,BLACK);
else
plotBar("CPD",N,floor(Price),cpd(Price),BARS|LBL2,RED);
}
printf("nExpected price %.2f",cpdv(50));
}
Posted By: jcl

Re: new contractCPD function crashes in main() at bar 0 - 02/07/19 08:43

Zorro beta 2.01 had a bug when retrieving price quotes from the broker. This could be probably the reason of the crash. Please wait for the next beta version 2.02, then test again. If it then still crashes, please post again and I'll look into it.
Posted By: Tamas

Re: new contractCPD function crashes in main() at bar 0 - 02/07/19 09:35

Thanks! Will do!
© 2024 lite-C Forums