예제 #1
0
        /// <summary>
        /// Send a new Order Request
        /// </summary>
        /// <param name="orderSide">Order Side 'BUY/SELL'</param>
        /// <param name="orderPrice">limit price at which to send the order</param>
        private void SendOrder(string orderSide, decimal orderPrice)
        {
            // Create a new Object which will be used across the application
            OrderDetails orderDetails = new OrderDetails(SelectedOrderExecutionProvider.ProviderName);

            orderDetails.Price     = SelectedOrderType.Equals(OrderType.Market) ? 0 : orderPrice;
            orderDetails.StopPrice = OrderModel.TriggerPrice;
            orderDetails.Quantity  = OrderModel.Size;
            orderDetails.Side      = orderSide;
            orderDetails.Type      = SelectedOrderType;
            orderDetails.Security  = OrderModel.Security;

            // Add to selected provider collection for future reference and updates
            SelectedOrderExecutionProvider.AddOrder(orderDetails);

            // Create new order request
            OrderRequest orderRequest = new OrderRequest(orderDetails, OrderRequestType.New);

            // Raise event to notify listener
            EventSystem.Publish <OrderRequest>(orderRequest);
        }