Skip to content

OKX

Support Hummingbot

Hummingbot Foundation has a fee share partnership with OKX. When you use our software to trade on OKX, a custom API header tells OKX that the trade was executed using Hummingbot, so they share a portion of your fees with us, at no cost to you. To support us, create an account using our OKX referral link and enter that account's API keys into Hummingbot! Thanks for your support! 🙏

🛠 Connector Info

  • Exchange Type: Centralized Exchange (CEX)
  • Market Type: Central Limit Order Book (CLOB)
Component Status Connector Version V2 Strategies Notes
🔀 Spot Connector ✅ v2.1 Yes
🔀 Perp Connector ✅ v2.1 Yes
đŸ•¯ Spot Candles Feed Not built
đŸ•¯ Perp Candles Feed ✅

ℹī¸ Exchange Info

🔑 How to Connect

Generate API Keys

  1. Log into your OKX account and click the user icon
  2. Select API from the dropdown menu
  3. Choose the account you want to create API Keys for
  4. Click Create API Keys

Add Keys to Hummingbot

From inside the Hummingbot client, run connect okx:

>>> connect okx

Enter your okx API key >>>
Enter your okx secret key >>>
Enter your okx passphrase >>>

If connection is successful:

You are now connected to okx.

🔀 Spot Connector

Integration to spot markets API endpoints

Order Types

This connector supports the following OrderType constants:

  • LIMIT
  • LIMIT_MAKER

Paper Trading

Access the Paper Trade version of this connector by running connect okx_paper_trade instead of connect okx.

If this is not available by default, you can configure Hummingbot to add this paper trade exchange. See Adding Exchanges for more information.

🔀 Perp Connector

Integration to perpetual markets API endpoints

Order Types

This connector supports the following OrderType constants:

  • LIMIT
  • MARKET

Usage

  • Before connecting, be sure to switch to Single-currency margin mode in your OKX account settings. Here is a screenshot from the OKX website default:

Account mode

  • As position mode (one-way or hedge) is set every time Hummingbot starts, if you want to restart hummingbot you need to check if there are any open positions. If so, you'll need to close them before.