Example #1
0
 internal void OnLevel2(Level2Snapshot snapshot)
 {
     if (this.strategy != null && this.strategy.status == StrategyStatus.Running)
     {
         this.strategy.OnLevel2_(snapshot);
     }
 }
Example #2
0
        internal void OnLevel2Snapshot(Level2Snapshot snapshot)
        {
            OrderBook orderBook = this.book[snapshot.instrumentId];

            if (orderBook == null)
            {
                orderBook = new OrderBook();
                this.book[snapshot.instrumentId] = orderBook;
            }
            orderBook.Set(snapshot);
        }
Example #3
0
 public void OnLevel2(Level2Snapshot snapshot)
 {
     if (this.orders[snapshot.instrumentId] == null)
     {
         return;
     }
     for (int i = 0; i < this.orders[snapshot.instrumentId].Count; i++)
     {
         Order order = this.orders[snapshot.instrumentId][i];
         this.Process(order, this.framework.dataManager.GetOrderBook(order.instrument));
         if (this.addQueueToOrderText)
         {
             order.Text = order.queueSize.ToString();
         }
     }
 }
Example #4
0
        internal virtual void OnLevel2_(Level2Snapshot snapshot)
        {
            if (this.raiseEvents && this.instruments.Contains(snapshot.instrumentId))
            {
                this.OnLevel2(this.framework.InstrumentManager.GetById(snapshot.instrumentId), snapshot);
            }
            LinkedList <Strategy> linkedList = this.strategiesByInstrument[snapshot.instrumentId];

            if (linkedList != null)
            {
                for (LinkedListNode <Strategy> linkedListNode = linkedList.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
                {
                    linkedListNode.Data.OnLevel2_(snapshot);
                }
            }
        }
Example #5
0
 internal void Set(Level2Snapshot snapshot)
 {
     this.bids.Clear();
     this.asks.Clear();
     Bid[] array = snapshot.bids;
     for (int i = 0; i < array.Length; i++)
     {
         Bid tick = array[i];
         this.bids.Add(new Tick(tick));
     }
     Ask[] array2 = snapshot.asks;
     for (int j = 0; j < array2.Length; j++)
     {
         Ask tick2 = array2[j];
         this.asks.Add(new Tick(tick2));
     }
 }
Example #6
0
        private void OnLevel2Snapshot(Event e)
        {
            this.data_count += 1L;
            Level2Snapshot level2Snapshot = (Level2Snapshot)e;

            if (this.framework.Clock.Mode == ClockMode.Simulation)
            {
                this.framework.Clock.DateTime = level2Snapshot.dateTime;
            }
            else
            {
                level2Snapshot.dateTime = this.framework.Clock.DateTime;
            }
            this.framework.dataManager.OnLevel2Snapshot(level2Snapshot);
            this.framework.providerManager.executionSimulator.OnLevel2(level2Snapshot);
            this.framework.strategyManager.OnLevel2(level2Snapshot);
        }
Example #7
0
 internal void Set(Level2Snapshot snapshot)
 {
     this.bids.Clear();
     this.asks.Clear();
     Bid[] array = snapshot.bids;
     for (int i = 0; i < array.Length; i++)
     {
         Bid tick = array[i];
         this.bids.Add(new Tick(tick));
     }
     Ask[] array2 = snapshot.asks;
     for (int j = 0; j < array2.Length; j++)
     {
         Ask tick2 = array2[j];
         this.asks.Add(new Tick(tick2));
     }
 }
		public override object Read(BinaryReader reader)
		{
			Level2Snapshot level2Snapshot = new Level2Snapshot();
			reader.ReadByte();
			level2Snapshot.dateTime = DateTime.FromBinary(reader.ReadInt64());
			level2Snapshot.providerId = reader.ReadByte();
			level2Snapshot.instrumentId = reader.ReadInt32();
			int num = reader.ReadInt32();
			level2Snapshot.bids = new Bid[num];
			for (int i = 0; i < num; i++)
			{
				level2Snapshot.bids[i] = (Bid)this.streamerManager.Deserialize(reader);
			}
			int num2 = reader.ReadInt32();
			level2Snapshot.asks = new Ask[num2];
			for (int j = 0; j < num2; j++)
			{
				level2Snapshot.asks[j] = (Ask)this.streamerManager.Deserialize(reader);
			}
			return level2Snapshot;
		}
        public override void Write(BinaryWriter writer, object obj)
        {
            Level2Snapshot level2Snapshot = (Level2Snapshot)obj;

            writer.Write(0);
            writer.Write(level2Snapshot.dateTime.ToBinary());
            writer.Write(level2Snapshot.providerId);
            writer.Write(level2Snapshot.instrumentId);
            writer.Write(level2Snapshot.bids.Length);
            Bid[] bids = level2Snapshot.bids;
            for (int i = 0; i < bids.Length; i++)
            {
                Bid obj2 = bids[i];
                this.streamerManager.Serialize(writer, obj2);
            }
            writer.Write(level2Snapshot.asks.Length);
            Ask[] asks = level2Snapshot.asks;
            for (int j = 0; j < asks.Length; j++)
            {
                Ask obj3 = asks[j];
                this.streamerManager.Serialize(writer, obj3);
            }
        }
Example #10
0
        public override object Read(BinaryReader reader)
        {
            Level2Snapshot level2Snapshot = new Level2Snapshot();

            reader.ReadByte();
            level2Snapshot.dateTime     = DateTime.FromBinary(reader.ReadInt64());
            level2Snapshot.providerId   = reader.ReadByte();
            level2Snapshot.instrumentId = reader.ReadInt32();
            int num = reader.ReadInt32();

            level2Snapshot.bids = new Bid[num];
            for (int i = 0; i < num; i++)
            {
                level2Snapshot.bids[i] = (Bid)this.streamerManager.Deserialize(reader);
            }
            int num2 = reader.ReadInt32();

            level2Snapshot.asks = new Ask[num2];
            for (int j = 0; j < num2; j++)
            {
                level2Snapshot.asks[j] = (Ask)this.streamerManager.Deserialize(reader);
            }
            return(level2Snapshot);
        }
Example #11
0
 internal virtual void OnLevel2_(Level2Snapshot snapshot)
 {
     if (this.raiseEvents && this.instruments.Contains(snapshot.instrumentId))
     {
         this.OnLevel2(this.framework.InstrumentManager.GetById(snapshot.instrumentId), snapshot);
     }
     LinkedList<Strategy> linkedList = this.strategiesByInstrument[snapshot.instrumentId];
     if (linkedList != null)
     {
         for (LinkedListNode<Strategy> linkedListNode = linkedList.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
         {
             linkedListNode.Data.OnLevel2_(snapshot);
         }
     }
 }
Example #12
0
		public void OnLevel2(Level2Snapshot snapshot)
		{
			if (this.orders[snapshot.instrumentId] == null)
			{
				return;
			}
			for (int i = 0; i < this.orders[snapshot.instrumentId].Count; i++)
			{
				Order order = this.orders[snapshot.instrumentId][i];
				this.Process(order, this.framework.dataManager.GetOrderBook(order.instrument));
				if (this.addQueueToOrderText)
				{
					order.Text = order.queueSize.ToString();
				}
			}
		}
Example #13
0
 protected internal virtual void OnLevel2(Instrument instrument, Level2Snapshot snapshot)
 {
 }
Example #14
0
		internal void OnLevel2Snapshot(Level2Snapshot snapshot)
		{
			OrderBook orderBook = this.book[snapshot.instrumentId];
			if (orderBook == null)
			{
				orderBook = new OrderBook();
				this.book[snapshot.instrumentId] = orderBook;
			}
			orderBook.Set(snapshot);
		}
Example #15
0
		public void OnLevel2(Level2Snapshot snapshot)
		{
		}
Example #16
0
 internal void OnLevel2(Level2Snapshot snapshot)
 {
     if (this.strategy != null && this.strategy.status == StrategyStatus.Running)
     {
         this.strategy.OnLevel2_(snapshot);
     }
 }
Example #17
0
 protected internal virtual void OnLevel2(Instrument instrument, Level2Snapshot snapshot)
 {
 }
Example #18
0
 public void OnLevel2(Level2Snapshot snapshot)
 {
     throw new NotImplementedException();
 }
Example #19
0
 public void OnLevel2(Level2Snapshot snapshot)
 {
 }