Пример #1
0
        private void PriceUpdateHandler(PriceDTO priceUpdate)
        {
            // This needs some optimization
            try
            {
                int mid = priceUpdate.MarketId;

                if (_Instruments[mid] == null)
                {
                    _Instruments.Add(new Instrument(mid, InstrumentHelpers.GetSymbol(mid)));
                }

                _Instruments[mid].Bid        = priceUpdate.Bid;
                _Instruments[mid].Ask        = priceUpdate.Offer;
                _Instruments[mid].High       = priceUpdate.High;
                _Instruments[mid].Low        = priceUpdate.High;
                _Instruments[mid].LastUpdate = JSONParser.ParseJSONDateToUtc(priceUpdate.TickDate);
                _Instruments[mid].Change     = priceUpdate.Change;
                _Instruments[mid].Direction  = priceUpdate.Direction;
                if (priceUpdate.Direction == 1)
                {
                    _Instruments[mid].UpDown = _Instruments.UpImage;
                }
                else
                {
                    _Instruments[mid].UpDown = _Instruments.DownImage;
                }

                _Instruments[mid].AuditId = priceUpdate.AuditId;
            }
            catch (Exception ex)
            {
            }
        }
Пример #2
0
 private void frmMain_Load(object sender, EventArgs e)
 {
     _Instruments.UpImage   = InstrumentHelpers.AppIcon("TradingApi.Client.SampleWinFormApp.Images.arrow_up_green.ico");
     _Instruments.DownImage = InstrumentHelpers.AppIcon("TradingApi.Client.SampleWinFormApp.Images.arrow_down_blue.ico");
     StartConnection("");
 }