EmulatedPortfolio

StockSharp.MatchingEngine

Implementación de carteras que rastrea posiciones y dinero en memoria.

Constructores

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.

Propiedades

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

Dinero disponible (corriente - bloqueado).

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

Cantidad inicial de dinero.

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

Bloqueado dinero para órdenes pendientes.

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

Comisión total.

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

Dinero actual (comienzo + PnL).

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

Permite la liquidación automática de posición en el paro.

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

Al nivel de nivel de llamadas marginales, cuando el nivel de margen cae a este valor, se activa una advertencia.

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

Nombre.

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

El valor de la pérdida de ganancias realizada.

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

umbral de nivel de parada. Cuando el nivel de margen cae a este valor, las posiciones se liquidan.

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

Total PnL@ (realizado - comisión).

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.

Métodos

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

Calcular no realizado PnL en todas las posiciones.

getCurrentPrice
Función para obtener el precio actual del mercado para un instrumento financiero. Devuelve null si el precio no está disponible.

Devuelve: Total no realizado PnL.

Clear
internal void Clear()
emulatedPortfolio.Clear()

Despejar todo el estado (utilizado por Reset).

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

Obtener todos los objetos de información de posición.

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

Posición para instrumentos financieros.

securityId
identificación de instrumentos financieros.

Devuelve: Posición info o nula.

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

Pongan todas las posiciones.

Devuelve: Enumeración de posiciones.

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.

Devuelve: 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.

Devuelve: 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)

Cancelación de pedidos de procesos (fondos de desbloqueo).

securityId
identificación de instrumentos financieros.
side
Ordene el lado.
volume
Volumen cancelado.
price
Precio utilizado para cálculo del margen.
ProcessOrderRegistration
public void ProcessOrderRegistration(SecurityId securityId, Sides side, decimal volume, decimal price)
emulatedPortfolio.ProcessOrderRegistration(securityId, side, volume, price)

Registro de pedidos de procesos (bloquear fondos).

securityId
identificación de instrumentos financieros.
side
Ordene el lado.
volume
Volumen de pedido.
price
Precio del pedido para el cálculo del margen.
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.

Devuelve: Trade processing result.

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

Establece el dinero inicial.

money
Dinero.
SetPosition
public void SetPosition(SecurityId securityId, decimal volume, decimal avgPrice)
emulatedPortfolio.SetPosition(securityId, volume, avgPrice)

Establecer la posición inicial.

securityId
identificación de instrumentos financieros.
volume
Volumen de posición.
avgPrice
Precio medio de entrada.