> For the complete documentation index, see [llms.txt](https://dev.strixlab.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.strixlab.io/guides/production-checklist.md).

# Going to Production

A checklist to work through before pointing a bot at mainnet. Each item exists because it has caused a real problem.

## Before you start

* [ ] **Run on testnet first.** `https://api-staging.strixlab.io/api` is a real order book with fake money.
* [ ] **Log the venue at startup.** Print `baseUrl` and `client.wsUrl` on boot. The most expensive bug in trading software is not knowing which venue you're on.
* [ ] **Check clock drift once at boot.** More than 30 seconds and every signed request fails with `invalid_signature`.
* [ ] **Store credentials in a secret manager**, never in the repo. Regenerating a key invalidates the old one immediately, so make reload a restart-free path if you can.

## Risk controls

{% hint style="danger" %}
**`cancelAll()` is your emergency stop.** It is deliberately exempt from rate limiting. Wire it to every exit path — `SIGINT`, `SIGTERM`, `unhandledRejection`, `uncaughtException`, and your own kill-switch.
{% endhint %}

* [ ] **Cancel on shutdown**, then `client.destroy()`, then exit.
* [ ] **Cap position size** per market and refuse to add beyond it.
* [ ] **Cap order value** per placement, so a units bug can't submit 100× the intended size.
* [ ] **Add a staleness guard.** If no book update arrives for N seconds, pull your quotes — a quiet socket is not a quiet market.
* [ ] **Never assume a cancel worked.** A failed cancel means the order is still live. Re-list open orders before quoting against the assumption.
* [ ] **Handle `trade.failed`.** Rare, but a run of them means something upstream is unhealthy; back off rather than retrying into it.

## Correctness

* [ ] **Subtract `holdQuantity`.** Resting size is `quantity − filledQuantity − holdQuantity`. The two-term version overstates it during settlement.
* [ ] **Match positions by `tokenId`**, not `outcomeId`.
* [ ] **Resolve YES/NO via `getTokenIds()`**, never by array order or display name — on multi-outcome markets the displayed name can read the opposite way.
* [ ] **Align prices to the market's `tickSize`** before sending. Compute in integer ticks if you can; floats drift.
* [ ] **Treat decimal strings as strings.** Prices and quantities are exact on the wire. Parse at the edge, keep the string as your record.
* [ ] **Don't read placement responses as fills.** They are acknowledgements; fills arrive over the socket 15–20 seconds later.

## Throughput

* [ ] **Batch your requotes.** `placeBatch` (15 orders) counts as one order-write; `cancelBatch` (100 hashes) is exempt entirely.
* [ ] **Stream, don't poll.** One subscription replaces an entire polling loop, and read budget is finite.
* [ ] **Use `portfolio.balances()` in loops**, not `summary()` — the latter replays your whole trade ledger for P\&L you aren't reading.
* [ ] **Decide your 429 policy explicitly.** Either `retryOn429: true` or your own backoff. Not both, and not neither.

## Observability

* [ ] **Log every rejection with its `code`**, not just the message. Codes are stable; messages are not.
* [ ] **Register a WebSocket `error` handler.** Auth failures arrive as error frames, not thrown exceptions — without a handler your user events simply never arrive.
* [ ] **Track reconnects.** Frequent ones mean deltas are being missed and derived state should be rebuilt from `onSnapshot`.
* [ ] **Alert on a fill-less window.** If you're quoting and nothing has traded for an unusual length of time, something is wrong with your quotes or your connection.

## Operational

* [ ] **One process, one account.** Two processes sharing credentials will fight over the same open orders and the same rate-limit bucket.
* [ ] **Confirm availability in your jurisdiction.** Opening new positions is restricted in some regions — see [Restricted Regions](https://docs.strixlab.io/policies/restricted-regions).
* [ ] **Know the fee model.** Makers pay nothing; takers pay a category-based fee. A strategy that crosses the spread constantly is paying for it.
* [ ] **Pin the SDK version** and read the [changelog](/resources/changelog.md) before upgrading.

{% hint style="success" %}
**The single best habit:** make your bot able to flatten and stop from any state, and test that path deliberately. Everything else is optimisation.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dev.strixlab.io/guides/production-checklist.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
