Class TickCapture
java.lang.Object
com.quantfinlib.data.TickCapture
- All Implemented Interfaces:
TickListener,AutoCloseable
Records every tick flowing through an
HftMarketDataBus into a QFLT
tick file: attach once, trade/observe as usual, close to flush — then
replay the session deterministically with TickFileReader.
Writing happens on the bus consumer thread through a 1 MB buffer
(~28 bytes/tick), which is comfortably below the bus's throughput; a disk
error surfaces as UncheckedIOException on that thread.
Latency note: a page-cache writeback or disk hiccup therefore
stalls the consumer thread. Fine for capture-only or research sessions;
when the same bus is TRADING, use AsyncTickCapture, which moves
the file I/O to a dedicated writer thread behind a ring.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TickCaptureattach(HftMarketDataBus bus, Path file) Creates a capture and subscribes it to every symbol on the bus.voidclose()voidonTick(int symbolId, double price, double size, long timestampNanos) long
-
Method Details
-
attach
Creates a capture and subscribes it to every symbol on the bus.- Throws:
IOException
-
onTick
public void onTick(int symbolId, double price, double size, long timestampNanos) - Specified by:
onTickin interfaceTickListener
-
ticksWritten
public long ticksWritten() -
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-