Hmmm, for position sizing I'm trying to get the maximum qty of a security I can trade at a specific (limit) price - which I would assume to be:Â
security.MarginModel.GetBuyingPower(...) / securityMarginCost
whereÂ
securityMarginCost = security.Price * security.SymbolProperties.ContractMultiplier * initialMarginRequirement
The problem, as mentioned above, is both GetInitialMarginRequirement and GetInitialMarginRequiredForOrder were made (why??!) protected [in .NET]
 the GetLeverage method suggestion above is incorrect as GetLeverage returns 1/MaintenanceMargin, not InitialMargin. GetMaximumOrderQuantityForTargetValueResult targets an account %ge and depends on existing holdings, market price, etc which doesn't really help in this situation.
Is there a canonical way to determine how much of a security I can buy at a given price, taking into account buying power and security leverage?
Â