Posted By: Steve2019
Greeks from IB return zeros - 07/05/19 11:54
Hi, I've created a simple script to retrieve the greeks of an /ES option from Interactive Brokers. The script finds the option contract and prints the premium, however the greeks always print as 0.0000. I am subscribed to the options and futures data feeds.
The log from the script is
Any help would be greatly appreciated.
Thanks,
Steve.
Code
#include <contract.c> var* Greeks[5]; void run() { Verbose = 7|DIAG; set(LOGFILE); SaveMode = 0; NumYears = 1; assetList("OptionsIB"); BarPeriod = 1; //mins NumYears = 1; LookBack = 0; asset("ES"); contractUpdate ("ES-FOP-20191220",1,PUT|FUTURE); printf("\nPut chain loaded. Found: %d",NumContracts); CONTRACT* CImp = contract (PUT,160,2500); contract (CImp); //sets the tradeable object, enabling the option variables.. printf("\nStrike %f", ContractStrike); var OptionPrice = contractPrice(CImp); // bid/ask average price printf("\nPremium %f",OptionPrice); brokerCommand(GET_GREEKS,Greeks); printf("\nBroker Delta is %f",Greeks[1]); printf("\nBroker Theta is %f",Greeks[4]); }
The log from the script is
Code
Login 0 IB.. !Open IB Socket 2.01 !Account xxxxxx at UTC 07-05 11:38 Load OptionsIB !ES-FUT-20191220-ES-GLOBEX: 2996.50000 0.50000 1 !Get Future Option Chain ES-FOP-20191220-0----USD Chain of 542 ES-FOP-20191220 contracts Put chain loaded. Found: 542 Strike 2500.000000 !ES-FOP-20191220-2500-P-ES-GLOBEX: 19.75000 0.50000 1 Premium 19.500000 Broker Delta is 0.000000 Broker Theta is 0.000000
Any help would be greatly appreciated.
Thanks,
Steve.