Repository navigation
Releases
bytx 0.2.7
New
ex.assert_demo(): raisesConfigErrorunless REST requests of the instance really go to the exchange demo/testnet. It checks the transport, not thedemoflag: no REST address of the instance may equal a production address of the exchange, and on OKX and Bitget, where the demo uses the production host, the demo header (x-simulated-trading: 1,paptrading: 1) must be set. No network. Market WS streams are not checked (some demos use production ones).
Docs
ex.ccxtis an escape hatch, not the recommended path. Exchange id → symbol:ex.symbol('BTCUSDT'); symbol → id:(await ex.market(symbol)).id; demo check:ex.assert_demo().
bytx 0.2.6
Fixes
- OKX: WebSocket orders.
ws_place_order,ws_amend_orderandws_cancel_ordernow send the marketinstIdCode. Before this fix OKX rejected all three with50014 Parameter instIdCode can not be empty. A market without a code goes via REST. - Cancel over WebSocket. A rejected WS cancel (other than "no such order") is now retried via REST. Cancel is idempotent, so the order no longer stays on the book.
New
candles(symbol, tf, since=, until=, limit=): page history backwards withuntil(ms, inclusive).funding_intervals(symbols=None) -> {symbol: hours}, andFundingRate.interval_hours.OrderTracker.track(order): show a just-sent order in the tracker before its WS event.
Docs
- OKX and Bitget perpetuals need
margin_modeincreate_exchange.
bytx 0.2.6b1
Fixes
- OKX: WebSocket orders.
ws_place_order,ws_amend_orderandws_cancel_ordernow send the marketinstIdCode. Before this fix OKX rejected all three with50014 Parameter instIdCode can not be empty. A market without a code goes via REST. - Cancel over WebSocket. A rejected WS cancel (other than "no such order") is now retried via REST. Cancel is idempotent, so the order no longer stays on the book.
New
candles(symbol, tf, since=, until=, limit=): page history backwards withuntil(ms, inclusive).funding_intervals(symbols=None) -> {symbol: hours}, andFundingRate.interval_hours.OrderTracker.track(order): show a just-sent order in the tracker before its WS event.
Docs
- OKX and Bitget perpetuals need
margin_modeincreate_exchange.
bytx 0.2.5
bytx 0.2.5
BingX: a rate limit without an unblock moment no longer pauses for 60 s. BingX codes 100410 / 109429 that come without the unblock moment in the text («Please try again later», «rate limited») are a rate limit, not a ban window: the pause is now 2 s (BINGX_SOFT_PAUSE) instead of 60 s. Before, such a response could hold order requests for a minute — the first stop-loss of a position was placed after ~66 s. A real ban still comes with its unblock moment and is held until then.
BingX: no «Task exception was never retrieved» on shutdown. The background balance subscription that watch_positions starts now has its error retrieved, so a connection closed on shutdown no longer prints the asyncio warning.
Package metadata: more keywords (mcp, ai-agents, bingx, bitget, kucoin, perpetual-futures, async, sdk), classifiers and a Changelog link.
bytx 0.2.4
bytx 0.2.4
BingX: the configured margin_mode is now applied to the symbol. On BingX the margin mode is a per-symbol exchange setting (isolated by default) and is not part of the order, so a client created with margin_mode='cross' could still open isolated positions. An opening order now reads the symbol's margin mode once per symbol (Query Margin Type) and switches it if it differs (Change Margin Type). If the exchange refuses the switch (a position or an order is open on the symbol, code 104103), the order is not sent and ConfigError is raised. Closing orders are not checked; paper exchanges are not affected. bytx.testing emulates both requests.
bytx 0.2.3
- BingX: error
109429("Too many invalid requests in a short period; temporarily restricted") is now raised as
RateLimited(ccxt.RateLimitExceeded) instead of a bareExchangeError, withretry_aftertaken from the
"can retry after time" stamp in the response (60 s when the stamp is missing). - The limiter pauses only that method of that account until the restriction ends; other accounts on the same IP are
not paused. No automatic retries are made during the restriction.
bytx 0.2.2
- TP/SL that stay after the position is closed: new
bytx.exchanges.tp_sl_cancel_on_flat(ccxt_id)says whether the
exchange cancels the remaining TP/SL itself once the position is flat. Binance does not (demo 2026-11-18: both legs
stay afterclose_position, the SL stays after the TP fires); Bybit, OKX, BingX, Bitget, BloFin, Gate and
Hyperliquid do; KuCoin, MEXC, HTX — unknown. open_positionwith SL and TP adds a warning towarningson those exchanges: cancel the other leg withflatten,
cancel_tp_slorrecover(). Orders are unchanged.- Docs:
close_positiondoes not cancel TP/SL (useflatten); paper cancels them on close, gentler than Binance.
bytx 0.2.1
- Bybit:
remainingof a canceled/rejected/expired order is nowamount − filled(ccxt returned 0 fromleavesQty, so a partially filled canceled order looked fully filled). No API changes.
bytx 0.2.0
- Rollup maintenance release. No breaking API changes.
bytx 0.1.11
- BloFin spot
- my_trades: filters order_id, client_id_prefix, until; whole time windows
- classify_close, funding_paid helpers
- Hyperliquid: order lookup fixes (canceled orders)