EmulatedPortfolio
Emulierte Portfolio-Implementierung, die Positionen und Geld im Gedächtnis verfolgt.
Konstruktoren
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.
Eigenschaften
public decimal AvailableMoney { get; }
value = emulatedPortfolio.AvailableMoney
Verfügbares Geld (aktuell - blockiert).
public decimal BeginMoney { get; }
value = emulatedPortfolio.BeginMoney
Ursprünglicher Geldbetrag.
public decimal BlockedMoney { get; }
value = emulatedPortfolio.BlockedMoney
Blockiertes Geld für ausstehende Bestellungen.
public decimal CurrentMoney { get; }
value = emulatedPortfolio.CurrentMoney
Aktuelles Geld (beginnen + PnL).
public bool EnableStopOut { get; set; }
value = emulatedPortfolio.EnableStopOut
emulatedPortfolio.EnableStopOut = value
Automatische Positionsliquidation beim Stop-Out ermöglichen.
public decimal MarginCallLevel { get; set; }
value = emulatedPortfolio.MarginCallLevel
emulatedPortfolio.MarginCallLevel = value
Margin Call Level Schwellenwert: Wenn die Margin Level auf diesen Wert sinkt, wird eine Warnung ausgelöst.
public decimal RealizedPnL { get; }
value = emulatedPortfolio.RealizedPnL
Der Wert des realisierten Gewinn-Verlustes.
public decimal StopOutLevel { get; set; }
value = emulatedPortfolio.StopOutLevel
emulatedPortfolio.StopOutLevel = value
Stop-out-Level-Schwelle: Wenn die Einschussquote auf diesen Wert fällt, werden die Positionen liquidiert.
public decimal TotalPnL { get; }
value = emulatedPortfolio.TotalPnL
Total PnL (realisiert - Provision).
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.
Methoden
public decimal CalculateUnrealizedPnL(Func<SecurityId, decimal?> getCurrentPrice)
result = emulatedPortfolio.CalculateUnrealizedPnL(getCurrentPrice)
Berechnen Sie unrealisierte PnL über alle Positionen hinweg.
- getCurrentPrice
- Funktion, um den aktuellen Marktpreis für ein Finanzinstrument zu erhalten. Gibt null zurück, wenn der Preis nicht verfügbar ist.
Rückgabe: Total unrealisiert PnL.
internal void Clear()
emulatedPortfolio.Clear()
Löschen Sie alle Zustände (verwendet von Reset).
public IEnumerable<PositionInfo> GetAllPositions()
result = emulatedPortfolio.GetAllPositions()
Holen Sie sich alle Positionsinformationen Objekte.
public PositionInfo GetPosition(SecurityId securityId)
result = emulatedPortfolio.GetPosition(securityId)
Holen Sie sich Position für Finanzinstrument.
- securityId
- Kennung des Finanzinstruments.
Rückgabe: Positionsangaben oder Null.
public IEnumerable<ValueTuple<SecurityId, decimal, decimal>> GetPositions()
result = emulatedPortfolio.GetPositions()
Holen Sie sich alle Positionen.
Rückgabe: Aufzählung der Positionen.
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.
Rückgabe: 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.
Rückgabe: 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)
Stornierung von Prozessaufträgen (Entsperrung von Mitteln).
- securityId
- Kennung des Finanzinstruments.
- side
- Ordnungsseite.
- volume
- Gestorbenes Volumen.
- price
- Für die Berechnung der Margin verwendete Preise.
public void ProcessOrderRegistration(SecurityId securityId, Sides side, decimal volume, decimal price)
emulatedPortfolio.ProcessOrderRegistration(securityId, side, volume, price)
Auftragsregistrierung (Blockfonds).
- securityId
- Kennung des Finanzinstruments.
- side
- Ordnungsseite.
- volume
- Auftragsvolumen.
- price
- Orderpreis für Margin Berechnung.
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.
Rückgabe: Trade processing result.
public void SetMoney(decimal money)
emulatedPortfolio.SetMoney(money)
Setzen Sie das Anfangsgeld.
- money
- Geldbetrag.
public void SetPosition(SecurityId securityId, decimal volume, decimal avgPrice)
emulatedPortfolio.SetPosition(securityId, volume, avgPrice)
Ausgangsposition einstellen.
- securityId
- Kennung des Finanzinstruments.
- volume
- Positionsvolumen.
- avgPrice
- Durchschnittlicher Eintrittspreis.