예제 #1
0
		public MarketOrder SendMarketOrder(Instrument instrument, Side side, double qty)
		{
			MarketOrder marketOrder = new MarketOrder(instrument, side, qty);
			this.Strategy.EB2iXBUSFK((SingleOrder)marketOrder);
			marketOrder.Send();
			return marketOrder;
		}
예제 #2
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();
 }
예제 #3
0
		public MarketOrder MarketOrder(Instrument instrument, Side side, double qty, string text)
		{
			MarketOrder marketOrder = new MarketOrder(instrument, side, qty, text);
			this.Strategy.EB2iXBUSFK((SingleOrder)marketOrder);
			return marketOrder;
		}