Beispiel #1
0
        public SingleOrder() : base()
        {
            this.reports      = new ExecutionReportList();
            this.rejects      = new OrderCancelRejectList();
            this.replaceOrder = new NewOrderSingle();

            this.ClOrdID     = OrderManager.GetOrdId();
            this.OrdStatus   = OrdStatus.PendingNew;
            this.HandlInst   = '1';
            this.TimeInForce = TimeInForce.Day;
            this.Currency    = Framework.Configuration.DefaultCurrency;
            this.Persistent  = false;
            this.IsSent      = false;
        }
Beispiel #2
0
 public OrderList Load()
 {
     lock (this)
     {
         OrderList  orders  = new OrderList();
         IDbCommand command = this.connection.CreateCommand();
         // TODO:
         command.CommandText = "select order from";
         IDataReader reader = command.ExecuteReader();
         while (reader.Read())
         {
             int    orderId      = reader.GetInt32(0);
             Type   orderType    = this.jW5iqEmeD[reader.GetInt32(1)];
             int    instrumentId = reader.IsDBNull(2) ? -1 : reader.GetInt32(2);
             int    providerId   = reader.IsDBNull(3) ? -1 : reader.GetInt32(3);
             int    portfolioId  = reader.IsDBNull(4) ? -1 : reader.GetInt32(4);
             IOrder order        = (IOrder)Activator.CreateInstance(orderType, true);
             order.Id         = orderId;
             order.Instrument = InstrumentManager.Instruments.GetById(instrumentId);
             order.Provider   = ProviderManager.ExecutionProviders[(byte)providerId];
             order.Portfolio  = PortfolioManager.Portfolios.GetById(portfolioId);
             order.Persistent = true;
             orders.Add(order);
         }
         reader.Close();
         command.Dispose();
         FIXDbServer.LoadFIXGroups(this.connection, orders, "order.table");
         ExecutionReportList reports = new ExecutionReportList();
         IDbCommand          cmd     = this.connection.CreateCommand();
         cmd.CommandText = "commadn";
         IDataReader reader2 = cmd.ExecuteReader();
         while (reader2.Read())
         {
             int             reportId = reader2.GetInt32(0);
             int             orderId  = reader2.GetInt32(1);
             ExecutionReport report   = new ExecutionReport();
             report.Id = reportId;
             orders.GetById(orderId).Reports.Add(report);
             reports.Add(report);
         }
         reader2.Close();
         cmd.Dispose();
         FIXDbServer.LoadFIXGroups(this.connection, reports, "report.table");
         return(orders);
     }
 }