Hi,
My ISV Stellar separates out fills and order updates very similarly to OQ.
Whats the best way to deal with this in Provider code I do this:
Code:
private void Tcallback_TradeTransactionEvent(object sender, TradeTransactionEventArgs e)
{
string productId = e.TradeTransctions[0].GetTrade().GetProductID();
if (instrument.GetSymbol(this.id) == productId)
{
foreach (TradeTransaction tt in e.TradeTransctions)
{
Stellar.Trade t = tt.GetTrade();
OrderRecord record;
var id = Convert.ToInt32(t.GetUserString1());
if (workingOrders.TryGetValue(id, out record))
{
var price = (double)t.GetPrice().GetValue();
var quantity = (Int32)t.GetVolume().GetValue();
record.AddFill(price, quantity);
ExecType execType = ExecType.ExecTrade;
OrderStatus orderStatus = (record.LeavesQty > 0) ? OrderStatus.PartiallyFilled : OrderStatus.Filled;
//OrderStatus orderStatus = record.Order.Status;
ExecutionReport report = CreateReport(record, execType, orderStatus);
report.LastPx = price;
report.LastQty = quantity;
EmitExecutionReport(report);
}
else
EmitError(string.Format("OnTrade: Unknown trade, id={0}", id));
}
}
}
but in order updates I will also get:
Code:
if (status == OrderStatusEnum.NX_ORDER_STATUS_FILLED)
{
execType = ExecType.ExecTrade;
orderStatus = OrderStatus.Filled;
createReport = true;
}
should I bother doing anything with this at all or should ignore in favour of OQ handling the completion of an order or is there a more elegant solution?