Run a strategy
A live strategy is your own program. It runs on your machine, talks to your deployment over the client API and trades in its own book, under its own limits.
1. Backtest
On stored history, in the web desk
2. Write
The same logic on the client API
3. Paper
Run it against a made-up market
4. Live
Small limits, its own key and book
Ways to automate
| Runs on | Trades real accounts | |
|---|---|---|
| Algo order | Your deployment | Yes |
| Program on the client API | Your machine | Yes |
| Backtest | Your deployment | No, history only |
| C++ strategy in the open framework | Your machine | No, simulated exchange |
1. Backtest the idea
Write it in Python under Automation → Backtest. Backtesting lists what the simulation counts and what it leaves out. Backtest code does not trade, so the live version is a separate program.
2. Write the program
The Python SDK needs Python 3.10 or newer and installs from the repository: pip install ./sdk/python. This is the shape of a strategy. The C++ SDK has the same calls.
from raikiri import Book, Client
with Client() as client: # reads RAIKIRI_API_* variables
btc = client.market.find("BTC/USDT", account="binance")
try:
with client.stream(book=btc, levels=1, hz=5) as stream:
for event in stream:
if isinstance(event, Book) and event.bids and event.asks:
... # decide, then client.orders.limit(...)
finally:
client.orders.cancel_all(instrument=btc)Prices and sizes are exact decimals, and a float raises an error. A sent order means queued: a risk refusal arrives afterwards as status denied.
3. Run it on paper
The paper market is the real API in front of a random walk. No exchange, account or money is involved. It needs the open framework's build tools. Use it to test your code, not to judge profit or execution.
git clone https://github.com/TeachPenguinsFly/raikiri && cd raikiri
# build the tools once: see the open framework's quickstart
cmake --build build/dev-asan --target apid
(cd sdk/python && uv sync)
uv run --project sdk/python python examples/paper/paper.py# paste the three export lines that paper.py printed, then
uv run --project sdk/python python examples/python/market_maker.pyEight examples come with the SDKs, each in Python and C++:
| Example | Shows |
|---|---|
place_and_cancel | Place a limit order, look at it, cancel it |
stream_quotes | Print quotes as they arrive |
stream_fills | Watch your fills and position |
twap | Start a TWAP, watch, pause and resume it |
sor_slippage | Smart-route an order and read its slippage |
option_chain | One expiry with each strike's greeks |
market_maker | Requote on each book update, with a position limit |
stale_price_guard | Pull your orders when quotes stop |
They are in the repository. They show the mechanics and are not strategies to run with money. They refuse any address but your own machine unless you set RAIKIRI_EXAMPLES_LIVE=yes.
4. Go live
- Ask us for an API key for this strategy. The key's client trades in a book called
client:<client id>. - Set small limits on that book before the first order.
- Point the program at your deployment and start it.
export RAIKIRI_API_URL=https://api.example.com # the address we send you
export RAIKIRI_API_KEY=YOUR_KEY_ID
export RAIKIRI_API_SECRET=YOUR_SECRET
python my_strategy.pyWatch it and stop it
Orders and fills appear on the desk. To stop one strategy, press Kill on its book under Automation → Risk: new orders are refused and the open ones are cancelled. Positions stay open.