Пример #1
0
        // --------------------------------------------------------------

        public void UpdateHandlers()
        {
            lock (queue)
            {
                while (queue.Count > 0)
                {
                    OwnOrder        order = queue.Dequeue();
                    List <OwnOrder> orders;

                    if (list.TryGetValue(order.Price, out orders))
                    {
                        int i = 0;

                        while (i < orders.Count && orders[i].Id != order.Id)
                        {
                            i++;
                        }

                        if (i < orders.Count)
                        {
                            if (order.Active == 0)
                            {
                                if (orders.Count == 1)
                                {
                                    list.Remove(order.Price);
                                }
                                else
                                {
                                    orders.RemoveAt(i);
                                }
                            }
                            else
                            {
                                orders[i] = order;
                            }
                        }
                        else if (order.Active != 0)
                        {
                            orders.Add(order);
                        }
                    }
                    else if (order.Active != 0)
                    {
                        orders = new List <OwnOrder>();
                        orders.Add(order);
                        list.Add(order.Price, orders);
                    }

                    for (int i = 0; i < handlers.Count; i++)
                    {
                        handlers[i].OrdersUpdated(order.Price);
                    }
                }
            }
        }
Пример #2
0
        // --------------------------------------------------------------

        public void Enqueue(OwnOrder order)
        {
            lock (queue)
                queue.Enqueue(order);
        }
Пример #3
0
        // **********************************************************************

        public void PutOwnOrder(OwnOrder order)
        {
            OrdersList.Enqueue(order);
        }