Skip to content

Binance

HaasOnline connects to Binance (spot), Binance USDT Futures and Binance COIN Futures. One Binance key covers all three if it has spot and futures trading enabled. Binance only allows trading on a key that is restricted to trusted IP addresses.

If you don't have a Binance account yet, sign up at Binance.

Obtaining the API Key

Log in to Binance. In the dashboard menu on the left, open Account and click API Management. Binance only lets you create a key after you have completed identity verification (KYC).

Binance dashboard menu with Account open and API Management.

Info

To trade Binance USDT Futures or Binance COIN Futures, open your Binance Futures account before you create the key. Binance can't add futures permission to a key created before the Futures account was opened.

Click Create API. (Create Tax Report API makes a read-only key for tax tools, which can't trade.)

Binance API Management page with the Create API, Create Tax Report API and Delete all API buttons.

Choose System generated and click Next. HaasOnline signs its requests with HMAC, which is what this key type uses; a Self-generated (Ed25519 or RSA) key does not work with HaasOnline.

Binance Choose API Key type dialog with System generated selected.

Name and verify

Enter a label that identifies the key (for example HaasOnline API) and click Next.

Binance Create API dialog with the label HaasOnline API.

Complete the security verification Binance asks for, such as the code from your authenticator app.

Binance Authenticator App Verification step.

Copy the keys and set the restrictions

Binance opens the new key's page, with its restrictions ready to edit:

  • API Key: goes in the HaasOnline Public key field.
  • Secret Key: goes in the HaasOnline Private key field.

Danger

Copy the API Key and Secret Key now. Binance doesn't show them in full again after you leave this page. If you lose the secret, delete the key and create a new one.

On the same page:

  • Under API restrictions, tick Enable Spot & Margin & Stock Trading for Binance spot, and Enable Futures for Binance USDT Futures or Binance COIN Futures (Enable Reading is always on). Leave everything else unticked, including Enable Withdrawals.
  • Under IP access restrictions, choose Restrict access to trusted IPs only (Recommended), add the IP addresses shown in HaasOnline (or your server's IP on a self-hosted license, see below) separated by spaces, and click Confirm.

Binance key page with the API Key and Secret Key, Enable Reading, Enable Spot & Margin & Stock Trading and Enable Futures ticked, Enable Withdrawals unticked, and Restrict access to trusted IPs only with trusted IP addresses.

Click Save at the top right and complete the verification (authenticator app and email).

Binance Security Verification Requirements with Authenticator App and Email.

Danger

Do not enable withdrawals or transfers. HaasOnline never needs them to trade for you, and a trading-only key limits what a leaked key could do.

Info

For the IP restriction:

  • On HaasOnline TradeServer Cloud, paste the addresses shown under IP addresses to whitelist in the HaasOnline account setup form (use its copy icon).
  • On a self-hosted TradeServer license, use the public IP address of your machine or server.

Binance deletes a key that has any permission other than reading enabled while it is unrestricted, so the IP restriction is required.

Adding the API to HaasOnline TradeServer Cloud

Log in to HaasOnline TradeServer Cloud and open Exchange Accounts from the user menu in the top right. The Adding an API to the Platform guide shows these first steps with screenshots.

  1. Click the + button at the bottom of the accounts list (on an empty page it reads Add account)
  2. Select Exchange account
  3. In Connect an exchange account, click Binance
  4. Under What should this account trade?, choose Binance for spot trading, or Binance COIN Futures or Binance USDT Futures under Derivatives, then click Continue with .... Each market is its own HaasOnline account, so repeat these steps with the same key to add another market. (Binance.US has its own guide: Binance US.)

    What should this account trade, with Binance selected under Spot and Binance COIN Futures and Binance USDT Futures under Derivatives.

  5. Enter an Account name, then paste the values from Binance:

    • Public key → the Binance API Key
    • Private key → the Binance Secret Key

    Binance account setup form with the IP whitelist, account name, public key and private key fields.

    Info

    Check for spaces at the start and end of each value after you paste it. Stray spaces are a common cause of a failed key test.

  6. Click Test keys. When the test passes, click Save account

If the test fails, check that the key has Enable Spot & Margin & Stock Trading (spot) or Enable Futures (USDT or COIN Futures) ticked, and that the trusted IP addresses match the ones shown in HaasOnline. If it still fails, contact Support.