Inheritance: DataObject
 internal void OnLevel2(Level2Update l2u)
 {
     if (Strategy?.Status == StrategyStatus.Running)
     {
         Strategy.EmitLevel2(l2u);
     }
 }
Exemple #2
0
        internal void OnLevel2(Level2Update l2u)
        {
            var pId = l2u.ProviderId + 1;
            var iId = l2u.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(l2u);
            var orderBookAggr = this.idArray_4[iId] = this.idArray_4[iId] ?? new OrderBookAggr(iId);

            orderBookAggr.OnLevel2(l2u);
        }
Exemple #3
0
        public override object Read(BinaryReader reader, byte version)
        {
            var l2u = new Level2Update();

            l2u.DateTime     = new DateTime(reader.ReadInt64());
            l2u.ProviderId   = reader.ReadByte();
            l2u.InstrumentId = reader.ReadInt32();
            int count = reader.ReadInt32();

            l2u.Entries = new Level2[count];
            for (int i = 0; i < count; i++)
            {
                l2u.Entries[i] = (Level2)this.streamerManager.Deserialize(reader);
            }
            return(l2u);
        }
Exemple #4
0
        internal void OnLevel2(Level2Update l2u)
        {
            foreach (var level in l2u.Entries)
            {
                IList <Tick> list = null;
                switch (level.Side)
                {
                case Level2Side.Bid:
                    list = Bids;
                    break;

                case Level2Side.Ask:
                    list = Asks;
                    break;
                }
                switch (level.Action)
                {
                case Level2UpdateAction.New:
                    list.Insert(level.InstrumentId, new Tick(level));
                    break;

                case Level2UpdateAction.Change:
                    list[level.InstrumentId].Size = level.Size;
                    break;

                case Level2UpdateAction.Delete:
                    if (level.InstrumentId >= list.Count)
                    {
                        Console.WriteLine($"OrderBook::{level.Side}  Delete warning at index: {level.InstrumentId}, max index: {list.Count - 1}, InstrumentId: {level.InstrumentId}");
                        list.RemoveAt(list.Count - 1);
                    }
                    else
                    {
                        list.RemoveAt(level.InstrumentId);
                    }
                    break;

                case Level2UpdateAction.Reset:
                    list.Clear();
                    break;
                }
            }
        }
Exemple #5
0
 internal void OnLevel2(Level2Update l2u)
 {
     foreach (var level in l2u.Entries)
     {
         IList<Tick> list = null;
         switch (level.Side)
         {
             case Level2Side.Bid:
                 list = Bids;
                 break;
             case Level2Side.Ask:
                 list = Asks;
                 break;
         }
         switch (level.Action)
         {
             case Level2UpdateAction.New:
                 list.Insert(level.InstrumentId, new Tick(level));
                 break;
             case Level2UpdateAction.Change:
                 list[level.InstrumentId].Size = level.Size;
                 break;
             case Level2UpdateAction.Delete:
                 if (level.InstrumentId >= list.Count)
                 {
                     Console.WriteLine($"OrderBook::{level.Side}  Delete warning at index: {level.InstrumentId}, max index: {list.Count - 1}, InstrumentId: {level.InstrumentId}");
                     list.RemoveAt(list.Count - 1);
                 }
                 else
                     list.RemoveAt(level.InstrumentId);
                 break;
             case Level2UpdateAction.Reset:
                 list.Clear();
                 break;
         }
     }
 }
Exemple #6
0
 public void OnLevel2(Level2Update update)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 public void Save(Level2Update level2, SaveMode option = SaveMode.Add) => Save(level2.InstrumentId, level2, option);
 public void OnLevel2(Level2Update update)
 {
     // noop
 }
 public void OnLevel2(Level2Update update)
 {
     throw new NotImplementedException();
 }
 public override object Read(BinaryReader reader, byte version)
 {
     var l2u = new Level2Update();
     l2u.DateTime = new DateTime(reader.ReadInt64());
     l2u.ProviderId = reader.ReadByte();
     l2u.InstrumentId = reader.ReadInt32();
     int count = reader.ReadInt32();
     l2u.Entries = new Level2[count];
     for (int i = 0; i < count; i++)
         l2u.Entries[i] = (Level2)this.streamerManager.Deserialize(reader);
     return l2u;
 }
Exemple #11
0
 protected virtual void OnLevel2(Level2Update update)
 {
 }
Exemple #12
0
 internal virtual void vmethod_14(Level2Update update)
 {
     if (this.IsInstance)
     {
         this.OnLevel2(update);
     }
 }
Exemple #13
0
 public void OnLevel2(Level2Update update)
 {
     // noop
 }
        internal void OnLevel2(Level2Update l2u)
        {
            //lock (this.lck)
            //{
            //    this.bool_0 = false;
            //    Tuple<DateTime, List<Tick>, List<Tick>> tuple;
            //    if (this.GonEpGhAb.TryGetValue(l2u.ProviderId, out tuple))
            //    {
            //        tuple = new Tuple<DateTime, List<Tick>, List<Tick>>(l2u.DateTime, tuple.Item2, tuple.Item3);
            //    }
            //    else
            //    {
            //        tuple = new Tuple<DateTime, List<Tick>, List<Tick>>(l2u.DateTime, new List<Tick>(), new List<Tick>());
            //    }
            //    this.GonEpGhAb[l2u.ProviderId] = tuple;
            //    Level2[] level2_ = l2u.Entries;
            //    int i = 0;
            //    while (i < level2_.Length)
            //    {
            //        Level2 level = level2_[i];
            //        switch (level.Side)
            //        {
            //            case Level2Side.Bid:
            //                {
            //                    List<Tick> list = tuple.Item2;
            //                    goto IL_B2;
            //                }
            //            case Level2Side.Ask:
            //                {
            //                    List<Tick> list = tuple.Item3;
            //                    goto IL_B2;
            //                }
            //        }
            //        IL_1B4:
            //        i++;
            //        continue;
            //        IL_B2:
            //        switch (level.Action)
            //        {
            //            case Level2UpdateAction.New:
            //                {
            //                    List<Tick> list;
            //                    list.Insert(level.Position, new Tick(level));
            //                    goto IL_1B4;
            //                }
            //            case Level2UpdateAction.Change:
            //                {
            //                    List<Tick> list;
            //                    list[level.Position].size = level.Size;
            //                    goto IL_1B4;
            //                }
            //            case Level2UpdateAction.Delete:
            //                {
            //                    List<Tick> list;
            //                    if (level.Position >= list.Count)
            //                    {
            //                        Console.WriteLine($"OrderBook:: {level.Side} Delete warning at index:  {level.Position}, max index: {list.Count - 1}, InstrumentId: {level.InstrumentId}");

            //                        list.RemoveAt(list.Count - 1);
            //                        goto IL_1B4;
            //                    }
            //                    list.RemoveAt(level.Position);
            //                    goto IL_1B4;
            //                }
            //            case Level2UpdateAction.Reset:
            //                {
            //                    List<Tick> list;
            //                    list.Clear();
            //                    goto IL_1B4;
            //                }
            //            default:
            //                goto IL_1B4;
            //        }
            //    }
            //}
        }
Exemple #15
0
 internal void OnLevel2(Level2Update l2u)
 {
     if (Strategy?.Status == StrategyStatus.Running)
         Strategy.EmitLevel2(l2u);
 }
 internal void OnLevel2(Level2Update l2u)
 {
     var pId = l2u.ProviderId + 1;
     var iId = l2u.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(l2u);
     var orderBookAggr = this.idArray_4[iId] = this.idArray_4[iId] ?? new OrderBookAggr(iId);
     orderBookAggr.OnLevel2(l2u);
 }
 public void Save(Level2Update level2, SaveMode option = SaveMode.Add) => Save(level2.InstrumentId, level2, option);
Exemple #18
0
 internal void OnLevel2(Level2Update l2u)
 {
     //lock (this.lck)
     //{
     //    this.bool_0 = false;
     //    Tuple<DateTime, List<Tick>, List<Tick>> tuple;
     //    if (this.GonEpGhAb.TryGetValue(l2u.ProviderId, out tuple))
     //    {
     //        tuple = new Tuple<DateTime, List<Tick>, List<Tick>>(l2u.DateTime, tuple.Item2, tuple.Item3);
     //    }
     //    else
     //    {
     //        tuple = new Tuple<DateTime, List<Tick>, List<Tick>>(l2u.DateTime, new List<Tick>(), new List<Tick>());
     //    }
     //    this.GonEpGhAb[l2u.ProviderId] = tuple;
     //    Level2[] level2_ = l2u.Entries;
     //    int i = 0;
     //    while (i < level2_.Length)
     //    {
     //        Level2 level = level2_[i];
     //        switch (level.Side)
     //        {
     //            case Level2Side.Bid:
     //                {
     //                    List<Tick> list = tuple.Item2;
     //                    goto IL_B2;
     //                }
     //            case Level2Side.Ask:
     //                {
     //                    List<Tick> list = tuple.Item3;
     //                    goto IL_B2;
     //                }
     //        }
     //        IL_1B4:
     //        i++;
     //        continue;
     //        IL_B2:
     //        switch (level.Action)
     //        {
     //            case Level2UpdateAction.New:
     //                {
     //                    List<Tick> list;
     //                    list.Insert(level.Position, new Tick(level));
     //                    goto IL_1B4;
     //                }
     //            case Level2UpdateAction.Change:
     //                {
     //                    List<Tick> list;
     //                    list[level.Position].size = level.Size;
     //                    goto IL_1B4;
     //                }
     //            case Level2UpdateAction.Delete:
     //                {
     //                    List<Tick> list;
     //                    if (level.Position >= list.Count)
     //                    {
     //                        Console.WriteLine($"OrderBook:: {level.Side} Delete warning at index:  {level.Position}, max index: {list.Count - 1}, InstrumentId: {level.InstrumentId}");
                         
     //                        list.RemoveAt(list.Count - 1);
     //                        goto IL_1B4;
     //                    }
     //                    list.RemoveAt(level.Position);
     //                    goto IL_1B4;
     //                }
     //            case Level2UpdateAction.Reset:
     //                {
     //                    List<Tick> list;
     //                    list.Clear();
     //                    goto IL_1B4;
     //                }
     //            default:
     //                goto IL_1B4;
     //        }
     //    }
     //}
 }