chrisleekr / binance-trading-bot

Automated Binance trading bot - Trade multiple cryptocurrencies. Buy low/sell high with Grid Trading. Integrated with TradingView technical analysis
MIT License
5k stars 1.09k forks source link

Feature: Develop simple setup screen for secrets #103

Open jovicon opened 3 years ago

jovicon commented 3 years ago

Describe the solution you'd like

Issue to discuss about the feature, today I will review the code to propose a solution

Describe alternatives you've considered

Additional context

chrisleekr commented 3 years ago

Thanks @jovicon

With this feature, my intention is to make setup easier for the bot.

Currently, in order to set up the bot, you will need to create .env file and update docker-compose.yml manually with environment parameters - https://github.com/chrisleekr/binance-trading-bot#how-to-use

Some people find these steps are too techy; hence, I want to make these steps to be more user friendly.

My initial idea is like this:

  1. The bot checks binance-bot collection configuration key from mongodb. If not exist, then require to setup.
  2. If configuration does not exist in the mongodb, then the bot is not configured; hence the bot will wait for those configurations are stored in the mongodb
  3. If the bot is waiting for the configuration, then the frontend will display setup screen instead of the coins. The required configuration specified in the file - https://github.com/chrisleekr/binance-trading-bot/blob/master/config/custom-environment-variables.json 3-1. In the setup screen, each screen can set the values for

    • Mode
    • TZ: Timezone
    • Binance
      • API key
      • Secret key
    • Slack
      • Enabled
      • Webhook URL
      • Channel
      • Username
    • Local Tunnel
      • Enabled
      • Subdomain
    • Trailing trade job
      • Symbols
      • FIATs
      • Candles
      • Buy/Sell

    3-2. If there is the environment parameter for each field, pre-fill with the value. 3-3. Once finish setup, it will save into mongodb with binance-bot collection configuration key.

  4. Once the bot can see the configuration from mongodb, it should start working.
  5. Also, create config.js helper file in helpers and update config.get to use helper file's function 5-1. Add get function which get the binance-bot -> configuration from mongodb, then return the value. By doing this, it won't require massive refactoring.

I tried to explain as much as detail. Hope it is clear what the intention is.

If you have a better solution or approach, definitely welcome to listen.

jovicon commented 3 years ago

oks @chrisleekr I will check the code and what you told me to begin this weekend