Exemplo n.º 1
0
        /// <summary>
        /// Apply new replace requests
        /// </summary>
        /// <param name="myMsg"></param>
        public void ApplyReplaceRequest(KaiTrade.Interfaces.IMessage myMsg)
        {
            try
            {
                if (1==1)
                {
                    string mnemonic = "";
                    KaiTrade.Interfaces.IModifyOrderRequst modifyRequest;
                    modifyRequest = JsonConvert.DeserializeObject<K2DataObjects.ModifyOrderRequest>(myMsg.Data);
                    ModifyRequestData r = new ModifyRequestData(crrType.cancel, modifyRequest);

                  

                    // Get the context - we must have this to access the order
                    if (_clOrdIDOrderMap.ContainsKey(r.OrigClOrdID))
                    {
                        r.OrderContext = _clOrdIDOrderMap[r.OrigClOrdID];
                        _clOrdIDOrderMap.Add(r.ClOrdID, r.OrderContext);
                    }
                    else
                    {
                    
                        //sendCancelReplaceRej(replaceData.LastQFMod, QuickFix.CxlRejReason.UNKNOWN_ORDER, "an order does not exist for the modifyOrder");
                        Exception myE = new Exception("an order does not exist for the modifyOrder");
                        throw myE;
                    }

                    try
                    {
                        if (oRLog.IsInfoEnabled)
                        {
                            oRLog.Info("modifyOrder:context" + r.OrderContext.ToString());
                            oRLog.Info("modifyOrder:order" + r.OrderContext.ExternalOrder.ToString());
                        }
                    }
                    catch
                    {
                    }

                    // swap the clordid to the new ones  on our stored order

                    r.OrderContext.ClOrdID =r.ClOrdID;
                    r.OrderContext.OrigClOrdID = r.OrigClOrdID;

                    // Use blocking collection
                    replaceRequests.Add(r);

                    
                }
                else
                {
                    //sync update
                    //DoApplyPriceUpdate(update);
                }



            }
            catch (Exception myE)
            {
                log.Error("ApplyReplaceRequest", myE);
            }
        }
Exemplo n.º 2
0
        public void updateFrom(ModifyRequestData r)
        {
            if (r.Price.HasValue)
            {
                this.Price = r.Price;
            }
            if (r.StopPrice.HasValue)
            {
                this.StopPrice = r.StopPrice;
            }
            if (r.qty.HasValue)
            {
                this.qty = r.qty;
            }

            this.RetryCount = r.RetryCount;
        }
Exemplo n.º 3
0
 public virtual OrderReplaceResult modifyOrder(ModifyRequestData replaceData)
 {
     return OrderReplaceResult.error;
 }