Esempio n. 1
0
        public static string GetOrderUid(trade.Order order)
        {
            string directionIndicator = order.Direction == trade.TradeDirectionType.BUY ?
                                        "B" : "S";

            return(string.Format("{0}-{1}", directionIndicator, order.InstrumentID));
        }
Esempio n. 2
0
        public void From(trade.Order order, bool fromParent = false)
        {
            OrderUid = GetOrderUid(order);

            Symbol     = order.InstrumentID;
            Direction  = GetDirection(order.Direction);
            OCFlag     = GetOCFlag(order.CombOffsetFlag);
            StatusMsg  = GetStatus(order.OrderSubmitStatus, order.OrderStatus);
            IsFinished = CheckForFinish(order.OrderSubmitStatus, order.OrderStatus);
            if (!string.IsNullOrEmpty(order.InsertTime))
            {
                InsertTime = DateTime.Parse(order.InsertTime);
            }
            Volume         = order.VolumeTotalOriginal;
            VolTraded      = order.VolumeTraded;
            OrderPriceType = GetPriceType(order.OrderPriceType);
            LimitPrice     = order.LimitPrice;

            if (!fromParent)
            {
                if (order.OrderSubmitStatus > trade.OrderSubmitStatusType.ACCEPTED)
                {
                    EventLogger.Write("{0} {1} 被拒绝 -({2})", Direction, Symbol, order.StatusMsg);
                }
            }
        }
Esempio n. 3
0
        public void From(string ordRef, trade.Order order)
        {
            int idx = LastOrder.Legs.FindIndex(
                l => l.InstrumentID == order.InstrumentID &&
                l.Direction == order.Direction);

            if (idx > -1)
            {
                LastOrder.Legs[idx] = order;

                foreach (var oVm in _orders)
                {
                    if (oVm.OrderUid == OrderVM.GetOrderUid(order))
                    {
                        oVm.From(order);
                        break;
                    }
                }
            }
        }
Esempio n. 4
0
        void _client_OnLegOrderUpdated(string portfId, string mlOrderId, string legOrdRef, trade.Order legOrder)
        {
            OrderUpdateArgs args = new OrderUpdateArgs
            {
                AccountId   = Id,
                PortfolioId = portfId,
                MlOrderId   = mlOrderId,
                LegOrderRef = legOrdRef,
                LegOrder    = legOrder
            };

            EventAggregator.GetEvent <IndividualOrderUpdatedEvent>().Publish(args);
        }