public void Replace(Order order, double price, double stopPx, double qty)
{
if (order.IsNotSent)
{
throw new ArgumentException($"Can not replace order that is not sent {order}");
}
var command = new ExecutionCommand(ExecutionCommandType.Replace, order)
{
DateTime = this.framework.Clock.DateTime,
Id = order.Id,
OrderId = order.Id,
ClOrderId = order.ClOrderId,
ProviderOrderId = order.ProviderOrderId,
ProviderId = order.ProviderId,
RouteId = order.RouteId,
PortfolioId = order.PortfolioId,
TransactTime = order.TransactTime,
Instrument = order.Instrument,
InstrumentId = order.InstrumentId,
Provider = order.Provider,
Portfolio = order.Portfolio,
Side = order.Side,
OrdType = order.Type,
TimeInForce = order.TimeInForce,
Price = order.Price,
StopPx = order.StopPx,
Qty = order.Qty,
OCA = order.OCA,
Text = order.Text,
Account = order.Account,
ClientID = order.ClientID,
ClientId = order.ClientId
};
Messages.Add(command);
order.OnExecutionCommand(command);
this.framework.EventServer.OnExecutionCommand(command);
if (IsPersistent)
{
Server?.Save(command, -1);
}
order.Provider.Send(command);
}