public void add(TickListener listener) { listeners.Add(listener); if (lastTick != null) { safeProcessTick(listener, lastTick); } }
public void add(ObservationListener listener) { listeners.Add(listener); if (lastDate != null) { safeProcessUpdate(listener, lastDate, lastValue); } }
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); } }