Changing the exchange in MagicTradeBot is a simple configuration update and does not require code changes, as long as the exchange is officially supported.
MagicTradeBot is thoroughly tested on its supported exchanges over long periods to ensure reliability, correct PnL calculation, and safe order execution.
Step 1: Stop the bot
Before making any changes, stop MagicTradeBot completely. Never change exchange settings while the bot is running.
Step 2: Update the exchange name in application.yaml
Open your application.yaml file and modify the Exchange.Name field:
Exchange:
Name: "binance" # binance | bybit | bitget | okx | hyperliquid
Use only lowercase values and ensure the name exactly matches one of the supported exchanges.
Step 3: Configure API credentials for the new exchange
Each exchange requires its own API credentials.
Recommended (Production-safe): Environment variables
Set the correct environment variables for the selected exchange:
Examples:
Binance
BINANCE_API_KEY=your_api_key BINANCE_API_SECRET=your_api_secretBybit
BYBIT_API_KEY=your_api_key BYBIT_API_SECRET=your_api_secretOKX
OKX_API_KEY=your_api_key OKX_API_SECRET=your_api_secret OKX_PASSPHRASE=your_passphraseBitget
BITGET_API_KEY=your_api_key BITGET_API_SECRET=your_api_secret BITGET_PASSPHRASE=your_passphraseHyperliquid
HYPERLIQUID_PRIVATE_KEY=your_wallet_private_key
Environment variables automatically override values defined in application.yaml.
Step 4: Verify exchange position mode compatibility
Each exchange requires a specific position mode:
| Exchange | Required Mode |
|---|---|
| Bybit | One-Way Mode |
| Binance | Hedge Mode |
| OKX | Hedge Mode |
| Bitget | Hedge Mode |
| Hyperliquid | Wallet-based |
Misconfigured position modes can cause:
- Order rejection
- Incorrect trade direction
- Failed SL/TP placement
Always confirm your exchange account mode before starting the bot.
Step 5: Re-sync symbols (recommended)
When switching exchanges, it is recommended to re-sync symbols:
SyncSymbolsOnStartup: true
Run the bot once, wait for symbol synchronization to complete, then stop the bot and set:
SyncSymbolsOnStartup: false
This ensures:
- Correct symbol list
- Removal of delisted markets
- Proper leverage setup compatibility
Step 6: Start MagicTradeBot
After completing the steps above:
- Start the bot
- Watch startup logs
- Confirm the new exchange is loaded successfully
If the exchange is unsupported or misconfigured, the bot will exit with a clear error message.
What if my exchange is not supported?
MagicTradeBot officially supports:
- Binance
- Bybit
- Bitget
- OKX
- Hyperliquid
These exchanges are battle-tested over months and years.
For premium users, MagicTradeBot offers:
- Custom exchange integration
- Dedicated exchange adapter development
- Unified configuration without breaking existing functionality
Your exchange must support:
- Futures trading via API
- Position and leverage management
- Reliable order execution endpoints
Key takeaway
- โ Changing exchanges requires only config changes
- ๐ Always update API credentials for the new exchange
- โ ๏ธ Verify position mode compatibility
- ๐ Re-sync symbols for best results
- ๐ก๏ธ Bot exits safely if the exchange is unsupported