Esempio n. 1
0
 public void UpdateTradersDeals(CRawDeal rd)
 {
     if (m_plaza2Connector.GlobalConfig.IsTradingServer && m_plaza2Connector.IsDealsOnline && m_plaza2Connector.IsStockOnline)
     {
         lock (ListDeals)
         {
             ListDeals.Add((CRawDeal)rd.Copy());
         }
         // m_plaza2Connector.UpdateTradersDeals(m_isin);
     }
 }
Esempio n. 2
0
        public void Update(DEALS.deal dl)
        {
            //TO DO trigger recalc bots
            //TO DO update levels and candles
            LastRcvRD = new CRawDeal(dl);
            //    m_dealQqueue.Add(new CRawDeal(dl));


            m_bqRawDeal.Add(new CRawDeal(dl));
            int tmp = 1;
        }
Esempio n. 3
0
        public void TriggerBotsDealsUpdate(CRawDeal rd)
        {
            foreach (CBotBase bb in m_plaza2Connector.ListBots)
            {
                if (ListSubscribersBotNames.Contains(bb.Name))
                {
                    string       instrument = m_plaza2Connector.Instruments.GetInstrumentByIsinId(rd.Isin_id);
                    BotEventDeal bed        = new BotEventDeal(rd.Isin_id, instrument, rd.Amount, rd.Price);

                    //2017-11-13 no need this data for bots but it's increase bot queue

                    //bb.Recalc(m_isin, EnmBotEventCode.OnDeals, (object)bed);
                }
            }
        }
Esempio n. 4
0
 private void UpdateOpedenedInterest(CRawDeal rd)
 {
     try
     {
         //tempo
         // for decrease dispatcher.invoke execution
         //TODO remove in the future
         const decimal par_deltaOpenedInterest = 100;
         decimal       delta = Math.Abs(GUIOpenedInterest - rd.Pos);
         if (delta > par_deltaOpenedInterest)
         {
             //   m_plaza2Connector.GUIBox.ExecuteWindowsUpdate(new Action(() => GUIOpenedInterest = rd.Pos));
             m_plaza2Connector.GUIBox.ExecuteWindowsDealsUpdate(new Action(() => GUIOpenedInterest = rd.Pos));
         }
         // GUIOpenedInterest = rd.Pos;
     }
     catch (Exception e)
     {
         Error("UpdateOpedenedInterest", e);
     }
 }
Esempio n. 5
0
 private void UpdateLastPrice(CRawDeal rd)
 {
     try
     {
         if ((rd.Id_ord_buy > rd.Id_ord_sell) && (LastBuyPrice != rd.Price))
         {
             // m_plaza2Connector.GUIBox.ExecuteWindowsUpdate(new Action(() => LastBuyPrice = rd.Price));
             m_plaza2Connector.GUIBox.ExecuteWindowsDealsUpdate(new Action(() => LastBuyPrice = rd.Price));
             //LastBuyPrice = rd.Price;
         }
         else if ((rd.Id_ord_buy < rd.Id_ord_sell) && (LastSellPrice != rd.Price))
         {
             //m_plaza2Connector.GUIBox.ExecuteWindowsUpdate(new Action(() => LastSellPrice = rd.Price));
             m_plaza2Connector.GUIBox.ExecuteWindowsDealsUpdate(new Action(() => LastSellPrice = rd.Price));
         }
         //  LastSellPrice = rd.Price;
     }
     catch (Exception e)
     {
         Error("UpdateLastPrice", e);
     }
 }
Esempio n. 6
0
        private void ThreadFunc(object objisin_id)
        {
            const int MAX_COUNT = 50000;



            while (true)
            {
                try
                {
                    CRawDeal rd = m_bqRawDeal.GetElementBlocking();
                    //      if (m_dealQqueue.Count > MAX_COUNT)
                    {
                        //        m_plaza2Connector.Error("m_dealQqueue more than max."+m_isin+" Count=" + m_dealQqueue.Count);
                    }

                    if (m_plaza2Connector.AnalzyeTimeFrames)
                    {
                        m_TimeFrameAnalyzer.AddNewDeal(rd);
                    }


                    if (m_plaza2Connector.IsDealsOnline)
                    {
                        TriggerBotsDealsUpdate(rd);
                        UpdateTradersDeals(rd);
                    }



                    if ((DateTime.Now - m_lastUpdate).TotalMinutes > 2)
                    {
                        try
                        {
                            (new System.Threading.Tasks.Task(() => TaskWriteLastReplIDToFile(rd.ReplID, rd.Isin_id))).Start();
                            m_lastUpdate = DateTime.Now;
                        }
                        catch (Exception e)
                        {
                            Error("CDealsStruct.ThreadFunc." + e.Message);
                        }
                    }

                    m_lastRD = (CRawDeal)rd.Copy();

                    //TO DO from config
                    int m_parMin = 5;

                    //only for "fresh data"
                    if ((m_plaza2Connector.ServerTime - rd.Moment).TotalMinutes < m_parMin)
                    {
                        if (m_plaza2Connector.IsDealsOnline)
                        {
                            UpdateAllLastDealData();
                        }
                    }
                }
                catch (Exception e)
                {
                    Error("CDealsStruct.ThreadFunc", e);
                }
            }
        }
Esempio n. 7
0
        public void Update(AstsCCTrade.ALL_TRADES at)
        {
            LastRcvRD = new CRawDeal(at);

            m_bqRawDeal.Add(new CRawDeal(at));
        }
Esempio n. 8
0
 public void Update(CRawDeal rd)
 {
     m_bqRawDeal.Add(rd);
     //    m_lastUpdate = rd.Moment;
     TimeLastDeal = rd.Moment;
 }