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
- Capture real messages from the venue into
tests/venues/<name>/fixtures. Parsers written from documentation alone fail on the fields it omits. - 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.
- Write the market-data client and run the gateway for twenty seconds. Every count must be above zero.
- Register the venue: an id in
libs/domain, a capability row inlibs/exec/src/caps.cpp, itsregister_adapter(), and the call to it inapps/gatewayd/main.cpp. Add it to the CMake files. - Add its rate limits to
config/venues.yaml, at about 90% of the published figures. - 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
doublecarries 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.