Beispiel #1
0
        private void UpdateDictUserOpenedOrders(FUTTRADE.orders_log ol)
        {
            try
            {
                string isin = m_plaza2Connector.Instruments.GetInstrumentByIsinId(ol.isin_id);
                CRawOrdersLogStruct rawOls = new CRawOrdersLogStruct((FUTTRADE.orders_log)ol.Copy());

                if (ol.action == (sbyte)EnmOrderAction.Added)
                {
                    DictUsersOpenedOrders[ol.id_ord] = rawOls;
                    //  m_plaza2Connector.GUIBox.UpdateOrders(isin, new CRawOrdersLogStruct(ol));
                    Log("Update " + ol.id_ord);
                    string dbgString = "Update " + ol.id_ord;
                    m_plaza2Connector.GUIBox.ExecuteWindowsUpdate(new Action(() => m_plaza2Connector.GUIBox.UpdateOrders(isin, rawOls)));
                    Log("End update " + ol.id_ord);
                }
                else if (ol.action == (sbyte)EnmOrderAction.Deleted || ol.action == (sbyte)EnmOrderAction.Deal)
                {
                    DictUsersOpenedOrders.Remove(ol.id_ord);
                    //m_plaza2Connector.GUIBox.RemoveOrder(ol.id_ord);


                    Log("Remove " + ol.id_ord);
                    string dbgString = "Remove " + ol.id_ord;
                    m_plaza2Connector.GUIBox.ExecuteWindowsUpdate(new Action(() => m_plaza2Connector.GUIBox.RemoveOrder(rawOls.Id_ord)));
                    Log("End remove " + ol.id_ord);
                }
            }
            catch (Exception e)
            {
                Error("UpdateDictUserOpenedOrders", e);
            }
        }
 public CRawOrdersLogStruct(FUTTRADE.orders_log ol)
 {
     ReplRev     = ol.replRev;
     ReplId      = ol.replID;
     Moment      = ol.moment;
     Isin_Id     = ol.isin_id;
     Id_ord      = ol.id_ord;
     Sess_id     = ol.sess_id;
     Price       = ol.price;
     Dir         = ol.dir;
     Action      = ol.action;
     Amount      = ol.amount;
     Amount_rest = ol.amount_rest;
     Id_deal     = ol.id_deal;
     Deal_Price  = ol.deal_price;
     Ext_id      = ol.ext_id;
 }
Beispiel #3
0
        public void Update(FUTTRADE.orders_log ol)
        {
            int i;

            UpdateDictUserOpenedOrders((FUTTRADE.orders_log)ol.Copy());

            mxListRawOrders.WaitOne();

            {
                try
                {
                    //Here we fill "Raw Orders struct list based on replRev/replId

                    for (i = 0; i < m_listRawOrdersStruct.Count; i++)
                    {
                        if (m_listRawOrdersStruct[i].ReplId == ol.replID)
                        {
                            //Seems like this will never happened
                            m_listRawOrdersStruct[i] = new CRawOrdersLogStruct(ol);
                        }
                    }


                    if (i == m_listRawOrdersStruct.Count)
                    {
                        m_listRawOrdersStruct.Add(new CRawOrdersLogStruct(ol));

                        if (ol.action == (sbyte)EnmOrderAction.Deal)
                        {
                        }



                        //TO DO put trigger new log here ?


                        {
                            foreach (CBotBase bt in m_plaza2Connector.ListBots)
                            {
                                if (bt.BotId == ol.ext_id)
                                {
                                    EnmBotEventCode evCode = EnmBotEventCode.OnEmptyEvent;
                                    if (ol.action == (sbyte)EnmOrderAction.Added)
                                    {
                                        evCode = EnmBotEventCode.OnOrderAccepted;
                                        //TEMPO ! comment it

                                        /*   CRawOrdersLogStruct rlstr = new CRawOrdersLogStruct(ol);
                                         * string instr = m_plaza2Connector.Instruments.GetInstrumentByIsinId(ol.isin_id);
                                         * bt.Recalc(instr, EnmBotEventCode.OnOrderAccepted, rlstr);
                                         */
                                    }
                                    else if (ol.action == (sbyte)EnmOrderAction.Deleted)
                                    {
                                        /*  CRawOrdersLogStruct rls = new CRawOrdersLogStruct(ol);
                                         * string isin = m_plaza2Connector.Instruments.GetInstrumentByIsinId(ol.isin_id);
                                         * bt.Recalc(isin, EnmBotEventCode.OnOrderCancel, rls);*/
                                        evCode = EnmBotEventCode.OnOrderCancel;
                                    }
                                    else if (ol.action == (sbyte)EnmOrderAction.Deal)
                                    {
                                        /*  CRawOrdersLogStruct rls = new CRawOrdersLogStruct(ol);
                                         * string isin = m_plaza2Connector.Instruments.GetInstrumentByIsinId(ol.isin_id);
                                         * bt.Recalc(isin, EnmBotEventCode.OnOrderDeal, rls);
                                         */
                                        evCode = EnmBotEventCode.OnOrderDeal;
                                    }


                                    CRawOrdersLogStruct rls = new CRawOrdersLogStruct(ol);



                                    string isin = m_plaza2Connector.Instruments.GetInstrumentByIsinId(ol.isin_id);
                                    bt.Recalc(isin, evCode, rls);
                                }
                            }
                        }
                    }



                    mxListRawOrders.ReleaseMutex();
                }
                catch (Exception e)
                {
                    Error("CUserOrderBox.Update", e);
                }
            }



            //
            // TODO gen here orderslist for each obot
            //
        }