示例#1
0
        public void UpdateOrder(OrderUpd or)
        {
            if (OrderCollection.TryGetValue(or.Orderid, out Order ord))
            {
                ord.AvgPriceCum   = or.ExecPrice;
                ord.ExecSharesCum = or.ExecShares;
                ord.Status        = or.Status;
                ord.Rsn           = or.CxlReason;

                if (ord.ExecSharesCum == ord.OrdSize || or.Status == "FILLED")
                {
                    ord.IsActive = false;
                    ord.Status   = "FILLED";
                }
            }
        }
示例#2
0
        private OrderUpd GetRandomOrderUpd()
        {
            var random = new Random();

            if (_cache.OrderCollection.Count == 0)
            {
                return(null);
            }
            int    index = random.Next(_cache.OrderCollection.Count);
            string od    = _cache.OrderCollection.Keys.ToList()[index];
            var    order = new OrderUpd()
            {
                Orderid    = od,
                ExecShares = _execs[random.Next(_execs.Count())],
                ExecPrice  = _pxs[random.Next(_pxs.Count())],
                CxlReason  = _rsns[random.Next(_rsns.Count())],
                ExecTime   = DateTime.Now.ToShortTimeString(),
                Status     = _stats[random.Next(_stats.Count())],
            };


            return(order);
        }