Skip to main content

okx crypto exchange api client

Project description

okx-python

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

You can check Okx's docs here: Docs

You can check the SDK docs here: SDK

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_exchange 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_exchange 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_exchange 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.8.tar.gz (621.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.8-py3-none-any.whl (1.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: okx_exchange-0.0.8.tar.gz
  • Upload date:
  • Size: 621.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.8.tar.gz
Algorithm Hash digest
SHA256 1d3fa57a5444fc16768a1247aed0ee822fa067c07d1edbc3b440f2d8bd5d6376
MD5 c9ea882afe156c29fcf82372199f22c4
BLAKE2b-256 627c50cf7e1c10a27cea9b53a557554f1e15815210b1d5bd2c3a95eea6f42835

See more details on using hashes here.

File details

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

File metadata

  • Download URL: okx_exchange-0.0.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d10e5aad388585c592377ad1c8361f2e5f0ed5e168e82b87b30980a453ed216a
MD5 7b7e548db9d69273ee9e9c201da38c1e
BLAKE2b-256 83f1554272066a6822985ef8399c714694d5d648c385b52d0d4024c307707cb1

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