Exchange API IP whitelist
Lock exchange API keys to one stable exit: per-GB static IP with “Opens crypto exchanges” ticked, Lock this line, then whitelist it on Kraken, OKX or Binance.
Updated
curl -x http://USER:PASS@HOST:PORT https://ipinfo.io/json
A half-configured proxy is the most common reason a trading bot hits API whitelist errors.
The ccxt manual says httpProxy and httpsProxy only affect non-WebSocket requests; WebSocket connections need wsProxy or wssProxy as well. With only httpsProxy set, orders go through the proxy while market-data streams leave from your own IP.
Freqtrade is the same: its HTTP_PROXY and HTTPS_PROXY variables apply to Telegram, CoinGecko and the rest, but not to exchange requests. Those take the proxy from ccxt_config in the config file.
When the API key is bound to an IP whitelist, any request that leaves from another IP is rejected.
In My proxies, find the per-GB static line generated with “Opens crypto exchanges” ticked, click Lock this line, then copy host, port, username and password into http://USERNAME:PASSWORD@HOST:PORT. For SOCKS5 use socks5://.
Set httpsProxy and wsProxy on the exchange object; see the ccxt example below.
Add ccxt_config under exchange in your config file; see the Freqtrade example below.
On the same machine, open ipinfo.io through the proxy; the exit IP should be the one in your API whitelist.
import ccxt
ex = ccxt.kraken({"apiKey": "...", "secret": "..."})
proxy = "http://USERNAME:PASSWORD@HOST:PORT"
ex.httpsProxy = proxy # REST
ex.wsProxy = proxy # WebSocket (ccxt.pro)
print(ex.fetch_balance())REST and WebSocket use the same proxy; replace USERNAME, PASSWORD, HOST and PORT with the values in My proxies.
{
"exchange": {
"name": "kraken",
"ccxt_config": {
"httpsProxy": "http://USERNAME:PASSWORD@HOST:PORT",
"wsProxy": "http://USERNAME:PASSWORD@HOST:PORT"
}
}
}Exchange requests take the proxy from ccxt_config; environment variables do not reach them.
In ccxt set socksProxy and wsSocksProxy to socks5://USERNAME:PASSWORD@HOST:PORT.
Check that both REST and WebSocket use the proxy, then open ipinfo.io through it and compare the exit IP with the whitelist. If the line was swapped, update the whitelist.
Technically yes, but whitelists and troubleshooting get mixed up. Usually give each strategy or server its own line and whitelist each one.
Setup guides Proxy302 publishes on GitHub on the same topic:
Official documentation · Confirmed on:
ccxt exchange properties httpProxy/httpsProxy apply to non-WebSocket requests only; WebSocket connections need wsProxy or wssProxy as well; SOCKS uses socksProxy and wsSocksProxy.
Official documentation · Confirmed on:
HTTP_PROXY/HTTPS_PROXY environment variables apply to everything except exchange requests; exchange requests take the proxy from exchange.ccxt_config (httpsProxy, wsProxy).
Product observation · Confirmed on:
Static lines are HTTP or SOCKS5 as chosen at generation; My proxies shows host, port, username and password with copy buttons; Lock this line stops automatic swaps.
Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.