Inheritance: DataObject
Exemplo n.º 1
0
        public Level2Snapshot GetLevel2Snapshot(List <byte> providers = null)
        {
            Level2Snapshot result;

            lock (this.lck)
            {
                if (!this.bool_0)
                {
                    this.method_7(providers);
                }
                List <Bid> list  = new List <Bid>();
                List <Ask> list2 = new List <Ask>();
                foreach (Tick current in this.bids)
                {
                    if (current is Bid)
                    {
                        list.Add(current as Bid);
                    }
                }
                foreach (Tick current2 in this.asks)
                {
                    if (current2 is Ask)
                    {
                        list2.Add(current2 as Ask);
                    }
                }
                result = new Level2Snapshot(this.dateTime_0, 0, this.instrumentId, list.ToArray(), list2.ToArray());
            }
            return(result);
        }
 public virtual void EmitLevel2Snapshot(Level2Snapshot snapshot)
 {
     this.framework.EventManager.OnEvent(new Level2Snapshot(snapshot)
     {
         ProviderId = (byte)Id
     });
 }
Exemplo n.º 3
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     if (Strategy?.Status == StrategyStatus.Running)
     {
         Strategy.EmitLevel2(l2s);
     }
 }
Exemplo n.º 4
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     Bids.Clear();
     Asks.Clear();
     foreach (var b in l2s.Bids)
         Bids.Add(new Tick(b));
     foreach (var a in l2s.Asks)
         Asks.Add(new Tick(a));
 }
Exemplo n.º 5
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     lock (this.lck)
     {
         this.bids.Clear();
         this.asks.Clear();
         this.bool_0 = false;
         this.GonEpGhAb[l2s.ProviderId] = new Tuple <DateTime, List <Tick>, List <Tick> >(l2s.DateTime, new List <Tick>(l2s.Bids), new List <Tick>(l2s.Asks));
     }
 }
Exemplo n.º 6
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     Bids.Clear();
     Asks.Clear();
     foreach (var b in l2s.Bids)
     {
         Bids.Add(new Tick(b));
     }
     foreach (var a in l2s.Asks)
     {
         Asks.Add(new Tick(a));
     }
 }
Exemplo n.º 7
0
        internal void OnLevel2(Level2Snapshot l2s)
        {
            var pId = l2s.ProviderId + 1;
            var iId = l2s.InstrumentId;

            this.idArray_10[pId] = this.idArray_10[pId] ?? new IdArray <OrderBook>(10240);
            var orderBook = this.idArray_10[pId][iId] = this.idArray_10[pId][iId] ?? new OrderBook();

            orderBook.OnLevel2(l2s);
            var orderBookAggr = this.idArray_4[iId] = this.idArray_4[iId] ?? new OrderBookAggr(iId);

            orderBookAggr.OnLevel2(l2s);
        }
Exemplo n.º 8
0
        public override object Read(BinaryReader reader, byte version)
        {
            var l2s = new Level2Snapshot
            {
                DateTime     = new DateTime(reader.ReadInt64()),
                ProviderId   = reader.ReadByte(),
                InstrumentId = reader.ReadInt32()
            };
            int count;

            count    = reader.ReadInt32();
            l2s.Bids = new Bid[count];
            for (var i = 0; i < count; i++)
            {
                l2s.Bids[i] = (Bid)this.streamerManager.Deserialize(reader);
            }
            count    = reader.ReadInt32();
            l2s.Asks = new Ask[count];
            for (var i = 0; i < count; i++)
            {
                l2s.Asks[i] = (Ask)this.streamerManager.Deserialize(reader);
            }
            return(l2s);
        }
Exemplo n.º 9
0
 public void OnLevel2(Level2Snapshot snapshot)
 {
     // noop
 }
Exemplo n.º 10
0
 public Level2Snapshot(Level2Snapshot snapshot)
     : this(snapshot.dateTime, snapshot.ProviderId, snapshot.InstrumentId, snapshot.Bids, snapshot.Asks)
 {
     ExchangeDateTime = snapshot.ExchangeDateTime;
 }
Exemplo n.º 11
0
 public void OnLevel2(Level2Snapshot snapshot)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 12
0
 public Level2Snapshot(Level2Snapshot snapshot)
     : this(snapshot.dateTime, snapshot.ProviderId, snapshot.InstrumentId, snapshot.Bids, snapshot.Asks)
 {
     ExchangeDateTime = snapshot.ExchangeDateTime;
 }
Exemplo n.º 13
0
 public override object Read(BinaryReader reader, byte version)
 {
     var l2s = new Level2Snapshot
     {
         DateTime = new DateTime(reader.ReadInt64()),
         ProviderId = reader.ReadByte(),
         InstrumentId = reader.ReadInt32()
     };
     int count;
     count = reader.ReadInt32();
     l2s.Bids = new Bid[count];
     for (var i = 0; i < count; i++)
         l2s.Bids[i] = (Bid)this.streamerManager.Deserialize(reader);
     count = reader.ReadInt32();
     l2s.Asks = new Ask[count];
     for (var i = 0; i < count; i++)
         l2s.Asks[i] = (Ask)this.streamerManager.Deserialize(reader);
     return l2s;
 }
Exemplo n.º 14
0
 protected virtual void OnLevel2(Level2Snapshot snapshot)
 {
 }
Exemplo n.º 15
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     var pId = l2s.ProviderId + 1;
     var iId = l2s.InstrumentId;
     this.idArray_10[pId] = this.idArray_10[pId] ?? new IdArray<OrderBook>(10240);
     var orderBook = this.idArray_10[pId][iId] = this.idArray_10[pId][iId] ?? new OrderBook();
     orderBook.OnLevel2(l2s);
     var orderBookAggr = this.idArray_4[iId] = this.idArray_4[iId] ?? new OrderBookAggr(iId);
     orderBookAggr.OnLevel2(l2s);
 }
Exemplo n.º 16
0
 public void OnLevel2(Level2Snapshot snapshot)
 {
     // noop
 }
Exemplo n.º 17
0
 internal virtual void vmethod_13(Level2Snapshot snapshot)
 {
     if (this.IsInstance)
     {
         this.OnLevel2(snapshot);
     }
 }
Exemplo n.º 18
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     lock (this.lck)
     {
         this.bids.Clear();
         this.asks.Clear();
         this.bool_0 = false;
         this.GonEpGhAb[l2s.ProviderId] = new Tuple<DateTime, List<Tick>, List<Tick>>(l2s.DateTime, new List<Tick>(l2s.Bids), new List<Tick>(l2s.Asks));
     }
 }
Exemplo n.º 19
0
 public Level2Snapshot GetLevel2Snapshot(List<byte> providers = null)
 {
     Level2Snapshot result;
     lock (this.lck)
     {
         if (!this.bool_0)
         {
             this.method_7(providers);
         }
         List<Bid> list = new List<Bid>();
         List<Ask> list2 = new List<Ask>();
         foreach (Tick current in this.bids)
         {
             if (current is Bid)
             {
                 list.Add(current as Bid);
             }
         }
         foreach (Tick current2 in this.asks)
         {
             if (current2 is Ask)
             {
                 list2.Add(current2 as Ask);
             }
         }
         result = new Level2Snapshot(this.dateTime_0, 0, this.instrumentId, list.ToArray(), list2.ToArray());
     }
     return result;
 }
Exemplo n.º 20
0
 internal void OnLevel2(Level2Snapshot l2s)
 {
     if (Strategy?.Status == StrategyStatus.Running)
         Strategy.EmitLevel2(l2s);
 }
Exemplo n.º 21
0
 public void Save(Level2Snapshot level2, SaveMode option = SaveMode.Add) => Save(level2.InstrumentId, level2, option);
Exemplo n.º 22
0
 public virtual void EmitLevel2Snapshot(Level2Snapshot snapshot)
 {
     EventManager.OnEvent(new Level2Snapshot(snapshot){ProviderId = (byte)Id});
 }
Exemplo n.º 23
0
 public void OnLevel2(Level2Snapshot snapshot)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 24
0
 public void Save(Level2Snapshot level2, SaveMode option = SaveMode.Add) => Save(level2.InstrumentId, level2, option);