IMarginController

StockSharp.MatchingEngine

Interface for controlling margin trading logic. Leverage is per-position (Leverage). Margin call/stop-out levels are per-portfolio (MarginCallLevel, StopOutLevel).

Métodos

CheckMarginLevel(IPortfolio, decimal) : decimal

Calculate current margin level for a portfolio.

portfolio
Portfolio.
unrealizedPnL
Current unrealized PnL.

Devuelve: Margin level ratio (equity / blocked). Returns MaxValue if no blocked money.

GetRequiredMargin(decimal, decimal, PositionInfo) : decimal

Calculate required margin for an order, using position-level leverage.

price
Order price.
volume
Order volume.
position
Position info (for leverage). Can be null (uses default leverage 1).

Devuelve: Required margin amount.

IsMarginCall(IPortfolio, decimal) : bool

Check if portfolio is in margin call state. Uses MarginCallLevel.

portfolio
Portfolio.
unrealizedPnL
Current unrealized PnL.

Devuelve: True if margin level is at or below margin call threshold.

IsStopOut(IPortfolio, decimal) : bool

Check if portfolio is in stop-out state. Uses EnableStopOut and StopOutLevel.

portfolio
Portfolio.
unrealizedPnL
Current unrealized PnL.

Devuelve: True if stop-out is enabled and margin level is at or below stop-out threshold.

ValidateOrder(IPortfolio, decimal, decimal, PositionInfo) : InvalidOperationException

Validate that portfolio has sufficient funds for order.

portfolio
Portfolio to check.
price
Order price.
volume
Order volume.
position
Position info (for leverage). Can be null.

Devuelve: Error if insufficient funds, null otherwise.