Ejemplo n.º 1
0
        private void buttonAddOrder_Click(object sender, EventArgs e)
        {
            if (_selectedSession == null)
            {
                MessageBox.Show("Select a session to send order to.");
                return;
            }

            if (_selectedSession.DataProvider.OperationalState != OperationalStateEnum.Operational ||
                _selectedSession.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational)
            {
                MessageBox.Show("Session data or order execution provider not operational.");
                return;
            }

            NewOrderControl control = new NewOrderControl(_selectedSession.DataProvider.Quotes, _selectedSession.Info, false, false);

            control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);

            HostingForm f = new HostingForm("New Order", control);

            f.FormBorderStyle = FormBorderStyle.FixedSingle;
            f.ShowDialog();
            control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);
        }
Ejemplo n.º 2
0
        private void toolStripButtonNewOrder_Click(object sender, EventArgs e)
        {
            if (_manager == null)
            {
                return;
            }

            Position position = SelectedPosition;

            if (position == null)
            {
                MessageBox.Show("Select a position to put order to.");
                return;
            }

            if (position.DataDelivery.OperationalState != OperationalStateEnum.Operational ||
                position.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational)
            {
                MessageBox.Show("Position data or order execution provider not operational.");
                return;
            }

            IQuoteProvider  quotes = _manager.ObtainQuoteProvider(position.DataDelivery.SourceId, position.Symbol);
            DataSessionInfo?info   = _manager.GetSymbolDataSessionInfo(position.DataDelivery.SourceId, position.Symbol);

            if (info.HasValue == false)
            {
                MessageBox.Show("Failed to establish position session.", Application.ProductName + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewOrderControl control = new NewOrderControl(quotes, info.Value, true, true);

            control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);

            HostingForm f = new HostingForm("New Order", control);

            f.FormBorderStyle = FormBorderStyle.FixedSingle;
            f.MaximizeBox     = false;
            f.ShowDialog();
            control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);
        }
        private void buttonAddOrder_Click(object sender, EventArgs e)
        {
            if (_selectedSession == null)
            {
                MessageBox.Show("Select a session to send order to.");
                return;
            }

            if (_selectedSession.DataProvider.OperationalState != OperationalStateEnum.Operational
                || _selectedSession.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational)
            {
                MessageBox.Show("Session data or order execution provider not operational.");
                return;
            }

            NewOrderControl control = new NewOrderControl(_selectedSession.DataProvider.Quotes, _selectedSession.Info, false, false);
            control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);

            HostingForm f = new HostingForm("New Order", control);
            f.MaximizeBox = false;
            f.FormBorderStyle = FormBorderStyle.FixedSingle;
            f.ShowDialog();
            control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);
        }
        private void toolStripButtonNewOrder_Click(object sender, EventArgs e)
        {
            if (_manager == null)
            {
                return;
            }

            Position position = SelectedPosition;
            if (position == null)
            {
                MessageBox.Show("Select a position to put order to.");
                return;
            }

            if (position.DataDelivery.OperationalState != OperationalStateEnum.Operational
                || position.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational)
            {
                MessageBox.Show("Position data or order execution provider not operational.");
                return;
            }

            IQuoteProvider quotes = _manager.ObtainQuoteProvider(position.DataDelivery.SourceId, position.Symbol);
            DataSessionInfo? info = _manager.GetSymbolDataSessionInfo(position.DataDelivery.SourceId, position.Symbol);

            if (info.HasValue == false)
            {
                MessageBox.Show("Failed to establish position session.", Application.ProductName + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewOrderControl control = new NewOrderControl(quotes, info.Value, true, true);

            control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);

            HostingForm f = new HostingForm("New Order", control);
            f.FormBorderStyle = FormBorderStyle.FixedSingle;
            f.MaximizeBox = false;
            f.ShowDialog();
            control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);
        }