npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

okx-trader-cli

v1.0.3

Published

OKX exchange REST API CLI — spot, futures, options, grid trading. 220+ endpoints. For AI assistants: Claude, Cursor, OpenCode.

Downloads

298

Readme

okx-trader-cli

OKX V5 REST API CLI — 220+ endpoints in one command.

npm install -g okx-trader-cli

Quick Start

# No API key needed for market data
okx system status
okx market ticker --instId BTC-USDT
okx market candles --instId ETH-USDT --bar 4H --limit 10

# Configure credentials for private endpoints
export OKX_API_KEY="your-key"
export OKX_SECRET_KEY="your-secret"
export OKX_PASSPHRASE="your-passphrase"

# Or create .env in your project
okx account balance
okx trade order --instId BTC-USDT --tdMode cash --side buy --ordType market --sz 100 --tgtCcy quote_ccy

Command Format

okx <module> <command> [options]

Option names match the OKX V5 API exactly — no mapping needed. See OKX V5 API docs for full parameter reference.

Modules & Commands

account — Trading account (auth required)

| Command | Description | |---------|-------------| | balance | Get account balance | | positions | Get positions | | positions-history | Get historical positions | | position-risk | Get account position risk | | bills | Get bills (7 days) | | bills-archive | Get bills (3 months) | | config | Get account configuration | | set-position-mode | Set position mode (long/short or net) | | set-leverage | Set leverage | | max-size | Get maximum order size | | max-avail-size | Get max available tradable amount | | adjust-margin | Increase/decrease isolated margin | | leverage-info | Get leverage info | | trade-fee | Get fee rates | | max-withdrawal | Get max withdrawal amount | | risk-state | Get account risk state | | instruments | Get instruments for trading account |

trade — Orders (auth required)

| Command | Description | |---------|-------------| | order | Place an order | | batch-orders | Place multiple orders | | cancel-order | Cancel an order | | cancel-batch-orders | Cancel multiple orders | | amend-order | Amend an order | | amend-batch-orders | Amend multiple orders | | close-position | Close position | | get-order | Get order details | | orders-pending | Get pending orders | | orders-history | Get order history (7 days) | | orders-history-archive | Get order history (3 months) | | fills | Get transaction details | | fills-history | Get transaction history | | mass-cancel | Mass cancel orders | | order-algo | Place algo order (TP/SL, trigger, trailing stop, TWAP) | | cancel-algos | Cancel algo orders | | amend-algos | Amend algo orders | | get-algo-order | Get algo order details | | algo-orders-pending | Get pending algo orders | | algo-orders-history | Get algo order history |

market — Market data (no auth)

| Command | Description | |---------|-------------| | tickers | Get tickers for all instruments | | ticker | Get ticker for one instrument | | books | Get order book | | books-full | Get full order book | | candles | Get candlestick data | | history-candles | Get historical candlesticks | | trades | Get recent trades | | history-trades | Get historical trades | | index-tickers | Get index tickers | | index-candles | Get index candlesticks | | mark-price-candles | Get mark price candlesticks | | exchange-rate | Get fiat exchange rate |

public — Reference data (no auth)

| Command | Description | |---------|-------------| | instruments | Get instruments | | open-interest | Get open interest | | funding-rate | Get funding rate | | funding-rate-history | Get funding rate history | | price-limit | Get price limit | | time | Get system time | | mark-price | Get mark price | | position-tiers | Get position tiers | | underlying | Get underlying |

asset — Funding account (auth required)

| Command | Description | |---------|-------------| | currencies | Get currency list | | balances | Get funding balance | | asset-valuation | Get asset valuation | | transfer | Transfer between accounts | | transfer-state | Get transfer state | | bills | Get funding bills | | deposit-address | Get deposit address | | deposit-history | Get deposit history | | withdrawal | Withdraw | | cancel-withdrawal | Cancel withdrawal | | withdrawal-history | Get withdrawal history | | convert-estimate-quote | Estimate convert (flash swap) quote | | convert-trade | Execute convert trade |

trading-bot — Grid / Signal / DCA (auth required)

| Submodule | Commands | |-----------|----------| | grid | order-algo, amend-basic, stop, orders-pending, orders-history, ai-param, positions, withdraw-income | | signal | create, list, order-algo, stop, orders-pending, orders-history, positions | | recurring | order-algo, amend, stop, orders-pending, orders-history |

Example: okx trading-bot grid order-algo, okx trading-bot recurring order-algo

copy-trading (auth required)

| Command | Description | |---------|-------------| | current-subpositions | Get current lead trader subpositions | | algo-order | Place copy trading algo order | | close-subposition | Close subposition | | instruments | Get copy instruments | | config | Get copy config | | stop | Stop copy trading | | public-lead-traders | Get public lead traders | | public-stats | Get public stats |

rubik — Analytics (no auth)

| Command | Description | |---------|-------------| | support-coin | Get supported coins | | open-interest-history | Get OI history | | taker-volume | Get taker volume (spot) | | taker-volume-contract | Get taker volume (contract) | | margin-loan-ratio | Get margin lending ratio | | long-short-account-ratio | Get long/short account ratio | | long-short-account-ratio-top | Get top trader long/short ratio | | open-interest-volume | Get OI and volume |

rfq — Block trading (auth required)

| Command | Description | |---------|-------------| | counterparties | Get counterparties | | create-rfq | Create RFQ | | cancel-rfq | Cancel RFQ | | execute-quote | Execute quote | | create-quote | Create quote | | cancel-quote | Cancel quote | | rfqs | Get RFQ list | | quotes | Get quote list | | trades | Get RFQ trades |

spread — Spread trading (auth required)

| Command | Description | |---------|-------------| | order | Place spread order | | cancel-order | Cancel spread order | | amend-order | Amend spread order | | get-order | Get spread order | | orders-pending | Get pending spread orders | | orders-history | Get spread order history | | trades | Get spread trades | | spreads | Get spread instruments | | books | Get spread order book |

finance — Staking / Savings / Loans (auth required)

| Submodule | Commands | |-----------|----------| | staking | offers, purchase, redeem, orders-active, orders-history | | eth-staking | product-info, purchase, redeem, balance, history | | savings | balance, purchase-redempt, set-lending-rate, lending-history | | flexible-loan | borrow-currencies, collateral-assets, max-loan, adjust-collateral, loan-info |

Example: okx finance staking offers, okx finance savings balance

subaccount (auth required)

| Command | Description | |---------|-------------| | list | Get sub-account list | | create | Create sub-account | | create-apikey | Create sub-account API key | | get-apikey | Get sub-account API key | | modify-apikey | Modify API key | | delete-apikey | Delete API key | | transfer | Transfer between sub-accounts | | trading-balance | Get sub-account trading balance | | funding-balance | Get sub-account funding balance |

system — Status (no auth)

| Command | Description | |---------|-------------| | status | Get system status | | announcements | Get announcements |


For full parameter reference, run okx <module> --help or okx <module> <command> --help, or see OKX V5 API docs.

Configuration

  • Environment variables: OKX_API_KEY, OKX_SECRET_KEY, OKX_PASSPHRASE
  • .env file: Loaded automatically from project root or ~/.okx/.env
  • Simulated trading: Add --simulated or set OKX_SIMULATED=1

Global Options

| Option | Description | |--------|-------------| | --apiKey | API Key | | --secretKey | Secret Key | | --passphrase | Passphrase | | --baseUrl | Base URL (default: https://www.okx.com) | | --simulated | Use simulated trading |

AI Assistants

This CLI is designed for use with AI coding assistants. For the full skill collection (SKILL.md files, Claude Code plugin, Cursor, OpenCode, etc.), clone the okx-plugin repo.

Links

License

Apache-2.0