For the complete documentation index, see llms.txt. This page is also available as Markdown.
Setup & Helpers
Python environment setup and shared helpers for the futures examples.
Use this page before running any futures script in this section.
Requirements
Use Python 3.10+.
Install the required packages first.
install.sh
pipinstallrequestswebsockets
Replace the placeholder API key and secret in every script before running it. The scripts place real orders: start with small amounts.
What the Helpers Cover
FuturesClient — signed REST requests to https://futures-trading-service.outpoll.com. The signature covers timestamp + METHOD + path + body; the query string is never signed.
Numbers are read as Decimal and sent as strings ("0.017"), so prices and sizes stay exact. Never use floats for prices, sizes or money.
Errors raise FuturesApiError; code is the stable FUT-NNNN code from the error body.
get_pairs() — the public pair catalogue by symbol: pair ID gid, tick size ts, lot size ls, leverage range, status.
floor_to_step() / round_price() — fit a size to the lot size and a price to the tick size. Request numbers accept at most 8 decimal places.
connect_private() — opens /ws/account or /ws/margin-call and sends the signed AUTH frame. See Futures Account → Authentication.
mark_price() / best_quote() — current mark price and best bid/ask of one pair from the public market data streams.
Save the file as futures_helpers.py next to the scripts.
Every REST call and every AUTH counts against your API key's rate limits. Exceeding them repeatedly blocks the key permanently. Load state once over REST and follow the streams instead of polling.