persistable sclass TickerSequence is IntSize { settable S market; // e.g. "TRBUSDT" new LongBuffer timestamps; new DoubleBuffer prices; void add(double price, long timestamp) { timestamps.add(timestamp); prices.add(price); } void add(double[] prices, long[] timestamps) { assertEquals(l(prices), l(timestamps)); this.prices.addAll(asList(prices)); this.timestamps.addAll(asList(timestamps)); } toString { ret "TickerSequence length " + n2(l(prices)); } TickerSequence subSequence(int start, int end) { new TickerSequence s; s.add( subDoubleArray(prices.toArray(), start, end), subArray(timestamps.toArray(), start, end)); ret s; } public int size() { ret l(prices); } public bool isEmpty() { ret size() == 0; } TimestampRange timeRange() { ret isEmpty() ? null : TimestampRange(first(timestamps), last(timestamps)); } }