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.
プロパティ
public decimal AvailableMoney { get; }
value = emulatedPortfolio.AvailableMoney
利用可能なお金(current - ブロック)。
public decimal BlockedMoney { get; }
value = emulatedPortfolio.BlockedMoney
注文を終わらせるためのブロックされたお金。
public decimal CurrentMoney { get; }
value = emulatedPortfolio.CurrentMoney
現行の送金手数料(PnL)
public bool EnableStopOut { get; set; }
value = emulatedPortfolio.EnableStopOut
emulatedPortfolio.EnableStopOut = value
停止時に自動位置の清算を有効にします。
public decimal MarginCallLevel { get; set; }
value = emulatedPortfolio.MarginCallLevel
emulatedPortfolio.MarginCallLevel = value
マージンコールレベルのしきい値。マージンレベルがこの値に落ちると、警告がトリガーされます。
public decimal StopOutLevel { get; set; }
value = emulatedPortfolio.StopOutLevel
emulatedPortfolio.StopOutLevel = value
ストップアウトレベルのしきい値。マージンレベルがこの値に落ちると、ポジションは清算されます。
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.
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.
メソッド
public decimal CalculateUnrealizedPnL(Func<SecurityId, decimal?> getCurrentPrice)
result = emulatedPortfolio.CalculateUnrealizedPnL(getCurrentPrice)
あらゆるポジションで非実現 PnL を計算します。
- getCurrentPrice
- 金融商品取引業者の現在の市場価格を取得する機能。価格が利用できなくなった場合は、nullを返します。
戻り値: 総合非正規化 PnL@
public IEnumerable<PositionInfo> GetAllPositions()
result = emulatedPortfolio.GetAllPositions()
すべての位置情報オブジェクトを取得します。
public PositionInfo GetPosition(SecurityId securityId)
result = emulatedPortfolio.GetPosition(securityId)
金融商品取引業者のポジションをゲット
- securityId
- 金融商品ID
戻り値: 位置情報またはnull。
public IEnumerable<ValueTuple<SecurityId, decimal, decimal>> GetPositions()
result = emulatedPortfolio.GetPositions()
すべてのポジションを取得します。
戻り値: ポジションの列挙
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.
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.
public void ProcessOrderCancellation(SecurityId securityId, Sides side, decimal volume, decimal price)
emulatedPortfolio.ProcessOrderCancellation(securityId, side, volume, price)
プロセスオーダーキャンセル(資金のブロック解除)
- securityId
- 金融商品ID
- side
- 注文側。
- volume
- キャンセルされた容積。
- price
- 証拠金計算に使われる価格。
public void ProcessOrderRegistration(SecurityId securityId, Sides side, decimal volume, decimal price)
emulatedPortfolio.ProcessOrderRegistration(securityId, side, volume, price)
プロセスオーダー登録(ブロックファンド)
- securityId
- 金融商品ID
- side
- 注文側。
- volume
- 注文数量。
- price
- 証拠金計算の注文価格。
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.
public void SetMoney(decimal money)
emulatedPortfolio.SetMoney(money)
初期費用を設定します。
- money
- お金の量。
public void SetPosition(SecurityId securityId, decimal volume, decimal avgPrice)
emulatedPortfolio.SetPosition(securityId, volume, avgPrice)
初期位置を設定します。
- securityId
- 金融商品ID
- volume
- 位置の容積。
- avgPrice
- 平均エントリー価格。