Example #1
0
        public void PositionChange(Receiver receiver, SymbolInfo symbol, double signal, IList <LogicalOrder> orders)
        {
            int orderCount = orders == null?0:orders.Count;

            log.Info("Received PositionChange for " + symbol + " at position " + signal + " and " + orderCount + " orders.");
            if (orders != null)
            {
                foreach (var order in orders)
                {
                    log.Info("Logical Order: " + order);
                }
            }

            LogicalOrderHandler handler = symbolHandlers[symbol.BinaryIdentifier].LogicalOrderHandler;

            handler.SetDesiredPosition(signal);
            handler.SetLogicalOrders(orders);

            client.RequestOpenOrders();
        }
Example #2
0
 private void client_OpenOrderEnd(object sender, EventArgs e)
 {
     if (trace)
     {
         log.Trace("Open Order End ");
     }
     foreach (var kvp in symbolHandlers)
     {
         LogicalOrderHandler handler = kvp.Value.LogicalOrderHandler;
         handler.ClearPhysicalOrders();
     }
     foreach (var kvp in openOrders)
     {
         HandleOpenOrder(kvp.Value);
     }
     foreach (var kvp in symbolHandlers)
     {
         ulong               symbolBinaryId = kvp.Key;
         SymbolHandler       symbolHandler  = kvp.Value;
         LogicalOrderHandler orderHandler   = symbolHandler.LogicalOrderHandler;
         orderHandler.SetActualPosition(symbolHandler.Position);
         orderHandler.PerformCompare();
     }
 }