All notable changes to python-okx are documented in this file.
Packaging hygiene plus one additive ETH Staking endpoint. All changes are backward compatible — existing public signatures and happy-path behaviour are unchanged.
- Packaging split: dev/release-only tooling no longer leaks into end-user installs.
requirements.txtnow lists only the 5 runtime dependencies (httpx[http2],requests,websockets,certifi,loguru), sosetup.py'sparse_requirements()yields a runtime-onlyinstall_requires. The dev/test/release packages (python-dotenv,pytest,pytest-asyncio,pytest-cov,ruff,build,twine) moved to a newdev_requirements.txt(starts with-r requirements.txt).setup.pyis unchanged. Contributors should now runpip install -r dev_requirements.txt. Consumers who relied onpython-okxtransitively installingpytest/python-dotenvetc. must install those themselves.
okx/Finance/EthStaking.pyeth_cancel_redeem(ordId=''): new method forPOST /api/v5/finance/staking-defi/eth/cancel-redeem, bringing the ETH Staking module to full 7/7 endpoint coverage. Mirrorseth_purchase/eth_redeem.okx/consts.py: newSTACK_ETH_CANCEL_REDEEMpath constant.
Community issue batch (GH#141 / GH#116 / GH#115) plus the v5 API sync batch. All changes are additive / opt-in and backward compatible — existing public signatures and happy-path behaviour are unchanged. New optional kwargs default to "unset" (omitted from the request); new endpoints/modules are net-new symbols.
okx/Account.pyget_account_bills: added optionalbegin=''/end=''time-window parameters, mirroringget_account_bills_archive. Empty defaults produce the exact same request as before (GH#141).okx/websocket/WsPublicAsync.pyandokx/websocket/WsPrivateAsync.pystart(): now return the createdconsume()task so callers can retain/await it (GH#116).okx/Account.pyset_trading_config: new method forPOST /api/v5/account/set-trading-config(paramstype(required),stgyType(optional; 0=general, 1=delta neutral, applies when type=stgyType));precheck_set_delta_neutral: new method forGET /api/v5/account/precheck-set-delta-neutral(paramstgyType) (delta-neutral trading config).okx/Account.pyget_bill_type/apply_bills: new methods forGET /api/v5/account/subtypes(optionaltype) andPOST /api/v5/account/bills-history-archive(paramsyear,quarter, optionaltype) (bill subtypes + async bill history archive).okx/DualInvest.py(new module)DualInvestAPI: 8 methods for the/api/v5/finance/sfp/dcd/*dual-currency (DCD) product surface —get_currency_pairs,get_product_info,request_quote,trade,request_redeem_quote,redeem,get_order_state,get_order_history.okx/PublicData.pyget_announcements: new method forGET /api/v5/announcement/announcements.okx/consts.py: new path constants for all endpoints above, plus 8DUAL_INVEST_*constants.
okx/websocket/WsPublicAsync.pyandokx/websocket/WsPrivateAsync.pyconsume(): wrap the receive loop intry/except ConnectionClosedError— on disconnect it now logs the error, pushes an{"event": "error", "code": "ConnClosed", ...}message to the existing callback, and re-raises so the awaited task surfaces the failure instead of dying silently. No auto-reconnect (retry is left to the caller) (GH#116).
okx/Trade.pycancel_algo_order: renamed the positional argumentparams→orders_dataand added a docstring documenting the expectedlist[{'instId', 'algoId'}]. The legacyparams=keyword is kept as a deprecated alias, so all existing call shapes (positional andparams=) continue to work (GH#115).okx/Trade.pyplace_algo_order: added optionaladvanceOrdType=None(trigger-order advance type) andtpTriggerRatio=None/slTriggerRatio=None. Unset params are omitted from the request.okx/Account.pyget_fee_rates: added optionalgroupId=None(query fees by instrument group). Unset param is omitted.okx/Trade.pyplace_order: added optionalisElpTakerAccess=None(ELP taker access on IOC) andinstIdCode=None. Unset params are omitted.okx/Convert.pyget_currency_pair/estimate_quote/convert_trade: added optionalconvertMode=None(0=standard, 1=large-order VIP). Unset param is omitted.okx/Trade.pyamend_order: added optionalnewTpTriggerRatio=None/newSlTriggerRatio=None. Unset params are omitted.