/// <summary>
        /// Creates an XML Element representing a placment in the execution document.
        /// </summary>
        /// <param name="xmlDocument">The destination XML document.</param>
        /// <param name="execution">A execution record.</param>
        public LocalExecutionElement(XmlDocument xmlDocument, ExecutionSet.ExecutionRow executionRow) :
            base("LocalExecution", xmlDocument)
        {
            // Broker field
            if (!executionRow.IsBrokerIdNull())
            {
                AddAttribute("BrokerId", executionRow.BrokerId.ToString());

                ClientMarketData.BrokerRow brokerRow = ClientMarketData.Broker.FindByBrokerId(executionRow.BrokerId);
                if (brokerRow != null)
                {
                    AddAttribute("BrokerId", brokerRow.BrokerId.ToString());
                    AddAttribute("BrokerName", brokerRow.ObjectRow.Name);
                    AddAttribute("BrokerSymbol", brokerRow.Symbol);
                    if (!brokerRow.IsPhoneNull())
                    {
                        AddAttribute("BrokerPhone", brokerRow.Phone);
                    }
                }
            }

            // Add the attributes of a execution to this record.
            AddAttribute("ExecutionId", executionRow.ExecutionId.ToString());
            AddAttribute("Quantity", executionRow.Quantity.ToString());
            AddAttribute("Price", executionRow.Price.ToString());
            AddAttribute("Commission", executionRow.Commission.ToString());
            AddAttribute("AccruedInterest", executionRow.AccruedInterest.ToString());
            AddAttribute("UserFee0", executionRow.UserFee0.ToString());
            AddAttribute("UserFee1", executionRow.UserFee1.ToString());
            AddAttribute("UserFee2", executionRow.UserFee2.ToString());
            AddAttribute("UserFee3", executionRow.UserFee3.ToString());
            AddAttribute("TradeDate", executionRow.TradeDate.ToString("s"));
            AddAttribute("SettlementDate", executionRow.SettlementDate.ToString("s"));
        }
Beispiel #2
0
 /// <summary>
 /// Creates an XML Element representing a broker in a execution document.
 /// </summary>
 /// <param name="xmlDocument">The destination XML document.</param>
 /// <param name="brokerRow">A broker record.</param>
 public BrokersElement(XmlDocument xmlDocument, ClientMarketData.BrokerRow brokerRow) : base("Broker", xmlDocument)
 {
     // Add the attributes of a broker to this record.
     AddAttribute("BrokerId", brokerRow.BrokerId.ToString());
     AddAttribute("BrokerName", brokerRow.ObjectRow.Name);
     AddAttribute("BrokerSymbol", brokerRow.Symbol);
     if (!brokerRow.IsPhoneNull())
     {
         AddAttribute("BrokerPhone", brokerRow.Phone);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Creates an XML Element representing a placment in the order document.
        /// </summary>
        /// <param name="xmlDocument">The destination XML document.</param>
        /// <param name="orderRow">A order record.</param>
        public LocalOrderElement(XmlDocument xmlDocument, LocalOrderSet.OrderRow orderRow) :
            base("LocalOrder", xmlDocument)
        {
            // Add the attributes of a order to this record.
            AddAttribute("OrderId", orderRow.OrderId.ToString());

            // Account field
            if (!orderRow.IsAccountIdNull())
            {
                AddAttribute("AccountId", orderRow.AccountId.ToString());

                ClientMarketData.AccountRow accountRow = ClientMarketData.Account.FindByAccountId(orderRow.AccountId);
                if (accountRow != null)
                {
                    AddAttribute("AccountId", accountRow.AccountId.ToString());
                    AddAttribute("AccountName", accountRow.ObjectRow.Name);
                    AddAttribute("AccountMnemonic", accountRow.Mnemonic);
                }
            }

            // Security field
            if (!orderRow.IsSecurityIdNull())
            {
                AddAttribute("SecurityId", orderRow.SecurityId.ToString());

                ClientMarketData.SecurityRow securityRow = ClientMarketData.Security.FindBySecurityId(orderRow.SecurityId);
                if (securityRow != null)
                {
                    AddAttribute("SecurityId", securityRow.SecurityId.ToString());
                    AddAttribute("SecurityName", securityRow.ObjectRow.Name);
                    AddAttribute("SecuritySymbol", securityRow.Symbol);
                }
            }

            // Broker field
            if (!orderRow.IsBrokerIdNull())
            {
                AddAttribute("BrokerId", orderRow.BrokerId.ToString());

                ClientMarketData.BrokerRow brokerRow = ClientMarketData.Broker.FindByBrokerId(orderRow.BrokerId);
                if (brokerRow != null)
                {
                    AddAttribute("BrokerId", brokerRow.BrokerId.ToString());
                    AddAttribute("BrokerName", brokerRow.ObjectRow.Name);
                    AddAttribute("BrokerSymbol", brokerRow.Symbol);
                    if (!brokerRow.IsPhoneNull())
                    {
                        AddAttribute("BrokerPhone", brokerRow.Phone);
                    }
                }
            }

            // TransactionType field
            if (!orderRow.IsTransactionTypeCodeNull())
            {
                AddAttribute("TransactionTypeCode", orderRow.TransactionTypeCode.ToString());

                ClientMarketData.TransactionTypeRow transactionTypeRow = ClientMarketData.TransactionType.FindByTransactionTypeCode(orderRow.TransactionTypeCode);
                if (transactionTypeRow != null)
                {
                    AddAttribute("TransactionTypeMnemonic", transactionTypeRow.Mnemonic);
                }
            }

            // TimeInForce field
            if (!orderRow.IsTimeInForceCodeNull())
            {
                AddAttribute("TimeInForceCode", orderRow.TimeInForceCode.ToString());

                ClientMarketData.TimeInForceRow timeInForceRow = ClientMarketData.TimeInForce.FindByTimeInForceCode(orderRow.TimeInForceCode);
                if (timeInForceRow != null)
                {
                    AddAttribute("TimeInForceMnemonic", timeInForceRow.Mnemonic);
                }
            }

            // OrderType field
            if (!orderRow.IsOrderTypeCodeNull())
            {
                AddAttribute("OrderTypeCode", orderRow.OrderTypeCode.ToString());

                ClientMarketData.OrderTypeRow orderTypeRow = ClientMarketData.OrderType.FindByOrderTypeCode(orderRow.OrderTypeCode);
                if (orderTypeRow != null)
                {
                    AddAttribute("OrderTypeMnemonic", orderTypeRow.Mnemonic);
                }
            }

            if (!orderRow.IsQuantityNull())
            {
                AddAttribute("Quantity", orderRow.Quantity.ToString());
            }
            if (!orderRow.IsPrice1Null())
            {
                AddAttribute("Price1", orderRow.Price1.ToString());
            }
            if (!orderRow.IsPrice2Null())
            {
                AddAttribute("Price2", orderRow.Price2.ToString());
            }
        }