Option Margin Cost and Z13

Posted By: jbhunter

Option Margin Cost and Z13 - 07/28/20 15:23

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?
Posted By: hast29

Re: Option Margin Cost and Z13 - 07/31/20 08:05

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 ?
© 2024 lite-C Forums