python-okx-async


Namepython-okx-async JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://okx.com/docs-v5/
SummaryPython SDK with async support for the OKX v5 API
upload_time2023-08-24 20:11:46
maintainer
docs_urlNone
authorCircuitDAO
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # About
```python-okx-async``` is an unofficial Python wrapper for the [OKX exchange v5 API](https://www.okx.com/okx-api) that comes with async support.
The wrapper is an extension of the [```python-okx```](https://github.com/okxapi/python-okx) package, which supports synchronous REST requests and websocket streams.

# Installation
To install the package, run
```
pip install python-okx-async
```

# Quick start

### Create an OKX account
- If you don't already have an OKX account, register for one on https://www.okx.com/account/register

### Create API credentials
- Log into your OK account and select ```API keys``` in the user menu
- Click the ```+ Create V5 API key``` button
- Follow the instructions to create API credentials (key, passhprase, secret)

### Save API credentials
- If there isn't a ```.env``` file in your home directory, create one and make sure it can only be read and written to by you.
```
touch ~/.env
chmod 600 ~/.env
```
- Add the following lines to the ```.env``` file, replacing the text to the right of the equal signs with the credentials created above. Note that the credentials should NOT be enclosed in quotation marks.
```
OKX_API_KEY=<key>
OKX_API_PASSPHRASE=<passphrase>
OKX_API_SECRET=<secret>
```
API credentials are stored in a ```.env``` file for security reasons. It is not advisable to include API credentials directly in source code or to provide them as command line arguments.

### Run examples
Import and instantiate the API wrapper class ```AsyncTradeAPI```, which is used for order placement, as follows
```
import os
from dotenv import load_dotenv
from okx_async.AsyncTrade import AsyncTradeAPI

load_dotenv()

tradeAPI = AsyncTradeAPI(os.getenv("OKX_API_KEY"), os.getenv("OKX_API_SECRET"), os.getenv("OKX_API_PASSPHRASE"), flag="0", debug=False)
```
The other API classes can be instantiated similarly. Note that by default ```flag="1"```, which is the OKX demo environment, and ```debug=True```.

The ```example_order_book.py``` script included in the Github repository prints the order book for the XCH-USDT spot market to a depth of 20 levels.

Also make sure to check out the documentation of ```python-okx```, and the additional [examples](https://github.com/okxapi/python-okx/example) included in that repository.

            

Raw data

            {
    "_id": null,
    "home_page": "https://okx.com/docs-v5/",
    "name": "python-okx-async",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "CircuitDAO",
    "author_email": "info@circuitdao.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/46/61876c0000bdf21bb56378f6d18fb58c3822463cbaf6299bcd93bec3baad/python-okx-async-0.1.0.tar.gz",
    "platform": null,
    "description": "# About\n```python-okx-async``` is an unofficial Python wrapper for the [OKX exchange v5 API](https://www.okx.com/okx-api) that comes with async support.\nThe wrapper is an extension of the [```python-okx```](https://github.com/okxapi/python-okx) package, which supports synchronous REST requests and websocket streams.\n\n# Installation\nTo install the package, run\n```\npip install python-okx-async\n```\n\n# Quick start\n\n### Create an OKX account\n- If you don't already have an OKX account, register for one on https://www.okx.com/account/register\n\n### Create API credentials\n- Log into your OK account and select ```API keys``` in the user menu\n- Click the ```+ Create V5 API key``` button\n- Follow the instructions to create API credentials (key, passhprase, secret)\n\n### Save API credentials\n- If there isn't a ```.env``` file in your home directory, create one and make sure it can only be read and written to by you.\n```\ntouch ~/.env\nchmod 600 ~/.env\n```\n- Add the following lines to the ```.env``` file, replacing the text to the right of the equal signs with the credentials created above. Note that the credentials should NOT be enclosed in quotation marks.\n```\nOKX_API_KEY=<key>\nOKX_API_PASSPHRASE=<passphrase>\nOKX_API_SECRET=<secret>\n```\nAPI credentials are stored in a ```.env``` file for security reasons. It is not advisable to include API credentials directly in source code or to provide them as command line arguments.\n\n### Run examples\nImport and instantiate the API wrapper class ```AsyncTradeAPI```, which is used for order placement, as follows\n```\nimport os\nfrom dotenv import load_dotenv\nfrom okx_async.AsyncTrade import AsyncTradeAPI\n\nload_dotenv()\n\ntradeAPI = AsyncTradeAPI(os.getenv(\"OKX_API_KEY\"), os.getenv(\"OKX_API_SECRET\"), os.getenv(\"OKX_API_PASSPHRASE\"), flag=\"0\", debug=False)\n```\nThe other API classes can be instantiated similarly. Note that by default ```flag=\"1\"```, which is the OKX demo environment, and ```debug=True```.\n\nThe ```example_order_book.py``` script included in the Github repository prints the order book for the XCH-USDT spot market to a depth of 20 levels.\n\nAlso make sure to check out the documentation of ```python-okx```, and the additional [examples](https://github.com/okxapi/python-okx/example) included in that repository.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python SDK with async support for the OKX v5 API",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://okx.com/docs-v5/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc493e14f33aec8f05bdb2a69d16ad04251dbb938f7425d115fb2346396ea826",
                "md5": "aab2622467a4b7e5dca21b7847cd5702",
                "sha256": "d421b7783f2cc6fe020b352eedace84b153a7a8b33ee9200338e6bacb13fbd10"
            },
            "downloads": -1,
            "filename": "python_okx_async-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aab2622467a4b7e5dca21b7847cd5702",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 53442,
            "upload_time": "2023-08-24T20:11:44",
            "upload_time_iso_8601": "2023-08-24T20:11:44.547764Z",
            "url": "https://files.pythonhosted.org/packages/dc/49/3e14f33aec8f05bdb2a69d16ad04251dbb938f7425d115fb2346396ea826/python_okx_async-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb4661876c0000bdf21bb56378f6d18fb58c3822463cbaf6299bcd93bec3baad",
                "md5": "af96452f62ad49f1c94b3db2244f6437",
                "sha256": "d5eff85f04b54cd45524d3dfe6fdc20f10f35c382d86ea30dd7a526c4d4afd62"
            },
            "downloads": -1,
            "filename": "python-okx-async-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "af96452f62ad49f1c94b3db2244f6437",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 34076,
            "upload_time": "2023-08-24T20:11:46",
            "upload_time_iso_8601": "2023-08-24T20:11:46.172630Z",
            "url": "https://files.pythonhosted.org/packages/fb/46/61876c0000bdf21bb56378f6d18fb58c3822463cbaf6299bcd93bec3baad/python-okx-async-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-24 20:11:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-okx-async"
}
        
Elapsed time: 0.20147s