Gamestudio Links
Zorro Links
Newest Posts
New Zorro version 2.30
by Zheka. 08/03/20 15:24
script CurrencyStrength
by jcl. 08/03/20 14:01
Moving Panels together
by Aku_Aku. 08/03/20 12:22
Why gamestudio USE Lite_C
by txesmi. 08/03/20 11:49
Price clusters
by jcl. 08/03/20 10:04
Zorro.exe return codes
by jcl. 08/03/20 09:41
objective - based to DD
by Grat. 08/03/20 05:14
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
9 registered members (txesmi, aariassanta, deepscreener, exile, AndrewAMD, Jerome8911, Dooley, Zheka, 1 invisible), 474 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Al82, Alibert, jsch, daan, TianYu
18487 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Option Margin Cost and Z13 #480974
07/28/20 15:23
07/28/20 15:23
Joined: Mar 2020
Posts: 32
J
jbhunter Offline OP
Newbie
jbhunter  Offline OP
Newbie
J

Joined: Mar 2020
Posts: 32
I am trying to wrap my head around Margin Costs when running some options strategies.

I am using the IB equations from here, IB Margin Eqs

As an example I will use the first Z13 trade. See log below. This is using the Put strategy with Leverage of 6.
Code
Sell at prem 1462.00 max win 1462.00
[SPY::SP11102] Place 2 Put 20120218 134.0 200@7.31 Unl 127.50 at 15:40:00
Com 2.00  Mrg 4702  Net 0  Prem 1462
Units 90.0000  MTotal 0.00  MCost 23.5088 PCost 0.90000 Opn 111


Underlying, 127.50
Bid, 7.31
Strike, 134

Index Options
Margin = Put Price + Maximum ((15% * Underlying Price - Out of the Money Amount), (10% * Strike Price))

Margin = 7.31 + Max(0.15*127.50-0, 0.1*134)
Margin = 7.31 + 19.125 = 26.435

So with Multiplier=100 and Lots=2...
Total margin cost is $5287, correct?

Looking at the Z13 log the premium seems correct. 7.31*100*2=1462
However how is the margin only 4702? I see the MCost*100*2=4702 which matches the Mrg value. But I don't understand where this comes from.
What is the last line in the log? I cannot find anything in the manual describing these names.

Code
Units 90.0000  MTotal 0.00  MCost 23.5088 PCost 0.90000 Opn 111

Units 90? PCost 0.9? Opn 111?

Re: Option Margin Cost and Z13 [Re: jbhunter] #481001
07/31/20 08:05
07/31/20 08:05
Joined: Mar 2018
Posts: 25
hast29 Offline
Newbie
hast29  Offline
Newbie

Joined: Mar 2018
Posts: 25
Hi jbhunter,

The code is in the contract.c script in the include folder. Look for the function „contractMargin“. Manual section here https://www.zorro-trader.com/manual/en/contract.htm .

I have looked at it briefly and did not find any difference between the IB formula and the formula in the code. Also, no idea where the „Units 90? PCost 0.9? Opn 111?“ come from. Sorry.

But if you code yourself, you will investigate on those functions and resolve it. To my understanding, the key issue is to match the Margin costs in your code with the real margin requirements of IB ?

Last edited by hast29; 07/31/20 08:07.

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