31 private const decimal OptionMarginRequirement = 1;
32 private const decimal NakedPositionMarginRequirement = 0.1m;
33 private const decimal EquityOptionNakedPositionMarginRequirementOtm = 0.2m;
34 private const decimal IndexOptionNakedPositionMarginRequirementOtm = 0.15m;
64 throw new InvalidOperationException(
"Options are leveraged products and different leverage cannot be set by user");
86 var orderMargin = value * GetMarginRequirement(parameters.
Security, parameters.
Order.Quantity, value);
88 return orderMargin + Math.Sign(orderMargin) * feesInAccountCurrency.Amount;
110 var value = security.QuoteCurrency.ConversionRate
111 * security.SymbolProperties.ContractMultiplier
134 private decimal GetMarginRequirement(
Security security, decimal quantity, decimal value)
136 var option = (
Option)security;
139 option.Close == 0m ||
140 option.StrikePrice == 0m ||
141 option.Underlying ==
null ||
142 option.Underlying.Close == 0m)
149 return OptionMarginRequirement;
152 var absValue = -value;
153 var optionProperties = (OptionSymbolProperties)option.SymbolProperties;
154 var underlying = option.Underlying;
157 var multiplierRatio = underlying.SymbolProperties.ContractMultiplier / optionProperties.ContractMultiplier;
158 var quantityRatio = optionProperties.ContractUnitOfTrade;
163 var priceRatio = (underlying.Close / option.SymbolProperties.StrikeMultiplier) / (absValue / quantityRatio);
164 var underlyingValueRatio = multiplierRatio * quantityRatio * priceRatio;
167 var amountOTM = option.OutOfTheMoneyAmount(underlying.Close);
168 var priceRatioOTM = amountOTM / (absValue / quantityRatio);
169 var underlyingValueRatioOTM = multiplierRatio * quantityRatio * priceRatioOTM;
171 var strikePriceRatio = option.StrikePrice / (absValue / quantityRatio);
172 strikePriceRatio = multiplierRatio * quantityRatio * strikePriceRatio;
174 var nakedMarginRequirement = option.Right ==
OptionRight.Call
175 ? NakedPositionMarginRequirement * underlyingValueRatio
176 : NakedPositionMarginRequirement * strikePriceRatio;
178 ? EquityOptionNakedPositionMarginRequirementOtm
179 : IndexOptionNakedPositionMarginRequirementOtm;
181 return OptionMarginRequirement +
182 Math.Abs(quantity) * Math.Max(nakedMarginRequirement,
183 nakedMarginRequirementOtm * underlyingValueRatio - underlyingValueRatioOTM);