EmulatedPortfolio

StockSharp.MatchingEngine

ポジションとお金のインメモリーを追跡するポートフォリオの実装をエミュレートしました。

コンストラクター

EmulatedPortfolio
public EmulatedPortfolio(string name, IMarkPrices markPrices)
emulatedPortfolio = EmulatedPortfolio(name, markPrices)

Initializes a new instance.

name
Portfolio name.
markPrices
Where the prices to revalue open positions come from.

プロパティ

AvailableMoney
public decimal AvailableMoney { get; }
value = emulatedPortfolio.AvailableMoney

利用可能なお金(current - ブロック)。

BeginMoney
public decimal BeginMoney { get; }
value = emulatedPortfolio.BeginMoney

初期費用額。

BlockedMoney
public decimal BlockedMoney { get; }
value = emulatedPortfolio.BlockedMoney

注文を終わらせるためのブロックされたお金。

Commission
public decimal Commission { get; }
value = emulatedPortfolio.Commission

トータルコミッション

CurrentMoney
public decimal CurrentMoney { get; }
value = emulatedPortfolio.CurrentMoney

現行の送金手数料(PnL)

EnableStopOut
public bool EnableStopOut { get; set; }
value = emulatedPortfolio.EnableStopOut
emulatedPortfolio.EnableStopOut = value

停止時に自動位置の清算を有効にします。

MarginCallLevel
public decimal MarginCallLevel { get; set; }
value = emulatedPortfolio.MarginCallLevel
emulatedPortfolio.MarginCallLevel = value

マージンコールレベルのしきい値。マージンレベルがこの値に落ちると、警告がトリガーされます。

Name
public string Name { get; }
value = emulatedPortfolio.Name

お名前.

RealizedPnL
public decimal RealizedPnL { get; }
value = emulatedPortfolio.RealizedPnL

利益損失に気付いた価値。

StopOutLevel
public decimal StopOutLevel { get; set; }
value = emulatedPortfolio.StopOutLevel
emulatedPortfolio.StopOutLevel = value

ストップアウトレベルのしきい値。マージンレベルがこの値に落ちると、ポジションは清算されます。

TotalPnL
public decimal TotalPnL { get; }
value = emulatedPortfolio.TotalPnL

総合PnL(実現 - 手数料)。

UnrealizedPnL
public decimal UnrealizedPnL { get; }
value = emulatedPortfolio.UnrealizedPnL

What the open positions have gained or lost since they were taken, at the prices they could be closed at now. A position the market has not priced counts for nothing.

Version
public long Version { get; private set; }
value = emulatedPortfolio.Version
emulatedPortfolio.Version = value

Changes whenever an order, a fill or the opening state changes the account, so a report on it can be told from a newer one.

メソッド

CalculateUnrealizedPnL
public decimal CalculateUnrealizedPnL(Func<SecurityId, decimal?> getCurrentPrice)
result = emulatedPortfolio.CalculateUnrealizedPnL(getCurrentPrice)

あらゆるポジションで非実現 PnL を計算します。

getCurrentPrice
金融商品取引業者の現在の市場価格を取得する機能。価格が利用できなくなった場合は、nullを返します。

戻り値: 総合非正規化 PnL@

Clear
internal void Clear()
emulatedPortfolio.Clear()

すべての状態をクリア(リセットによって使用されます)。

GetAllPositions
public IEnumerable<PositionInfo> GetAllPositions()
result = emulatedPortfolio.GetAllPositions()

すべての位置情報オブジェクトを取得します。

GetPosition
public PositionInfo GetPosition(SecurityId securityId)
result = emulatedPortfolio.GetPosition(securityId)

金融商品取引業者のポジションをゲット

securityId
金融商品ID

戻り値: 位置情報またはnull。

GetPositions
public IEnumerable<ValueTuple<SecurityId, decimal, decimal>> GetPositions()
result = emulatedPortfolio.GetPositions()

すべてのポジションを取得します。

戻り値: ポジションの列挙

GetUnrealizedPnL
public decimal? GetUnrealizedPnL(PositionInfo position)
result = emulatedPortfolio.GetUnrealizedPnL(position)

What one position has gained or lost since it was taken, at the price it could be closed at now.

position
A position of this portfolio.

戻り値: The floating profit, zero for a flat position, or when the market has not priced an open one.

GetUnrealizedPnL
public decimal? GetUnrealizedPnL(SecurityId securityId)
result = emulatedPortfolio.GetUnrealizedPnL(securityId)

What one position has gained or lost since it was taken, at the price it could be closed at now.

securityId
Security ID.

戻り値: The floating profit, zero for a flat position, or when the market has not priced an open one.

ProcessOrderCancellation
public void ProcessOrderCancellation(SecurityId securityId, Sides side, decimal volume, decimal price)
emulatedPortfolio.ProcessOrderCancellation(securityId, side, volume, price)

プロセスオーダーキャンセル(資金のブロック解除)

securityId
金融商品ID
side
注文側。
volume
キャンセルされた容積。
price
証拠金計算に使われる価格。
ProcessOrderRegistration
public void ProcessOrderRegistration(SecurityId securityId, Sides side, decimal volume, decimal price)
emulatedPortfolio.ProcessOrderRegistration(securityId, side, volume, price)

プロセスオーダー登録(ブロックファンド)

securityId
金融商品ID
side
注文側。
volume
注文数量。
price
証拠金計算の注文価格。
ProcessTrade
public TradeProcessingResult ProcessTrade(SecurityId securityId, Sides side, decimal price, decimal volume, decimal? commission, decimal? marginPrice)
result = emulatedPortfolio.ProcessTrade(securityId, side, price, volume, commission, marginPrice)

Process a trade execution.

securityId
Security ID.
side
Trade side.
price
Trade price.
volume
Trade volume.
commission
Commission amount.
marginPrice
Price at which the filled order reserved funds.

戻り値: Trade processing result.

SetMoney
public void SetMoney(decimal money)
emulatedPortfolio.SetMoney(money)

初期費用を設定します。

money
お金の量。
SetPosition
public void SetPosition(SecurityId securityId, decimal volume, decimal avgPrice)
emulatedPortfolio.SetPosition(securityId, volume, avgPrice)

初期位置を設定します。

securityId
金融商品ID
volume
位置の容積。
avgPrice
平均エントリー価格。