Skip to main content

okx crypto exchange api client

Project description

okx-python

Python SDK (sync and async) for Okx cryptocurrency exchange with Rest and WS capabilities.

You can check the SDK docs here: SDK You can check Okx's docs here: Docs

This package derives from CCXT and allows you to call pretty much every endpoint by either using the unified CCXT API or calling the endpoints directly

Installation

pip install okx-exchange

Usage

Sync

from okx import OkxSync

def main():
    instance = OkxSync({})
    ob =  instance.fetch_order_book("BTC/USDC")
    print(ob)
    #
    # balance = instance.fetch_balance()
    # order = instance.create_order("BTC/USDC", "limit", "buy", 1, 100000)

Async

import asyncio
from okx import OkxAsync

async def main():
    instance = OkxAsync({})
    ob =  await instance.fetch_order_book("BTC/USDC")
    print(ob)
    #
    # balance = await instance.fetch_balance()
    # order = await instance.create_order("BTC/USDC", "limit", "buy", 1, 100000)

asyncio.run(main())

Websockets

from okx import OkxWs

async def main():
    instance = OkxWs({})
    while True:
        ob = await instance.watch_order_book("BTC/USDC")
        print(ob)
        # orders = await instance.watch_orders("BTC/USDC")

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

okx_exchange-0.0.12.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

okx_exchange-0.0.12-py3-none-any.whl (1.6 kB view details)

Uploaded Python 3

File details

Details for the file okx_exchange-0.0.12.tar.gz.

File metadata

  • Download URL: okx_exchange-0.0.12.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for okx_exchange-0.0.12.tar.gz
Algorithm Hash digest
SHA256 62feff740cfe957f1c86f631f3ea12dd9c8690b69a63cab7c378cd12b8b4e1ae
MD5 aa6fc744f76051ac69b41806c719c65f
BLAKE2b-256 34f4a09b6b6456173b97ea5cc3d18d82d08d489f6756e7c79d318a6e3f06db86

See more details on using hashes here.

File details

Details for the file okx_exchange-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: okx_exchange-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 1.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for okx_exchange-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 7062a22a77cba6df86b64d64398e96a5c039f36b3dfc55f1383065876dd0ecbb
MD5 715319acfffdebcb6e7671ede3e747dd
BLAKE2b-256 3e02ecbf23ff4c208fe2f4008f0af6f9da7c8a6000b19fe37f026671f727d271

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page