Phemex¶
Obtaining the API Key¶
Danger
WARNING: Do NOT use the same API key that you have created for other services.
If you don't have a Phemex account yet, sign up at Phemex.
To get the API keys for your Phemex account, click the profile icon at the top right of the Phemex main page, then select API Management from the menu.

On the API Management page, click Create new API key.

Choose Default API entry and click Next.

Warning
Don't choose High rate limit unless Phemex has given your account VIP API access. Those keys only work through Phemex's VIP endpoint (vapi.phemex.com), which also needs your IP address approved by Phemex ([email protected]). Without that, the key test fails. If you do have VIP access, tick Use Phemex VIP High-Speed API in the HaasOnline account setup form.
Enter a name, choose Bind IP, paste the IP addresses and set the permission to Read & Trade, as below. Then click Confirm.
Info
For IP Address Bind IP configuration:
- On HaasOnline TradeServer Cloud, paste the addresses shown under IP addresses to whitelist in the HaasOnline account setup form.
- On a self-hosted TradeServer license, use the public IP address of your machine or server.

The red note in this screenshot is out of date: on a self-hosted TradeServer, use your server's public IP address, not a private one.
Complete the Safety Verification with your Google Authenticator code.

Phemex then shows the new key's ID and API Secret:

Keep the pop-up open and move on to the next step.
Adding the API to HaasOnline TradeServer¶
Log in to TradeServer.
Click on the user menu icon in the top right and select Exchange Accounts

Click the + button at the bottom of the accounts list (on an empty page it reads Add account).

Select Exchange account.

In Connect an exchange account, click Phemex (or type it in the search box).

Choose what this account should trade: a Spot market, or a Derivatives market. Each market is its own exchange account, so repeat these steps to add another one with the same API key, if you enabled it for that market. Click the Continue with … button, which names the market you picked.

Enter an Account name.
From the Phemex API Management page earlier, click on Copy under API Key and paste it in the TradeServer window under ID. Repeat the same for API Secret but paste it under API Secret.

Info
Check for spaces at the start and end of each key after you paste it. Stray spaces are a common cause of a failed key test.
Click Test keys. When the test passes, click Save account to add the account to the platform.