# Architecture (/docs/concepts/architecture) raikiri is a few programs on one machine. Gateways talk to the exchanges and write what they learn into shared memory. Everything else reads it from there. G[\"gatewayd, one per venue and market\"]\n G <-- \"shared memory\" --> K[\"strategyd: strategies and risk\"]\n G --> A[\"admind\"] --> T([\"terminal\"])\n A --> D[\"apid\"] --> R([\"your programs elsewhere\"])\n G & K -- \"journals\" --> P[(\"PostgreSQL, optional\")]" /> | Program | Job | | :-- | :-- | | `gatewayd` | holds one venue's connections for one market and publishes its prices | | `strategyd` | runs strategies, checks every order, tracks orders and positions | | `admind` | local HTTP and WebSocket API behind the terminal | | `apid` | signed API for programs | | `persisterd`, `candled` | copy journals into PostgreSQL and keep one-minute candles | ## Why one process per venue [#why-one-process-per-venue] Exchanges fail on their own schedule. With a process each, a dropped socket, a rate-limit ban or a crash in one parser stops one market, and readers see that its heartbeat has gone quiet. You can also restart or upgrade one gateway without touching the rest. The price is memory: each gateway holds a 64 MiB segment. ## Why shared memory [#why-shared-memory] A strategy reads a quote in place, without a network hop or a message broker between it and the gateway. Quotes and books keep only the newest value, so a slow reader skips ahead instead of falling behind. Trades and order events go through a queue that tells a reader when it has missed something, because a missed fill matters. [Benchmarks](/docs/performance/benchmarks) has the timings. This also means strategies and gateways must run on the same machine. Programs elsewhere use the [client API](/docs/guides/client-api). ## Prices are integers [#prices-are-integers] A price is a count of the instrument's tick and a size is a count of its lot, both 64-bit integers from the venue's message to the database. A value that is not an exact multiple is refused, never rounded. Every record carries two times: `ts_event`, the venue's clock, and `ts_init`, when this machine received it. ## When something stops [#when-something-stops] - **A gateway dies.** `strategyd` sends it no new orders. When it returns, it reloads the venue's instruments and books. - **`strategyd` restarts.** It rebuilds open orders and positions from its journal, and waits for the venue to agree before it opens anything new. See [Life of an order](/docs/concepts/order-path). - **PostgreSQL is down.** Trading does not depend on it. - **Binaries from different releases are mixed.** They refuse to share memory instead of misreading each other. Replace them all together. # Life of an order (/docs/concepts/order-path) Every order takes the same road, whether it comes from a strategy, the terminal or the client API. On paper the venue at the end is simulated. With [raikiri Pro](/docs/pro) it is a real one. The order is written to the journal before it goes to the gateway, so a restart always knows about it. The order id you get back means the order left `strategyd`. The venue's answer arrives later as an event. ## Cancel and amend [#cancel-and-amend] Cancels have a lane of their own ahead of new orders, and no risk check or halt ever blocks them. An amend from a strategy changes the price only, and a venue without native amends refuses it. Through the client API an amend is a confirmed cancel followed by a new order, so it loses its place in the queue. ## When no answer comes [#when-no-answer-comes] A request that was sent and got no reply may still have reached the exchange. raikiri does not guess: the order stays open until the venue's own records settle it. About every 30 seconds each gateway with keys asks the venue for positions, open orders, balances and fills, where the venue offers them. - **An order the venue no longer has** is closed and its strategy is told. - **A position that differs twice in a row** halts new orders to that gateway until a person resolves it. Cancels still go out. - **A venue that cannot answer** is recorded as unknown. A failed read is never taken for a flat position. Each disagreement is listed at `GET /v1/recon-breaks`. ## Sending the same order twice [#sending-the-same-order-twice] An order with the same book, instrument, side, price and size as one sent within the last second is refused as a duplicate. A market maker that repeats itself on purpose turns this off in the [risk file](/docs/concepts/risk). # Risk and limits (/docs/concepts/risk) Every new order passes one check inside `strategyd`. Cancels skip it and always go out. ## Declare capital first [#declare-capital-first] A fresh installation refuses every order with `no desk capital has been set`. Declare a figure on the Risk page, with `POST /v1/risk/capital`, or with `strategyd --seed-capital ` the first time. It is a person's statement that the limits were looked at. Only the simulated venue sets its own. ## Set the limits [#set-the-limits] ```yaml title="config/risk.yaml" defaults: max_order_notional: 20 # one order, in quote currency max_instrument_notional: 20 # worst case on one instrument max_strategy_notional: 100 # worst case over everything the strategy holds max_open_orders: 64 max_price_band_bp: 500 # distance from mid max_orders_in_window: 100 # per order_window_ms order_window_ms: 1000 max_quote_age_ms: 10000 # do not open on an older quote strategies: my-maker: { max_order_notional: 100, duplicate_window_ms: 0 } ``` The shipped limits are small on purpose. `defaults` applies to everything, and an entry under `strategies` overrides it by name or id. Limits can also be changed on a running desk through `/v1/risk`, where anything that lets more through must be confirmed. Exposure is counted at its worst: working orders on the same side count as filled, and orders on the other side are not netted off. An order that reduces a position is not held back by the notional limits. ## Books [#books] Orders, fills, positions and limits belong to a book: one for each strategy, one for manual trading, one for each API client. A book is `active`, `reducing` (only orders that shrink a position) or `halted` (only cancels). ## Stop trading [#stop-trading] | Call | Effect | | :-- | :-- | | `POST /v1/risk/kill` | halts everything and cancels every open order | | `POST /v1/risk/books/{id}/kill` | the same for one book | | `POST /v1/risk/resume` | lifts the desk's halt | A halt survives a restart and only a person lifts it. It does not close positions. ## Why was my order refused [#why-was-my-order-refused] A strategy sees only `Risk`. The limit that refused, and the numbers, are in `strategyd`'s log and at `GET /v1/audit`. # Add a venue (/docs/guides/add-venue) An adapter is a library under `libs/venues/` 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 [#steps] 1. **Capture real messages** from the venue into `tests/venues//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 [#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. # Client API (/docs/guides/client-api) `apid` is the signed API that programs use to place orders and follow them. The open framework runs it against a paper market. Connecting it to real accounts is part of [raikiri Pro](/docs/pro). ## Start the paper market [#start-the-paper-market] The paper deployment runs the real `apid` in front of a made-up market. No money and no exchange are involved. ```sh cmake --build build/dev-asan --target apid (cd sdk/python && uv sync) uv run --project sdk/python python examples/paper/paper.py ``` It prints three `export` lines. Paste them into another shell and run an example: ```sh uv run --project sdk/python python examples/python/place_and_cancel.py ``` ## Place an order [#place-an-order] ```python from raikiri import Client client = Client() # RAIKIRI_API_URL, RAIKIRI_API_KEY, RAIKIRI_API_SECRET btc = client.market.find("BTC/USDT", account="binance") order = client.orders.limit(btc, "buy", "0.001", "60000") print(client.orders.get(order.id).status) ``` The [C++ SDK](https://github.com/TeachPenguinsFly/raikiri/tree/master/sdk/cpp) has the same surface. Prices and sizes are exact decimals in both. The [examples](https://github.com/TeachPenguinsFly/raikiri/tree/master/examples) cover streams, TWAP, smart routing, an option chain and a market maker, in both languages. ## Know before you use it [#know-before-you-use-it] - An accepted call means the order was queued. A risk refusal comes after it and shows as status `denied`. - Every call that changes something carries an idempotency key, so a retry with the same key does not trade twice. - `OutcomeUnknown` means the call may have gone through. Check your orders before sending it again. - Positions are counted from the client's own fills. Balances belong to the account and are shared by its clients. Every route, field and error code is in [`client-api.yaml`](https://github.com/TeachPenguinsFly/raikiri/blob/master/schema/client-api.yaml). # Run a gateway (/docs/guides/gateway) A gateway is one `gatewayd` process for one venue and one market. `make up` starts them for you; on a server you start each one yourself. ```sh gatewayd --venue=bybit --market=perp --symbol=BTCUSDT --duration 20 ``` After twenty seconds it prints how many quotes, book updates and trades it received. A zero where you expect data usually means the venue changed or stopped that stream. | Flag | Meaning | | :-- | :-- | | `--venue` | a name from the [venue table](/docs/venues) | | `--market` | `spot`, `perp`, `future` or `option` | | `--symbol` | the venue's own symbol, repeatable; every instrument if left out | | `--channels` | any of `bbo,trades,depth,funding`; `bbo` is required | | `--duration` | seconds to run; until stopped if left out | | `--testnet` | the venue's test environment, where the adapter has one | An unknown flag is ignored without a message, so check the spelling if one seems to do nothing. `--help` lists the rest. ## Trading [#trading] This guide covers market data, which needs no keys. Sending orders to real accounts, with key handling and reconciliation, is part of [raikiri Pro](/docs/pro). ## Rate limits [#rate-limits] Exchanges answer a burst of requests with a ban of your IP address, and that takes down every gateway on it. `config/venues.yaml` keeps each venue below its limits. Without a valid `venues.yaml` the gateway still starts, and no limits apply to any venue. It logs `running unlimited`. Point `RAIKIRI_CONFIG_DIR` at the directory that holds the file. Two gateways for the same venue share its limits but count separately. Lower the figures if you run both. # Write a strategy (/docs/guides/strategy) A strategy overrides the callbacks it needs and trades through `Context`. All strategies run on one thread, so you need no locks, and a callback that blocks holds up every other strategy. ## 1. Write it [#1-write-it] This one keeps a single lot resting at the best BTC/USDT bid. ```cpp title="libs/strategies/include/raikiri/strategies/join_bid.hpp" #pragma once #include namespace raikiri::strategies { class JoinBid final : public strategy::Strategy { public: void on_bbo(strategy::Context& ctx, const Bbo& bbo) override { const auto* instrument = ctx.instrument(bbo.instrument); if (instrument == nullptr || base_of(*instrument).local_symbol.view() != "BTC/USDT") { return; // every instrument of every attached gateway arrives here } if (bbo.bid.is_undef() || bbo.bid == price_) { return; } if (resting_.valid()) { (void)ctx.cancel(resting_); } strategy::NewOrder order{}; order.instrument = bbo.instrument; order.side = Side::Buy; order.flags = OrderFlags::PostOnly; order.price = bbo.bid; order.qty = QtyLots::from_raw(1); resting_ = ctx.submit(order).value_or(ClientOrderId{}); price_ = bbo.bid; } private: ClientOrderId resting_{}; PriceTicks price_{}; }; } // namespace raikiri::strategies ``` It is an example, not a strategy to run with money: it buys on every fill and never sells. Attach it to one gateway, as below. ## 2. Register it [#2-register-it] Include the header in `libs/strategies/src/register.cpp` and register the type in `register_all`: ```cpp strategy::register_type(types, "join-bid"); ``` Then rebuild: `cmake --build --preset dev-asan --target strategyd gatewayd`. ## 3. Run it on the simulated venue [#3-run-it-on-the-simulated-venue] ```sh build/dev-asan/apps/gatewayd/gatewayd --venue=sim & build/dev-asan/apps/strategyd/strategyd --gateway=sim --strategy join-bid --duration 60 ``` The shipped risk limits allow orders up to 20 and one simulated BTC lot is worth about 50, so give `join-bid` its own entry in [`config/risk.yaml`](/docs/concepts/risk) first. To run it on live accounts, see [raikiri Pro](/docs/pro). `--duration` defaults to 10 seconds. ## Callbacks [#callbacks] | Callback | When | | :-- | :-- | | `on_start`, `on_stop` | the strategy starts or stops; after a stop its open orders are cancelled | | `on_bbo` | the best bid or ask changed; only the newest value is delivered | | `on_trade`, `on_funding` | a public trade, a funding update | | `on_order_event` | one of your orders was accepted, filled, cancelled or rejected | | `on_timer` | a timer set with `set_timer` came due; timers fire once | ## Context [#context] | Call | Does | | :-- | :-- | | `submit(order)` | sends an order; returns its id, or `Risk`, `Duplicate`, `VenueDown` or `Capacity` | | `cancel`, `cancel_all`, `amend` | act on your own orders | | `set_target(target)` | declares the position to hold; the difference goes out as a market order | | `bbo`, `instrument`, `position`, `unrealized` | read the latest state | The full interface is [`strategy.hpp`](https://github.com/TeachPenguinsFly/raikiri/blob/master/libs/strategy/include/raikiri/strategy/strategy.hpp), and [`demo_maker.hpp`](https://github.com/TeachPenguinsFly/raikiri/blob/master/libs/strategies/include/raikiri/strategies/demo_maker.hpp) quotes both sides. # Overview (/docs) This site documents the open, self-hosted framework. [raikiri Pro](/docs/pro) is our managed edition, run by TPF Labs on our infrastructure; it has [its own documentation](https://tpf-labs.com/developers/raikiri-pro/). raikiri connects to 43 crypto venues, centralised and on-chain, and gives your code one way to read their prices. You write a strategy in C++ and run it locally on paper, against a simulated exchange. A web terminal shows every venue's price for a market on one chart. Live trading is part of [raikiri Pro](/docs/pro). ![The raikiri terminal: one market's chart with every venue's price, the venues side by side and the order book](/img/terminal.png) ## What you get [#what-you-get] Prices, order books, trades and funding arrive in the same format from every venue, and reading them needs no API keys. A strategy runs through the same order path and risk checks as live trading, with a simulated exchange at the other end. No account, key or money is involved. Each venue and market runs in its own process, so when an exchange drops a socket or bans an address the others keep running. It all runs on your machine. ## Pick a path [#pick-a-path] | You want to | Start here | | :-- | :-- | | see live prices | [Quickstart](/docs/start/quickstart) | | run a strategy on paper | [Write a strategy](/docs/guides/strategy) | | try the API from Python or C++ | [Client API](/docs/guides/client-api) | | check that your venue is supported | [Venues](/docs/venues) | | trade live | [raikiri Pro](/docs/pro) | ## Is it ready [#is-it-ready] Version 0.1.0 is the first stable release, and market data runs on all 43 venues. Live execution is offered and supported only with Pro. The source in this repository includes the order-entry code of 24 adapters. We do not document or support running it against a real account. The open framework has no backtesting engine and runs on one machine, without failover. The API may change in any minor release before 1.0. The licence is LGPL-3.0: a strategy that links raikiri can stay closed source, and changes you distribute to raikiri itself are published under the same licence. There is no warranty, and trading can lose money. # Benchmarks (/docs/performance/benchmarks) Results of `make bench` on the machine below. To measure your own hardware, see [Reproduce](#reproduce). ## Hardware and build [#hardware-and-build] | | | | :-- | :-- | | Machine | Apple MacBook Pro, M4 Pro, 14 cores, 24 GB | | OS | macOS 15.7 | | Compiler | Apple clang 17, CMake preset `bench` (Release) | | Date | 2026-11-29, raikiri 0.1.0-beta.1 | | Load | a normal workday desktop, load average about 9; threads not pinned (macOS cannot pin) | Production runs on Linux x86-64. Gateways for 40+ venues have run together on one 6 vCPU, 24 GB cloud VM. ## Between two processes [#between-two-processes] Two processes, one SPSC ring each way in shared memory, 200,000 round trips. | Percentile | Round trip | One way | | :-- | --: | --: | | p50 | 167 ns | 83 ns | | p90 | 209 ns | 104 ns | | p99 | 250 ns | 125 ns | | p99.9 | 333 ns | 166 ns | | max | 13.7 µs | 6.9 µs | The maximum is scheduler preemption. On Linux the benchmark pins both sides with `--cpu A --cpu-child B`. ## Shared-memory primitives [#shared-memory-primitives] Single operation, one thread, no contention. | Operation | Time | Rate | | :-- | --: | --: | | seqlock read (latest quote) | 0.71 ns | 1.42 G/s | | SPSC push + pop | 1.70 ns | 589 M/s | | seqlock write | 1.71 ns | 584 M/s | | broadcast publish | 2.14 ns | 467 M/s | ## Order book [#order-book] Applying a venue's depth update and pruning the levels outside the band a strategy reads. | Operation | 50 levels | 500 levels | 1,000 levels | | :-- | --: | --: | --: | | drop levels beyond the band | 5.5 ns | 10.5 ns | 12.5 ns | | apply a delta, then prune | 31.6 ns | 49.9 ns | 56.9 ns | ## What these numbers do not include [#what-these-numbers-do-not-include] - Network time from the exchange to your machine, usually milliseconds. - TLS decryption and JSON parsing of a venue frame, which happen before the shared-memory write. ## Reproduce [#reproduce] ```sh make bench cd build/bench/bench ./shm_pingpong # cross-process round trip ./ring_throughput # seqlock and ring primitives ./ladder_prune # order book updates ./shm_pingpong --cpu 2 --cpu-child 3 # Linux: pin each side to a core ``` `bench/` also holds `trading_path`, `client_path`, `order_trail` and `option_board`, which time the risk gate, the client API and the option chain. Their results are not published yet. # raikiri Pro (/docs/pro) raikiri Pro is not something you download and run. TPF Labs deploys and operates it on our own infrastructure, as a separate deployment for each client, and your team uses it from the browser and the APIs. It has [its own documentation](https://tpf-labs.com/developers/raikiri-pro/). The rest of this site documents the open framework only. raikiri Pro is the managed edition of raikiri. It runs on the open framework described in the rest of this documentation, with the same gateways, risk gate and journals, and adds the parts a trading desk needs around them: execution across accounts, a client quoting engine, treasury, prediction-market trading and research tools. We trade our own capital on the same stack. ## Who it is for [#who-it-is-for] - A fund or proprietary desk that trades the same instruments on several venues and several accounts and wants one order path, one risk view and one record of what happened. - An OTC desk that quotes clients and hedges on exchanges. - A firm entering prediction markets that needs the venues connected and the same event matched across them. - A team that wants all of this run for them, without operating servers or exchange connections themselves. ## What it adds [#what-it-adds] ### Execution across accounts [#execution-across-accounts] A parent order is split across venues by price after each venue's fee, and across several accounts on one venue, each with its own limits. TWAP, VWAP, bracket, OCO and reduce-only orders can be paused, resumed and cancelled, and report progress while they work. A paired order sends two legs on different venues and closes the filled leg at once if the other is refused. The ticket shows average price, fees and price impact before anything is sent. ### RFQ and OTC desk [#rfq-and-otc-desk] The desk quotes a client a firm price built from the live books of every connected venue: what the size would cost to hedge, plus a spread set per client tier and size, leaning against the desk's current position. If the client accepts within the quote's lifetime, the desk fills them and hedges as a routed order. Clients connect with their own API keys, and every quote, acceptance and fill is recorded. ### Treasury [#treasury] Balances, margin and positions from every exchange account and on-chain wallet in one view, in dollars. Transfers are checked against a written policy before they are signed: which contracts may be called, which addresses may receive funds, the largest amount and fee. Automatic rebalancing between accounts is in development. ### Prediction markets [#prediction-markets] Polymarket, Novig, Kalshi, Hyperliquid's outcome markets, Limitless and Myriad on one board. The same game or event is matched across venues, so each outcome shows every venue's price side by side. Orders go through a desk process per venue that writes each order to disk before sending it, caps every order and every day, and cancels resting orders if it goes away. Postponed and cancelled games are flagged from the venues' feeds and a second public source. ### Research and backtesting [#research-and-backtesting] A Python backtester over recorded one-minute history with fees, slippage and liquidation, and paper trading on live prices with simulated fills. History is recorded from the same feeds the strategies trade on. ### Managed deployment and support [#managed-deployment-and-support] We run each client's deployment on our infrastructure: gateways close to each venue, a hub with the database, the web desk and the login, and our monitoring on all of it. Each client's deployment is separate from every other client's. Trading runs on the client's own exchange accounts. We ask for trade-only keys, and each key stays on the machine of that deployment that signs with it; we never hold client funds. Health checks, dashboards and Telegram alerts come with it, and updates are rolled out by us. ## Open framework and Pro [#open-framework-and-pro] | | Open (LGPL-3.0), self-hosted | Pro, managed by TPF Labs | | :-- | :-: | :-: | | Market data from 43 crypto venues | ✓ | ✓ | | Strategies on a simulated venue (paper trading) | ✓ | ✓ | | Shared-memory transport, risk gate, journals | ✓ | ✓ | | Web terminal, admin and client APIs, SDKs | ✓ | ✓ | | Live order entry on exchanges | | ✓ | | Order routing and execution algorithms | | ✓ | | Routing across accounts, paired orders, the execution ticket | | ✓ | | RFQ engine and client desk | | ✓ | | Treasury across exchanges and wallets, guarded transfers | | ✓ | | Prediction markets: six venues, event matching, order desks | | ✓ | | Backtester and recorded history | | ✓ | | Run by TPF Labs on our infrastructure, monitoring, alerts | | ✓ | Live order entry and routing are offered and supported only in Pro. The public repository still contains the order-entry source under the LGPL, but we do not support running it against live exchanges outside a Pro deployment. ## Documentation and access [#documentation-and-access] Pro is not available for self-hosting. [Its documentation](https://tpf-labs.com/developers/raikiri-pro/) covers the desk, the RFQ engine, treasury, prediction markets and the client APIs. To discuss a deployment, write to [contact@tpf-labs.com](mailto:contact@tpf-labs.com) or use the form at [tpf-labs.com](https://tpf-labs.com/#contact). # APIs and tools (/docs/reference/apis) | API | For | Address | Contract | | :-- | :-- | :-- | :-- | | Admin | the terminal and scripts on the same machine | `127.0.0.1:8787`, stream on `:8788` | [`admin-api.yaml`](https://github.com/TeachPenguinsFly/raikiri/blob/master/schema/admin-api.yaml) | | Client | programs on other machines, with signed keys | `127.0.0.1:8900`, behind your TLS proxy | [`client-api.yaml`](https://github.com/TeachPenguinsFly/raikiri/blob/master/schema/client-api.yaml) | | Strategy | C++ inside `strategyd` | | [`strategy.hpp`](https://github.com/TeachPenguinsFly/raikiri/blob/master/libs/strategy/include/raikiri/strategy/strategy.hpp) | The admin API can move money and is meant for this machine only. Do not expose it to a network. Use `apid` for that. ```sh curl -s http://127.0.0.1:8787/v1/health # what is running curl -s http://127.0.0.1:8787/v1/positions # what is held ``` Prometheus metrics are at `GET /metrics` on `admind`. Every program prints its flags with `--help` or when it is given wrong ones. ## For coding agents [#for-coding-agents] [`/llms.txt`](https://teachpenguinsfly.github.io/raikiri/llms.txt) lists these pages and [`/llms-full.txt`](https://teachpenguinsfly.github.io/raikiri/llms-full.txt) holds their whole text. For exact fields and routes, point the agent at the contracts above. They sit next to the code and are what the terminal's types are generated from. ## Versions [#versions] [RELEASES.md](https://github.com/TeachPenguinsFly/raikiri/blob/master/RELEASES.md) lists what each release changed. Linux x86-64 binaries are attached to [releases on GitHub](https://github.com/TeachPenguinsFly/raikiri/releases). # Quickstart (/docs/start/quickstart) You will build raikiri, start Bybit and open the terminal. No API keys are needed and nothing here places an order. ## Install the tools [#install-the-tools] ```sh xcode-select --install brew install cmake ninja conan node bash ``` ```sh sudo apt install -y g++-14 cmake ninja-build pipx pipx install conan curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash - sudo apt install -y nodejs ``` The compiler must be GCC 14, Clang 18 or Apple Clang 17. Docker is needed only for chart history. ## Build and start [#build-and-start] ```sh git clone https://github.com/TeachPenguinsFly/raikiri.git cd raikiri make deps && make build (cd frontend && npm install) make up VENUES=bybit ``` The first build takes several minutes. When it is up, open [http://127.0.0.1:5173](http://127.0.0.1:5173) and pick a market such as BTC/USDT. Ctrl+C stops everything. To check the data without the terminal: ```sh curl -s http://127.0.0.1:8787/v1/health ``` `alive` should be true and `priced`, the number of instruments with a quote, should grow. ## More venues and history [#more-venues-and-history] ```sh make venues # names you can start make up VENUES="binance bybit okx" # these three make up # all of them make dup # with PostgreSQL in Docker, for chart history; run `make web` beside it ``` The default build carries sanitizers and is slow. For many venues use the release build: `make deps PRESET=rel`, then `make up PRESET=rel`. ## Run a strategy on the simulated venue [#run-a-strategy-on-the-simulated-venue] ```sh make demo ``` This runs a market maker against a simulated exchange for ten seconds, through the same risk checks and order path as live trading, and prints a latency table. The simulator trades against random flow and charges no fees, so it shows that code works, not that a strategy makes money. ## If something is wrong [#if-something-is-wrong] - **`needs bash 4 or newer`**: macOS ships an older bash. Install it with Homebrew and put it first on `PATH`. - **A venue shows no prices**: read `/tmp/raikiri-dev/.log`. Some venues block certain countries. - **`conan_toolchain.cmake` not found**: run `make deps` with the same `PRESET` you build with. # Venues (/docs/venues) 43 venues: spot on 29, perpetual futures on 40, dated futures on 1 and options on 6. The adapters of 24 have order entry, over WebSocket on 8, and live trading on them is part of [raikiri Pro](/docs/pro). The name in the first column is what `gatewayd --venue` and `make up VENUES=` take. | Venue | Custody | Markets | Order entry | WS orders | Private stream | Funding ledger | | :-- | :-: | :-- | :-- | :-: | :-- | :-: | | `apex` | DEX | perp | REST | – | AuthSubscribe | – | | `arcus` | DEX | perp | market data only | – | – | – | | `aster` | DEX | spot · perp | REST | – | ListenKey | ✓ | | `backpack` | CEX | spot · perp | market data only | – | – | – | | `binance` | CEX | spot · perp · options | REST + WS | ✓ | ListenKey | ✓ | | `bingx` | CEX | spot · perp | REST | – | ListenKey | ✓ | | `bitfinex` | CEX | spot · perp | REST | – | AuthSubscribe | – | | `bitget` | CEX | spot · perp | REST + WS | ✓ | AuthSubscribe | ✓ | | `bithumb` | CEX | spot | market data only | – | – | – | | `bitstamp` | CEX | spot · perp | market data only | – | – | – | | `bitunix` | CEX | spot · perp | REST | – | – | – | | `blofin` | CEX | perp | REST | – | AuthSubscribe | – | | `bullish` | CEX | spot · perp | market data only | – | – | – | | `bybit` | CEX | spot · perp · options | REST + WS | ✓ | AuthSubscribe | ✓ | | `coinbase` | CEX | spot | REST | – | AuthSubscribe | – | | `cryptocom` | CEX | spot · perp | market data only | – | – | – | | `deribit` | CEX | spot · perp · futures · options | REST | – | AuthSubscribe | ✓ | | `derive` | DEX | perp · options | market data only | – | – | – | | `dydx` | DEX | perp | market data only | – | – | – | | `edgex` | DEX | spot · perp | REST | – | AuthSubscribe | – | | `extended` | DEX | perp | market data only | – | – | – | | `gate` | CEX | spot · perp · options | REST + WS | ✓ | AuthSubscribe | ✓ | | `grvt` | DEX | perp | market data only | – | – | – | | `htx` | CEX | spot · perp | REST | – | AuthSubscribe | ✓ | | `hyperliquid` | DEX | spot · perp | REST + WS | ✓ | AuthSubscribe | ✓ | | `kraken` | CEX | spot · perp | REST | – | AuthSubscribe | – | | `kucoin` | CEX | spot · perp | REST + WS | ✓ | ListenKey | ✓ | | `lbank` | CEX | spot · perp | market data only, no perp order API | – | – | – | | `lighter` | DEX | spot · perp | REST + WS | ✓ | AuthSubscribe | – | | `mexc` | CEX | spot · perp | REST | – | AuthSubscribe | ✓ | | `nado` | DEX | perp | market data only | – | – | – | | `okx` | CEX | spot · perp · options | REST + WS | ✓ | AuthSubscribe | ✓ | | `ondoperps` | DEX | perp | market data only | – | – | – | | `ostium` | DEX | perp | market data only | – | – | – | | `pacifica` | DEX | perp | market data only | – | – | – | | `paradex` | DEX | perp | market data only | – | – | – | | `phemex` | CEX | spot · perp | REST | – | AuthSubscribe | – | | `polymarketperps` | DEX | perp | market data only | – | – | – | | `toobit` | CEX | spot · perp | REST | – | ListenKey | – | | `upbit` | CEX | spot | market data only | – | – | – | | `vest` | DEX | perp | market data only | – | – | – | | `weex` | CEX | spot · perp | REST | – | AuthSubscribe | ✓ | | `xt` | CEX | spot · perp | REST | – | ListenKey | ✓ | **Custody**: a CEX holds your coins, a DEX leaves them in a contract. **Private stream**: how fills arrive; with `–` they come from a periodic check of the account. **Funding ledger**: raikiri reads the funding the venue actually charged; without it, funding is not counted in profit and loss. The table shows what is written, not what has been proven on real accounts. A venue you need is missing? [Add it](/docs/guides/add-venue).