示例#1
0
 internal Protocal.OrderCommonData Parse(XmlNode orderXml)
 {
     Protocal.OrderCommonData order = this.CreateOrderData();
     this.ParseAttrs(order, orderXml);
     order.IfDoneOrderSetting = this.ParseIfDoneSetting(orderXml);
     if (!order.IsOpen)
     {
         this.ParseOrderRelation(order, orderXml);
     }
     return(order);
 }
示例#2
0
 protected virtual void ParseAttrs(Protocal.OrderCommonData order, XmlNode orderXml)
 {
     foreach (XmlAttribute attribute in orderXml.Attributes)
     {
         string nodeName  = attribute.Name;
         string nodeValue = attribute.Value;
         if (nodeName.Equals("ID"))
         {
             order.Id = new Guid(nodeValue);
             continue;
         }
         else if (nodeName.Equals("Lot"))
         {
             order.Lot = decimal.Parse(nodeValue);
             continue;
         }
         else if (nodeName.Equals("IsOpen"))
         {
             order.IsOpen = bool.Parse(nodeValue);
             continue;
         }
         else if (nodeName.Equals("IsBuy"))
         {
             order.IsBuy = bool.Parse(nodeValue);
             continue;
         }
         else if (nodeName.Equals("SetPrice"))
         {
             order.SetPrice = nodeValue;
             continue;
         }
         else if (nodeName.Equals("SetPrice2"))
         {
             order.SetPrice2 = nodeValue;
             continue;
         }
         else if (nodeName.Equals("TradeOption"))
         {
             order.TradeOption = (TradeOption)(int.Parse(nodeValue));
             continue;
         }
         else if (nodeName.Equals("DQMaxMove"))
         {
             order.DQMaxMove = int.Parse(nodeValue);
             continue;
         }
         else if (nodeName.Equals("BlotterCode"))
         {
             order.BlotterCode = nodeValue;
             continue;
         }
     }
 }
示例#3
0
 internal virtual void FillOrderCommonData(Protocal.OrderCommonData orderData, Guid instrumentId, DateTime?tradeDay = null)
 {
     this.Id                  = orderData.Id;
     this.TradeOption         = orderData.TradeOption;
     this.IsOpen              = orderData.IsOpen;
     this.IsBuy               = orderData.IsBuy;
     this.SetPrice            = PriceHelper.CreatePrice(orderData.SetPrice, instrumentId, tradeDay);
     this.SetPrice2           = PriceHelper.CreatePrice(orderData.SetPrice2, instrumentId, tradeDay);
     this.SetPriceMaxMovePips = orderData.SetPriceMaxMovePips;
     this.DQMaxMove           = orderData.DQMaxMove;
     this.Lot                 = orderData.Lot;
     this.OriginalLot         = orderData.OriginalLot != null ? orderData.OriginalLot.Value : orderData.Lot;
     this.LotBalance          = this.Lot;
 }
示例#4
0
 private void ParseOrderRelation(Protocal.OrderCommonData order, XmlNode xmlNode)
 {
     order.OrderRelations = new List <OrderRelationData>();
     foreach (XmlNode orderRelationChild in xmlNode.ChildNodes)
     {
         if (orderRelationChild.Name == "OrderRelation")
         {
             OrderRelationData orderRelaitonData = this.CreateOrderRelationData();
             orderRelaitonData.OpenOrderId  = Guid.Parse(orderRelationChild.Attributes["OpenOrderID"].Value);
             orderRelaitonData.CloseOrderId = order.Id;
             orderRelaitonData.ClosedLot    = Convert.ToDecimal(orderRelationChild.Attributes["ClosedLot"].Value);
             order.OrderRelations.Add(orderRelaitonData);
         }
     }
 }