Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (Quad, alibaba, rki, 7th_zorro), 365 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Greeks from IB return zeros #477546
07/05/19 11:54
07/05/19 11:54
Joined: Jul 2019
Posts: 2
S
Steve2019 Offline OP
Guest
Steve2019  Offline OP
Guest
S

Joined: Jul 2019
Posts: 2
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.

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.

Re: Greeks from IB return zeros [Re: Steve2019] #477547
07/05/19 13:36
07/05/19 13:36
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Be happy that it was zeros, your code can even crash. Its "var Greeks", not "var* Greeks", "var*" would be an array of pointers in C.

Re: Greeks from IB return zeros [Re: Steve2019] #477549
07/05/19 13:43
07/05/19 13:43
Joined: Jul 2019
Posts: 2
S
Steve2019 Offline OP
Guest
Steve2019  Offline OP
Guest
S

Joined: Jul 2019
Posts: 2
Thanks Spirit, that's fixed it.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1