Skip to Content
raikiri

Add a venue

What an adapter consists of, where it is registered and what a good one gets right.

An adapter is a library under libs/venues/<name> that turns one exchange's API into raikiri's records. Copy bybit: it covers spot, perpetuals, options and order entry in about 5,000 lines. Market data alone is roughly half of that.

Steps

  1. Capture real messages from the venue into tests/venues/<name>/fixtures. Parsers written from documentation alone fail on the fields it omits.
  2. Write the parsers against those files, starting with the instrument list. Tick and lot sizes must be exact, since every price after them is a count of ticks.
  3. Write the market-data client and run the gateway for twenty seconds. Every count must be above zero.
  4. Register the venue: an id in libs/domain, a capability row in libs/exec/src/caps.cpp, its register_adapter(), and the call to it in apps/gatewayd/main.cpp. Add it to the CMake files.
  5. Add its rate limits to config/venues.yaml, at about 90% of the published figures.
  6. Update the venue table with scripts/venue_table.py --write.

What a good adapter gets right

  • A broken order book is dropped until the next snapshot. Nobody can tell a stale book from a live one.
  • A value that does not fit the tick or lot is refused, never rounded. No double carries money.
  • An order that was sent and got no answer is reported as unknown, not as rejected.
  • An order the venue cannot express is refused with a reason, not approximated.
Edit this page on GitHub

On this page