Ejemplo n.º 1
0
        // Metoda IBosClient do składania nowego zlecenia.
        public string OrderCreate(OrderData data)
        {
            string clientId;

            Debug.WriteLine("\nOrderCreate...");
            using (Socket socket = NolClient.GetSyncSocket())
            {
                NewOrderSingleMsg request = new NewOrderSingleMsg();
                clientId                = request.ClientOrderId;   // automatycznie przydzielone kolejne Id
                request.Account         = data.AccountNumber;
                request.CreateTime      = data.MainData.CreateTime;
                request.Instrument      = FixmlInstrument.Find(data.MainData.Instrument);
                request.Side            = (data.MainData.Side == BosOrderSide.Buy) ? OrderSide.Buy : OrderSide.Sell;
                request.Type            = Order_GetType(data.MainData);
                request.Price           = data.MainData.PriceLimit;
                request.StopPrice       = data.MainData.ActivationPrice;
                request.Quantity        = data.MainData.Quantity;
                request.MinimumQuantity = data.MainData.MinimumQuantity;
                request.DisplayQuantity = data.MainData.VisibleQuantity;
                request.TimeInForce     = Order_GetTimeInForce(data.MainData);
                request.ExpireDate      = data.MainData.ExpirationDate;
                request.Send(socket);
                ExecutionReportMsg response = new ExecutionReportMsg(socket);
            }
            Debug.WriteLine("OrderCreate OK\n");
            return(clientId);
        }
Ejemplo n.º 2
0
 // Metoda IBosClient do anulowania istniejącego zlecenia.
 public void OrderCancel(OrderData data)
 {
     Debug.WriteLine("\nOrderCancel...");
     using (Socket socket = NolClient.GetSyncSocket())
     {
         OrderCancelRequestMsg request = new OrderCancelRequestMsg();
         request.Account        = data.AccountNumber;
         request.BrokerOrderId2 = data.BrokerId;
         request.Instrument     = FixmlInstrument.Find(data.MainData.Instrument);
         request.Side           = (data.MainData.Side == BosOrderSide.Buy) ? OrderSide.Buy : OrderSide.Sell;
         request.Quantity       = data.MainData.Quantity;
         request.Send(socket);
         ExecutionReportMsg response = new ExecutionReportMsg(socket);
     }
     Debug.WriteLine("OrderCancel OK\n");
 }
Ejemplo n.º 3
0
 // Metoda IBosClient do modyfikacji istniejącego zlecenia.
 public void OrderReplace(OrderData data)
 {
     Debug.WriteLine("\nOrderReplace...");
     using (Socket socket = NolClient.GetSyncSocket())
     {
         OrderReplaceRequestMsg request = new OrderReplaceRequestMsg();
         request.Account         = data.AccountNumber;
         request.BrokerOrderId2  = data.BrokerId;
         request.Instrument      = FixmlInstrument.Find(data.MainData.Instrument);
         request.Side            = (data.MainData.Side == BosOrderSide.Buy) ? OrderSide.Buy : OrderSide.Sell;
         request.Type            = Order_GetType(data.MainData);
         request.Price           = data.MainData.PriceLimit;
         request.StopPrice       = data.MainData.ActivationPrice;
         request.Quantity        = data.MainData.Quantity;
         request.MinimumQuantity = data.MainData.MinimumQuantity;
         request.DisplayQuantity = data.MainData.VisibleQuantity;
         request.TimeInForce     = Order_GetTimeInForce(data.MainData);
         request.ExpireDate      = data.MainData.ExpirationDate;
         request.Send(socket);
         ExecutionReportMsg response = new ExecutionReportMsg(socket);
     }
     Debug.WriteLine("OrderReplace OK\n");
 }