SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Jul 23, 2018 4:42 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 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 218
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?


Top
 Profile  
 
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:  
cron
Powered by phpBB® Forum Software © phpBB Group