public void Update(OrderRelation orderRelation)
 {
     if (orderRelation != null)
     {
         this.OpenOrderId = orderRelation.OpenOrderId;
         this.OrderId = orderRelation.OrderId;
         this.ClosedLot = orderRelation.ClosedLot;
         this.RelationType = orderRelation.RelationType;
         this.OpenOrderPrice = orderRelation.OpenOrderPrice;
     }
 }
Esempio n. 2
0
 public void AddOrderRelation(OrderRelation orderRelation)
 {
     bool updated = false;
     foreach (OrderRelation item in this._OrderRelations)
     {
         if (item.Equals(orderRelation))
         {
             item.Update(orderRelation);
             updated = true;
         }
     }
     if (!updated)
     {
         this._OrderRelations.Add(orderRelation);
     }
 }
        private void Process(CommonOrderRelation commonOrderRelation)
        {
            Order order = null;
            if (this._Orders.ContainsKey(commonOrderRelation.OrderId))
            {
                order = this._Orders[commonOrderRelation.OrderId];

                if (commonOrderRelation.RelationType == OrderRelationType.Close)
                {
                    OrderRelation relation = new OrderRelation(commonOrderRelation);

                    Order openOrder = this._Orders.ContainsKey(relation.OpenOrderId) ? this._Orders[relation.OpenOrderId] : null;

                    if (openOrder != null)
                    {
                        string openOrderInfo = string.Format("{0}x{1}x{2}", openOrder.Transaction.SubmitTime.ToString("yyyy-MM-dd"), openOrder.Lot, openOrder.SetPrice);
                        relation.OpenOrderInfo = openOrderInfo;

                        CloseOrder closerOrder = new CloseOrder(order, relation.ClosedLot);
                        order.CloseOrders.Add(closerOrder);
                    }

                    order.Transaction.AddOrderRelation(relation);
                }
            }
        }