SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Fri Feb 03, 2023 3:39 am

All times are UTC + 3 hours

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Jun 15, 2018 10:13 am 

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 244

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?

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 3 hours

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group