IMarginController
StockSharp.MatchingEngine
証拠金取引ロジックの制御インターフェース。レバレッジはパーポジション(レバレッジ)です。マージンコール/ストップアウトレベルはパーポートフォリオ(MarginCallLevel、StopOutLevel@)です。
メソッド
CheckMarginLevel
public decimal CheckMarginLevel(EmulatedPortfolio portfolio, decimal unrealizedPnL)
result = iMarginController.CheckMarginLevel(portfolio, unrealizedPnL)
Calculate current margin level for a portfolio.
- portfolio
- Portfolio.
- unrealizedPnL
- Current unrealized PnL.
戻り値: Margin level ratio (equity / blocked). Returns MaxValue if no blocked money.
GetRequiredMargin
public decimal GetRequiredMargin(decimal price, decimal volume, PositionInfo position)
result = iMarginController.GetRequiredMargin(price, volume, position)
ポジションレベルのレバレッジを使用して、注文に必要なマージンを計算します。
- price
- 注文価格。
- volume
- 注文数量。
- position
- 位置情報(レバレッジの場合)。null(デフォルトレバレッジ1を使用します) は使えます。
戻り値: 必須証拠金額。
IsMarginCall
public bool IsMarginCall(EmulatedPortfolio portfolio, decimal unrealizedPnL)
result = iMarginController.IsMarginCall(portfolio, unrealizedPnL)
Check if portfolio is in margin call state. Uses MarginCallLevel.
- portfolio
- Portfolio.
- unrealizedPnL
- Current unrealized PnL.
戻り値: True if margin level is at or below margin call threshold.
IsStopOut
public bool IsStopOut(EmulatedPortfolio portfolio, decimal unrealizedPnL)
result = iMarginController.IsStopOut(portfolio, unrealizedPnL)
Check if portfolio is in stop-out state. Uses EnableStopOut and StopOutLevel.
- portfolio
- Portfolio.
- unrealizedPnL
- Current unrealized PnL.
戻り値: 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 = iMarginController.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.
戻り値: Error if insufficient funds, null otherwise.