Esempio n. 1
0
 public InstrumentPrices(int index, Prices prices)
 {
     this.index = index;
     if (this.prc == null)
         this.prc = new Prices();
     this.prc.AskPx = prices.AskPx;
     this.prc.AskQty = prices.AskQty;
     this.prc.BidPx = prices.BidPx;
     this.prc.BidQty = prices.BidQty;
     this.prc.Volume = prices.Volume;
 }
Esempio n. 2
0
 /// <summary>
 /// this method initializes the instrument price, quanties with 0 value
 /// </summary>
 private void InitializeDummyInstruments()
 {
     for (int i = 0; i < 10; i++)
     {
         var newPrice = new Prices() { Volume = 0, BidQty = 0, BidPx = 0, AskQty = 0, AskPx = 0 };
         var newInstrument = new InstrumentPrices(i, newPrice);
         tradeItemsCollection.Add(newInstrument);
     }
 }
        private void DoStart()
        {
            for (int i = 0; i < 10; ++i)
            {
                var prices = new Prices();
                double mid = _randGenerator.NextDouble() * 100;

                prices.BidPx = Math.Max(0, mid - TickSize);
                prices.AskPx = Math.Max(0, mid + TickSize);
                prices.BidQty = (uint)_randGenerator.Next(1, 10) * 10;
                prices.AskQty = (uint)_randGenerator.Next(1, 10) * 10;
                prices.Volume = 0;

                _prices[i] = prices;
            }

            DispatchPrices();
            _timer.Start();
        }