public void onTick(JTick tick) { var reTicks = new List <Tick>(); if (tick.time.before(Dates.daysAgo(2, Dates.now()))) { return; } var tickTime = date(tick.time); if (doOHLTicks) { reTicks.Add(new Tick(tick.open, 0, tickTime)); var openCloserToLow = tick.open - tick.low <= tick.high - tick.open; if (openCloserToLow) { reTicks.Add(new Tick(tick.low, 0, tickTime)); reTicks.Add(new Tick(tick.high, 0, tickTime)); } else { reTicks.Add(new Tick(tick.high, 0, tickTime)); reTicks.Add(new Tick(tick.low, 0, tickTime)); } doOHLTicks = false; } reTicks.Add(new Tick(tick.last, (ulong)tick.volume, tickTime)); foreach (var reTick in reTicks) { doOnTick(reTick); } }
void safeProcessTick(TickListener listener, JTick t) { try { listener.onTick(t); } catch (Exception e) { LogC.err(symbol.name + " failed processing " + t, e); } }
public void onTick(JTick t) { lastTick = t; each(listeners, listener => safeProcessTick(listener, t)); }
public void onTick(JTick tick) { doOnPartialBar(new Bar(tick)); }