Esempio n. 1
0
        private static void TimeOut()
        {
            List <CanceledOrder> listRemove = new List <CanceledOrder>();

            while (Runing)
            {
                foreach (var order in listTimeCancel.ToArray())
                {
                    if (DateTime.Now > order.TimeOut)
                    {
                        MrWangConnection.CanceledOrder(order.OrderBook);
                        listRemove.Add(order);
                    }
                }

                if (listRemove.Count > 0)
                {
                    foreach (var order in listRemove)
                    {
                        listTimeCancel.Remove(order);
                    }

                    listRemove.Clear();
                }

                Thread.Sleep(1);
            }
        }
Esempio n. 2
0
        private static void SendQuoteOrder(QuoteOrder quoteOrder)
        {
            Console.WriteLine($"新增 QuoteOrder: {quoteOrder.Symbol}" +
                              $" {quoteOrder.Bid}({quoteOrder.BidQty})/{quoteOrder.Ask}({quoteOrder.AskQty})");

            if (dicQuoteOrder.ContainsKey(quoteOrder.Symbol) == false)
            {
                dicQuoteOrder.Add(quoteOrder.Symbol, quoteOrder);
            }
            else
            {
                var CancelQutoeOrder = dicQuoteOrder[quoteOrder.Symbol];

                MrWangConnection.CanceledOrder(CancelQutoeOrder.BidOrderBook);
                MrWangConnection.CanceledOrder(CancelQutoeOrder.AskOrderBook);

                dicQuoteOrder[quoteOrder.Symbol] = quoteOrder;
            }

            SendOrder(quoteOrder);
        }