Example #1
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;
			}
		}
Example #2
0
		public virtual void Clear()
		{
			this.allOrders.Clear();
			this.newOrders = null;
			this.pendingOrders = null;
			this.cancelledOrders = null;
			this.rejectedOrders = null;
			this.filledOrders = null;
		}
Example #3
0
		public virtual void Add(SingleOrder order)
		{
			this.allOrders.Add(order);
			this.newOrders = null;
			this.pendingOrders = null;
			this.cancelledOrders = null;
			this.rejectedOrders = null;
			this.filledOrders = null;
		}
Example #4
0
		public InstrumentOrderListTable()
		{
			this.allOrders = new OrderList();
		}
Example #5
0
		public OrderList GetOrderList(OrdStatus ordStatus)
		{
			OrderList orderList = new OrderList();
			foreach (SingleOrder singleOrder in this.allOrders)
			{
				if (singleOrder.OrdStatus == ordStatus)
					orderList.Add(singleOrder);
			}
			return orderList;
		}
Example #6
0
		public virtual void Update(SingleOrder order)
		{
			this.newOrders = null;
			this.pendingOrders = null;
			this.cancelledOrders = null;
			this.rejectedOrders = null;
			this.filledOrders = null;
		}
Example #7
0
 public InstrumentOrderListTable()
 {
     this.allOrders = new OrderList();
 }
Example #8
0
 public static OrderList GetOCAGroup(string name)
 {
     OrderList orderList = new OrderList();
     if (name != "")
     {
         foreach (SingleOrder singleOrder in (FIXGroupList) OrderManager.Orders.All)
         {
             if (!singleOrder.IsDone && singleOrder.OCAGroup == name)
                 orderList.Add((IOrder)singleOrder);
         }
     }
     return orderList;
 }