示例#1
0
        internal static TransactionBookData ToTransactionBookData(XmlNode tranNode)
        {
            string tranCode = string.Empty;
            Guid?  orderBatchInstructionId;
            TransactionBookData tranData = TransactionParser.ParseTransactionBookData(tranNode, out orderBatchInstructionId);

            tranData.Id     = Guid.Parse(tranNode.Attributes["ID"].Value);
            tranData.Orders = new List <OrderBookData>();

            var instrument = InstrumentManager.Default.Get(tranData.InstrumentId);
            InstrumentCategory instrumentCategory = instrument.Category;

            foreach (XmlNode orderNode in tranNode.ChildNodes)
            {
                if (orderNode.Name == "Order")
                {
                    OrderBookData orderData = null;
                    if (instrumentCategory == InstrumentCategory.Forex)
                    {
                        orderData = OrderDataHelper.InitializeBookData(orderNode);
                    }
                    else
                    {
                        orderData = OrderDataHelper.InitalizePhysicalBookData(orderNode);
                    }
                    orderData.OrderBatchInstructionID = orderBatchInstructionId;
                    tranData.Orders.Add(orderData);
                }
            }
            tranData.PlaceByRiskMonitor = true;
            return(tranData);
        }