EmulatedPortfolio

StockSharp.MatchingEngine

Emulierte Portfolio-Implementierung, die Positionen und Geld im Gedächtnis verfolgt.

Konstruktoren

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.

Eigenschaften

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

Verfügbares Geld (aktuell - blockiert).

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

Ursprünglicher Geldbetrag.

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

Blockiertes Geld für ausstehende Bestellungen.

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

Gesamtprovision.

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

Aktuelles Geld (beginnen + PnL).

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

Automatische Positionsliquidation beim Stop-Out ermöglichen.

MarginCallLevel
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.

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

Name.

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

Der Wert des realisierten Gewinn-Verlustes.

StopOutLevel
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.

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

Total PnL (realisiert - Provision).

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.

Methoden

CalculateUnrealizedPnL
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.

Clear
internal void Clear()
emulatedPortfolio.Clear()

Löschen Sie alle Zustände (verwendet von Reset).

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

Holen Sie sich alle Positionsinformationen Objekte.

GetPosition
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.

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

Holen Sie sich alle Positionen.

Rückgabe: Aufzählung der Positionen.

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.

Rückgabe: 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.

Rückgabe: 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)

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.
ProcessOrderRegistration
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.
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.

Rückgabe: Trade processing result.

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

Setzen Sie das Anfangsgeld.

money
Geldbetrag.
SetPosition
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.