Esempio n. 1
0
 void fillOrderMaybe(Order order, Tick tick, Converter <Order, double> fillPrice, bool isClose)
 {
     if (order.canFill(tick.price, isClose))
     {
         fillAt(order, fillPrice(order), tick.time);
     }
 }
Esempio n. 2
0
        void fillOrders(Symbol symbol, Tick tick, Converter <Order, double> fillPrice, bool isClose)
        {
            var fillable = accept(orders(symbol), order => isFillable(order, symbol, tick.price, isClose));

            fillable = sort(fillable, (a, b) => {
                var fillA      = Math.Abs(tick.price - fillPrice(a));
                var fillB      = Math.Abs(tick.price - fillPrice(b));
                var priceOrder = fillB.CompareTo(fillA);
                return(priceOrder != 0 ? priceOrder : a.id.CompareTo(b.id));
            });
            each(fillable, order => fillOrderMaybe(order, tick, fillPrice, isClose));
        }
Esempio n. 3
0
 internal void processTick(Tick tick, Symbol symbol)
 {
     lock (partialBars) {
         trades.Clear();
         var price    = tick.price;
         var runClose = bridge.runOnClose() && !hasRunLiveClose && now().CompareTo(symbol.closeAt()) >= 0;
         fillOrders(symbol, tick, order => price, runClose);
         bridge.processTick(symbol, tick);
         gottenTicks = true;
         if (runClose)
         {
             hasRunLiveClose = true;
         }
     }
 }
Esempio n. 4
0
 protected override void onNewTick(Bar partialBar, Tick tick)
 {
 }
Esempio n. 5
0
 public abstract void processTick(Symbol symbol, Tick tick);
Esempio n. 6
0
 void fillOrdersNotOpen(Symbol symbol, Tick tick, bool isClose)
 {
     fillOrders(symbol, tick, order => order.fillPrice(tick.price, false), isClose);
 }
Esempio n. 7
0
 protected override void onNewTick(Bar partialBar, Tick tick)
 {
     placeOrders();
 }
Esempio n. 8
0
 public virtual void tickProcessed(Symbol symbol, Tick tick)
 {
 }
Esempio n. 9
0
 public override void tickProcessed(Symbol symbol, Tick tick)
 {
     positionMonitor.publishAll();
     systemHeartbeat[symbol].tickProcessed(tick);
 }