Skip to main content

How Can I Migrate USDT Trading Pairs Without Losing Order History in Gunbot?

ยท 4 min read

As the MiCA regulations come into effect in Europe, many traders using USDT may need to change to different trading pairs using a substitute stablecoin like USDC. Gunbot's flexibility makes it an ideal trading bot to manage such changes, allowing you to transition seamlessly to compliant stablecoins like USDC while preserving your order history.

Step-by-Step Guide (using a script for file changes)โ€‹

  1. Stop the Bot and Create a Backup

    • Halt trading in Gunbot and stop the process.
    • Duplicate your Gunbot folder for backup purposes.
  2. Run the Script Place the unpacked script in the duplicated folder. Depending on your operating system, follow these steps to run it:

    For Linux:โ€‹

    ./mica2025-linux USDC

    For macOS:โ€‹

    ./mica2025-macos USDC

    For Windows:โ€‹

    • Create a new .bat file (for example, run_migration.bat).
    • Add the following line to the file:
      start mica2025-win.exe USDC
    • Double-click the .bat file to execute the script.

    You can replace USDC with the stablecoin of your choice (e.g., DAI or BUSD).

  3. Resulting Files

    • The script will create a /json_copy folder containing the migrated state files.
    • It will also generate a config_copy.js file with the updated pairs.
  4. Final Step

    • If satisfied with the migration, rename /json_copy to /json and config_copy.js to config.js for production use.
    • The original /json folder and config.js remain untouched as a backup.

Step-by-Step Guide (Manual)โ€‹

1. Stop Gunbot Gracefullyโ€‹

  • Halt trading via Gunbot's interface.
  • Fully exit the Gunbot process.

2. Create a Backupโ€‹

  • Duplicate your Gunbot folder.
  • Label the original folder as a backup, and work in the copy for all modifications.

3. Clean Up Files in the Copied Folderโ€‹

  • Go to the json folder.
  • Delete all files and subfolders except the state files for the pairs you are trading (e.g., binance-USDT-BTC-state.json).
  • Also remove the backup folder inside the json folder.
  • Delete state.db, state.db-wal, and state.db-shm files.

4. Rename State Filesโ€‹

  • Rename each relevant state file in the json folder to reflect the new base currency, e.g., binance-USDT-BTC-state.json becomes binance-USDC-BTC-state.json.

5. Edit Pair Names in State Filesโ€‹

  • Open each renamed state file with a text editor.
  • Replace all instances of the old pair name (e.g., USDT-BTC) with the new pair name (e.g., USDC-BTC).

6. Modify Pair Names in Configurationโ€‹

  • Open the config.js file with a text editor.
  • Update the pair names in the pairs section to match the new base currency.

7. Exchange Old Stablecoinsโ€‹

  • Log in to your exchange.
  • Convert all USDT to the new stablecoin (e.g., USDC) to ensure comparable balances.

8. Restart Gunbotโ€‹

  • Launch Gunbot from the modified folder to begin trading with the new stablecoin pairs.

Why Gunbot is Ready for MiCA and Other Changesโ€‹

Gunbot's adaptability ensures that users can stay compliant with regulations like MiCA while continuing their trading strategies uninterrupted. By following these steps, you can preserve your order history and make necessary transitions efficiently.

Upcoming Automationโ€‹

We are developing a script to automate these steps, making the process quicker and easier. Stay tuned for updates!