Beispiel #1
0
        public void Add(Order order)
        {
            HashSet <Order> set;
            int             key = PriceHelper.GetLevelByPrice(order.Price, Side);

            if (!grid.TryGetValue(key, out set))
            {
                set = new HashSet <Order>();
                grid.Add(key, set);
            }
            set.Add(order);
        }
 public void Add(Order order)
 {
     lock (this)
     {
         SortedSet <Order> set;
         int key = PriceHelper.GetLevelByPrice(order.Price, Side);
         if (!_Grid.TryGetValue(key, out set))
         {
             set = new SortedSet <Order>(this);
             _Grid.Add(key, set);
         }
         set.Add(order);
     }
 }
Beispiel #3
0
 public void Change(double price, double size)
 {
     lock (this)
     {
         int    key = PriceHelper.GetLevelByPrice(price, Side);
         double value;
         if (_Grid.TryGetValue(key, out value))
         {
             if (value + size < 0)
             {
                 _Grid.Remove(key);
             }
             else
             {
                 _Grid[key] = value + size;
             }
         }
     }
 }
        public void Set(double price, double size)
        {
            int key = PriceHelper.GetLevelByPrice(price, Side);

            if (size <= 0)
            {
                Grid.Remove(key);
            }
            else
            {
                Grid[key] = size;
            }
        }