python-okx


Namepython-okx JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://okx.com/docs-v5/
SummaryPython SDK for OKX
upload_time2025-07-28 03:20:55
maintainerNone
docs_urlNone
authorokxv5api
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ### Overview
This is an unofficial Python wrapper for the [OKX exchange v5 API](https://www.okx.com/okx-api)

If you came here looking to purchase cryptocurrencies from the OKX exchange, please go [here](https://www.okx.com/).

#### Source code
https://github.com/okxapi/python-okx
#### API trading tutorials
- Spot trading: https://www.okx.com/help/how-can-i-do-spot-trading-with-the-jupyter-notebook
- Derivative trading: https://www.okx.com/help/how-can-i-do-derivatives-trading-with-the-jupyter-notebook

Make sure you update often and check the [Changelog](https://www.okx.com/docs-v5/log_en/) for new features and bug fixes.

### Features
- Implementation of all Rest API endpoints.
- Private and Public Websocket implementation
- Testnet support 
- Websocket handling with reconnection and multiplexed connections

### Quick start
#### Prerequisites

`python version:>=3.9`

`WebSocketAPI: websockets package advise version 6.0`

#### Step 1: register an account on OKX and apply for an API key
- Register for an account: https://www.okx.com/account/register
- Apply for an API key: https://www.okx.com/account/users/myApi

#### Step 2: install python-okx

```python
pip install python-okx
```

#### Step 3: Run examples

- Fill in API credentials in the corresponding examples
```python 
api_key = ""
secret_key = ""
passphrase = ""
```
- RestAPI
  - For spot trading: run example/get_started_en.ipynb
  - For derivative trading: run example/trade_derivatives_en.ipynb
  - Tweak the value of the parameter `flag` (live trading: 0, demo trading: 1
) to switch between live and demo trading environment
- WebSocketAPI
  - Run test/WsPrivateTest.py for private websocket channels
  - Run test/WsPublicTest.py for public websocket channels
  - Use different URLs for different environment
      - Live trading URLs: https://www.okx.com/docs-v5/en/#overview-production-trading-services
      - Demo trading URLs: https://www.okx.com/docs-v5/en/#overview-demo-trading-services

Note 

- To learn more about OKX API, visit official [OKX API documentation](https://www.okx.com/docs-v5/en/)

- If you face any questions when using `WebSocketAPI`,you can consult the following links

  - `asyncio`、`websockets` document/`github`:

    ```python 
    https://docs.python.org/3/library/asyncio-dev.html
    https://websockets.readthedocs.io/en/stable/intro.html
    https://github.com/aaugustin/websockets
    ```

  - About `code=1006`:

    ```python 
    https://github.com/Rapptz/discord.py/issues/1996
    https://github.com/aaugustin/websockets/issues/587
    ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://okx.com/docs-v5/",
    "name": "python-okx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "okxv5api",
    "author_email": "api@okg.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/07/07320f86d8c66bbbfc940cb4de1caf8699a211e8839e14b3b970a4132496/python_okx-0.4.0.tar.gz",
    "platform": null,
    "description": "### Overview\nThis is an unofficial Python wrapper for the [OKX exchange v5 API](https://www.okx.com/okx-api)\n\nIf you came here looking to purchase cryptocurrencies from the OKX exchange, please go [here](https://www.okx.com/).\n\n#### Source code\nhttps://github.com/okxapi/python-okx\n#### API trading tutorials\n- Spot trading: https://www.okx.com/help/how-can-i-do-spot-trading-with-the-jupyter-notebook\n- Derivative trading: https://www.okx.com/help/how-can-i-do-derivatives-trading-with-the-jupyter-notebook\n\nMake sure you update often and check the [Changelog](https://www.okx.com/docs-v5/log_en/) for new features and bug fixes.\n\n### Features\n- Implementation of all Rest API endpoints.\n- Private and Public Websocket implementation\n- Testnet support \n- Websocket handling with reconnection and multiplexed connections\n\n### Quick start\n#### Prerequisites\n\n`python version\uff1a>=3.9`\n\n`WebSocketAPI\uff1a websockets package advise version 6.0`\n\n#### Step 1: register an account on OKX and apply for an API key\n- Register for an account: https://www.okx.com/account/register\n- Apply for an API key: https://www.okx.com/account/users/myApi\n\n#### Step 2: install python-okx\n\n```python\npip install python-okx\n```\n\n#### Step 3: Run examples\n\n- Fill in API credentials in the corresponding examples\n```python \napi_key = \"\"\nsecret_key = \"\"\npassphrase = \"\"\n```\n- RestAPI\n  - For spot trading: run example/get_started_en.ipynb\n  - For derivative trading: run example/trade_derivatives_en.ipynb\n  - Tweak the value of the parameter `flag` (live trading: 0, demo trading: 1\n) to switch between live and demo trading environment\n- WebSocketAPI\n  - Run test/WsPrivateTest.py for private websocket channels\n  - Run test/WsPublicTest.py for public websocket channels\n  - Use different URLs for different environment\n      - Live trading URLs: https://www.okx.com/docs-v5/en/#overview-production-trading-services\n      - Demo trading URLs: https://www.okx.com/docs-v5/en/#overview-demo-trading-services\n\nNote \n\n- To learn more about OKX API, visit official [OKX API documentation](https://www.okx.com/docs-v5/en/)\n\n- If you face any questions when using `WebSocketAPI`,you can consult the following links\n\n  - `asyncio`\u3001`websockets` document/`github`\uff1a\n\n    ```python \n    https://docs.python.org/3/library/asyncio-dev.html\n    https://websockets.readthedocs.io/en/stable/intro.html\n    https://github.com/aaugustin/websockets\n    ```\n\n  - About `code=1006`\uff1a\n\n    ```python \n    https://github.com/Rapptz/discord.py/issues/1996\n    https://github.com/aaugustin/websockets/issues/587\n    ```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python SDK for OKX",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://okx.com/docs-v5/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3935bb5f1cea2d3432cac1fe448f1b80d5f42712cc2ac7221449ec168af86a7f",
                "md5": "3f5d15595cb70e06e300470055e42656",
                "sha256": "20e2df6a1ed1ea0d995eb31307ca8d76749b7b880db88f1252e98ad16242e5f2"
            },
            "downloads": -1,
            "filename": "python_okx-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f5d15595cb70e06e300470055e42656",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 33189,
            "upload_time": "2025-07-28T03:20:54",
            "upload_time_iso_8601": "2025-07-28T03:20:54.009205Z",
            "url": "https://files.pythonhosted.org/packages/39/35/bb5f1cea2d3432cac1fe448f1b80d5f42712cc2ac7221449ec168af86a7f/python_okx-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d10707320f86d8c66bbbfc940cb4de1caf8699a211e8839e14b3b970a4132496",
                "md5": "4e88231f890d5b790ee9a7a33e00ea47",
                "sha256": "c2a878dc2c2c3badac61dbb3f980b386dd89932a4b5d11e82fe1cce6619c92c2"
            },
            "downloads": -1,
            "filename": "python_okx-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4e88231f890d5b790ee9a7a33e00ea47",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 23474,
            "upload_time": "2025-07-28T03:20:55",
            "upload_time_iso_8601": "2025-07-28T03:20:55.315319Z",
            "url": "https://files.pythonhosted.org/packages/d1/07/07320f86d8c66bbbfc940cb4de1caf8699a211e8839e14b3b970a4132496/python_okx-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 03:20:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-okx"
}
        
Elapsed time: 1.72822s