thrasher-corp / gocryptotrader

A cryptocurrency trading bot and framework supporting multiple exchanges written in Golang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: ITBIT: pair config format is nil

kunallimaye opened this issue · comments

New Issue

Starting gocryptotrader with default config fails on the second attempt.
First attempt is successful - stop the service using Ctrl+C. And the next attempt to start fails with the following error:

Error: ITBIT: pair config format is nil

Context

OS GoCryptoTrader version
macOS Sonoma Version 14.3 GoCryptoTrader v0.1 arm64 go1.21.6 pre-release

Expected Behavior

Second attempt to start the bot/service should be successful

Current Behavior

What is the current behavior?

Failure Information (for bugs)

❯ gocryptotrader 

   ______        ______                     __        ______                  __
  / ____/____   / ____/_____ __  __ ____   / /_ ____ /_  __/_____ ______ ____/ /___   _____
 / / __ / __ \ / /    / ___// / / // __ \ / __// __ \ / /  / ___// __  // __  // _ \ / ___/
/ /_/ // /_/ // /___ / /   / /_/ // /_/ // /_ / /_/ // /  / /   / /_/ // /_/ //  __// /
\____/ \____/ \____//_/    \__, // .___/ \__/ \____//_/  /_/    \__,_/ \__,_/ \___//_/
                          /____//_/
GoCryptoTrader v0.1 arm64 go1.21.6 pre-release.
This version is pre-release and is not intended to be used as a production ready trading framework or bot - use at your own risk.
Copyright (c) 2014-2024 The GoCryptoTrader Developers.

GitHub: https://github.com/thrasher-corp/gocryptotrader
Trello: https://trello.com/b/ZAhMhpOy/gocryptotrader
Slack:  https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk
Issues: https://github.com/thrasher-corp/gocryptotrader/issues

2024/01/31 13:41:03 Loading config file /Users/someuser/.gocryptotrader/config.json..
2024/01/31 13:41:03 Unable to initialise bot engine. Error: failed to load config. Err: fatal error checking config values. Error: ITBIT: pair config format is nil

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Start the service first time
    # Copy the config file
    cp config_example.json ~/.gocryptotrader/config.json
    ./gocryptotrader
  2. Stop the service by pressing Ctrl+C
  3. Starting the server second time fails
    # reuse the previously created config file
    ./gocryptotrader

It seems like requestFormat and configFormat is missing for ITBIT exchange when the config is saved during step (2)?

Yeah the default currencyPairs config for ITBIT exchange is:

   "currencyPairs": {
    "bypassConfigFormatUpgrades": false,
    "requestFormat": {
     "uppercase": true
    },
    "configFormat": {
     "uppercase": true
    },
    "useGlobalFormat": true,
    "lastUpdated": 1591062026,
    "pairs": {
     "spot": {
      "assetEnabled": null,
      "enabled": "XBTUSD,XBTSGD",
      "available": "XBTUSD,XBTSGD"
     }
    }
   },

And requestFormat and configFormat go missing after the config file is saved during shutdown. Config after shutdown:

   "currencyPairs": {
    "bypassConfigFormatUpgrades": false,
    "lastUpdated": 1591062026,
    "pairs": {
     "spot": {
      "assetEnabled": true,
      "enabled": "XBTUSD,XBTSGD",
      "available": "XBTUSD,XBTSGD"
     }
    }
   },

Thanks for reporting this. Will get a proper fix for this shortly but for now you can edit the config for Itbit as follows:

   "currencyPairs": {
    "bypassConfigFormatUpgrades": false,
    "lastUpdated": 1591062026,
    "requestFormat": {
     "uppercase": true
    },
    "configFormat": {
     "uppercase": true,
     "delimiter": "-"
    },
    "useGlobalFormat": true,
    "pairs": {
     "spot": {
      "assetEnabled": true,
      "enabled": "XBT-USD,XBT-SGD",
      "available": "XBT-USD,XBT-SGD"
     }
    }
   },