public void Update(POS.position pos)
        {
            mxListRowsPositions.WaitOne();

            //  m_ListRawPos.Add(new CRawPosition(pos));



            string isin = m_Plaza2Connector.Instruments.DictIsinId_Instrument  [pos.isin_id];

            //for Data binding work correct
            if (!DictPos.ContainsKey(isin))
            {
                DictPos[isin] = new CRawPosition(pos);
            }
            else
            {
                DictPos[isin].Update(pos);
            }

            foreach (CBotBase bt in m_Plaza2Connector.ListBots)
            {
                bt.Recalc(isin, EnmBotEventCode.OnPostionUpdate, null);
            }



            UpdateTrdMgrTotalPos();



            mxListRowsPositions.ReleaseMutex();
        }
        public void Update(string instrument, decimal pos, string status)
        {
            //for Data binding work correct
            if (!DictPos.ContainsKey(instrument))
            {
                DictPos[instrument] = new CRawPosition();
            }


            string msg = String.Format("[Update] instrument={0} pos={1} status={2}",
                                       instrument, pos, status);

            if (status == "ACTIVE")
            {
                DictPos[instrument].Pos    = pos;
                DictPos[instrument].PosGUI = pos;
            }
            else if (status == "CLOSED")
            {
                DictPos[instrument].Pos    = 0;
                DictPos[instrument].PosGUI = 0;
            }

            //foreach (CBotBase bt in m_Plaza2Connector.ListBots)
            //  bt.Recalc(isin, EnmBotEventCode.OnPostionUpdate, null);



            UpdateTrdMgrTotalPos();



            //mxListRowsPositions.ReleaseMutex();
        }
        public void UpdateCurrencyPos(string description,
                                      string currCode,
                                      string bankId,
                                      object currPos)
        {
            _onlineDetector.Update();

            //   string st = "USD/RUB_TOD - USD";
            // string st = description;



            if (bankId == _client.Account)
            {
                string pat = @"([\w]*)/([\w]*) - ([\w]*)";

                Regex reg = new Regex(pat);
                Match m   = reg.Match(description);



                if (m.Groups.Count == 4)
                {
                    if (m.Groups[1].Value == m.Groups[3].Value)
                    {
                        if (currCode == m.Groups[1].Value)
                        {
                            string shortName = m.Groups[1].Value + m.Groups[2].Value;

                            string instrument = _instruments.GetInstumentByShortName(shortName);

                            if (instrument == "")
                            {
                                return;
                            }



                            bool posWasClosed = currPos == null && DictPos.ContainsKey(instrument) && DictPos[instrument].Pos != 0;

                            if (currPos != null || posWasClosed)
                            {
                                long lotSize = _instruments.GetLotSize(instrument);



                                if (lotSize == 0)
                                {
                                    Error("CPosistionsBoxASTS.UpdateCurrencyPos lotsize==0");
                                    return;
                                }



                                decimal rawPos = 0;

                                if (currPos != null)
                                {
                                    rawPos = (decimal)currPos;
                                }


                                DictPos[instrument].Pos    = (int)(rawPos / lotSize);
                                DictPos[instrument].PosGUI = DictPos[instrument].Pos;
                            }
                        }
                    }
                }
            }
        }