2026-08-23
feed_sim.py learned to publish aggregated depth, so nqbook's L2 path has a
feed to run against.
--l2publishesnlib::levelrecords. The script keeps a five-level ladder per side around a mid price that random-walks one tick per interval, and sends one record per rung whose quantity changed, plus a quantity of 0 for every price the ladder left behind. Records carry the level's total resting quantity rather than a delta, which is what makes them idempotent — a repeat changes nothing.LEVEL_FORMATmirrors the 48-bytenlib::level, behind tag 2, with the same packed-sizeassertguardingORDER_FORMAT. Both layouts are still hand-written and unchecked against the header;md/krakengenerates its own fromcommon.h.- The two publishing loops are functions,
run_l3andrun_l2, whichmainpicks between. The argument parsing, the socket, and the shutdown path are shared. - nlib bumped to
4fc74f1fornlib::level, theorder_tag/trade_tag/level_tagframing constants, and thefeed_eventandrecordvariants.md/krakenpublishes the same frames as before; the regenerated bindings only gain the new record.
2026-08-22
The wire stopped being a transcription, and the feed grew a second channel.
nlibis a submodule, and the records are generated from it.md/kraken/build.rsruns bindgen overthird_party/nlib/include/nlib/common.h, so the crate publishes the C++ structs themselves — bindgen's size, alignment, and offset assertions hold them to the header, and the absence of aDefaultimpl forces every record to name every field. The hand-writtenOrderstruct and byte-offsetencodeinwire.rsare gone: a field added tocommon.his now a compile error here, not framesnqbooksilently drops for the wrong size.wire.rskeeps what is genuinely this crate's — framing, fixed-point parsing, timestamps, and the FNV-1a hashes — and readsPRICE_DECIMALS/QTY_DECIMALSoff nlib's own scales.- Kraken's
tradechannel is published alongsidelevel3, asnlib::tradebehind tag 1. The tape is public, so it needs no token and names no counterparty:buy_order_idandsell_order_idstay zero andsideis the aggressor's. The book stays driven entirely bylevel3; trades are tape datanqbook's writer stores alongside it. Snapshots are declined, since a reconnect would replay trades already published. - A channel is a module.
feed.rskeeps only what every connection does — connect, subscribe, detect stalls, back off, publish — and takes aChanneldescribing the rest;level3.rsandtrade.rsare the two. Both draw sequence numbers from one counter and feed one PUB socket, sonqbookstill reads a single ordered stream. The report line and totals gained a trade rate and count. cancel_qtyandnew_qtyfollow nlib. A delete carries the quantity leaving the book incancel_qty, a modify the new remainder innew_qty, sonqbookno longer readsqtyagainst the action.feed_sim.py'sORDER_FORMATmirrors the resulting 88-bytenlib::order.
Comments
Sign in to join the discussion.
No comments yet. Be the first.