예제 #1
0
 private void MakeOrder(Side side, OrdType ordType)
 {
     Instrument instrument = (this.dgvQuotes.SelectedRows[0] as QuoteViewRow).Instrument;
     byte route = (byte)0;
     if (this.executionProvider is IMultiRouteExecutionProvider)
         route = this.SelectedRoute;
     OrderMiniBlotterForm orderMiniBlotterForm = new OrderMiniBlotterForm();
     orderMiniBlotterForm.Init(instrument, ordType, side, route);
     if (orderMiniBlotterForm.ShowDialog((IWin32Window)this) == DialogResult.OK)
     {
         SingleOrder singleOrder = null;
         switch (ordType)
         {
             case OrdType.Market:
                 singleOrder = new MarketOrder(this.executionProvider, this.portfolio, instrument, side, (double)orderMiniBlotterForm.Qty);
                 break;
             case OrdType.Limit:
                 singleOrder = new LimitOrder(this.executionProvider, this.portfolio, instrument, side, (double)orderMiniBlotterForm.Qty, orderMiniBlotterForm.LimitPrice);
                 break;
             case OrdType.Stop:
                 singleOrder = new StopOrder(this.executionProvider, this.portfolio, instrument, side, (double)orderMiniBlotterForm.Qty, orderMiniBlotterForm.StopPrice);
                 break;
             case OrdType.StopLimit:
                 singleOrder = new StopLimitOrder(this.executionProvider, this.portfolio, instrument, side, (double)orderMiniBlotterForm.Qty, orderMiniBlotterForm.LimitPrice, orderMiniBlotterForm.StopPrice);
                 break;
         }
         ((NewOrderSingle)singleOrder).TimeInForce = orderMiniBlotterForm.TimeInForce;
         ((FIXNewOrderSingle)singleOrder).Route = (int)orderMiniBlotterForm.Route;
         singleOrder.Persistent = this.portfolio.Persistent;
         if (!((IProvider)this.executionProvider).IsConnected)
         {
             bool flag = false;
             if (MessageBox.Show(this, "Cannot send the order, because provider is not connected." + Environment.NewLine + "Do you want to connect to " + ((IProvider)this.executionProvider).Name + "?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
             {
                 flag = true;
                 ((IProvider)this.executionProvider).Connect(15000);
             }
             if (flag && !((IProvider)this.marketDataProvider).IsConnected)
             {
                 MessageBox.Show(this, "Unable to connect to " + this.marketDataProvider.Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             }
         }
         if (((IProvider)this.executionProvider).IsConnected)
             singleOrder.Send();
         if ((int)orderMiniBlotterForm.Route > 0)
             this.SelectedRoute = orderMiniBlotterForm.Route;
     }
     orderMiniBlotterForm.Dispose();
 }
예제 #2
0
		public LimitOrder SendLimitOrder(Instrument instrument, Side side, double qty, double price)
		{
			LimitOrder limitOrder = new LimitOrder(instrument, side, qty, price);
			this.Strategy.EB2iXBUSFK((SingleOrder)limitOrder);
			limitOrder.Send();
			return limitOrder;
		}
예제 #3
0
		public LimitOrder LimitOrder(Instrument instrument, Side side, double qty, double price)
		{
			LimitOrder limitOrder = new LimitOrder(instrument, side, qty, price);
			this.Strategy.EB2iXBUSFK(limitOrder);
			return limitOrder;
		}
예제 #4
0
		public LimitOrder LimitOrder(Instrument instrument, Side side, double qty, double price, string text)
		{
			LimitOrder limitOrder = new LimitOrder(instrument, side, qty, price, text);
			this.Strategy.EB2iXBUSFK((SingleOrder)limitOrder);
			return limitOrder;
		}