MarginController

StockSharp.MatchingEngine

Standardimplementierung von IMarginController. Leverage wird von Leverage übernommen (Standard 1). Margin Call / Stop-Out Levels werden von IPortfolio übernommen.

Implementiert: IMarginController

Methoden

CheckMarginLevel
public decimal CheckMarginLevel(EmulatedPortfolio portfolio, decimal unrealizedPnL)
result = marginController.CheckMarginLevel(portfolio, unrealizedPnL)

Calculate current margin level for a portfolio.

portfolio
Portfolio.
unrealizedPnL
Current unrealized PnL.

Rückgabe: Margin level ratio (equity / blocked). Returns MaxValue if no blocked money.

GetRequiredMargin
public decimal GetRequiredMargin(decimal price, decimal volume, PositionInfo position)
result = marginController.GetRequiredMargin(price, volume, position)

Berechnen Sie die erforderliche Margin für einen Auftrag unter Verwendung von Positionshebel.

price
Bestellpreis.
volume
Auftragsvolumen.
position
Positionsinformationen (für Hebelwirkung) können null sein (verwendet Standardhebelwirkung 1).

Rückgabe: Erforderlicher Margin-Betrag.

IsMarginCall
public bool IsMarginCall(EmulatedPortfolio portfolio, decimal unrealizedPnL)
result = marginController.IsMarginCall(portfolio, unrealizedPnL)

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

portfolio
Portfolio.
unrealizedPnL
Current unrealized PnL.

Rückgabe: True if margin level is at or below margin call threshold.

IsStopOut
public bool IsStopOut(EmulatedPortfolio portfolio, decimal unrealizedPnL)
result = marginController.IsStopOut(portfolio, unrealizedPnL)

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

portfolio
Portfolio.
unrealizedPnL
Current unrealized PnL.

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

ValidateOrder
public InvalidOperationException ValidateOrder(EmulatedPortfolio portfolio, decimal price, decimal volume, PositionInfo position)
result = marginController.ValidateOrder(portfolio, price, volume, position)

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.

Rückgabe: Error if insufficient funds, null otherwise.