SmartQuant Discussion

Provider Code Order updates vs fills
Page 1 of 1

Author:  azuric [ Fri Jun 15, 2018 10:13 am ]
Post subject:  Provider Code Order updates vs fills


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:

        private void Tcallback_TradeTransactionEvent(object sender, TradeTransactionEventArgs e)
            string productId = e.TradeTransctions[0].GetTrade().GetProductID();

            if (instrument.GetSymbol( == 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;

                        EmitError(string.Format("OnTrade: Unknown trade, id={0}", id));

but in order updates I will also get:

               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?

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group