Skip to content

Commit

Permalink
Add Questionaire workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Jan 29, 2020
1 parent 49c9258 commit e250c56
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 2 deletions.
98 changes: 96 additions & 2 deletions freqtrade/commands/deploy_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
from pathlib import Path
from typing import Any, Dict

from questionary import Separator, prompt

from freqtrade.configuration import setup_utils_configuration
from freqtrade.configuration.directory_operations import (copy_sample_files,
create_userdata_dir)
from freqtrade.constants import USERPATH_HYPEROPTS, USERPATH_STRATEGY
from freqtrade.exceptions import OperationalException
from freqtrade.exchange import available_exchanges
from freqtrade.misc import render_template
from freqtrade.state import RunMode

Expand Down Expand Up @@ -117,6 +120,99 @@ def ask_user_config() -> Dict[str, Any]:
Ask user a few questions to build the configuration.
:returns: Dict with keys to put into template
"""
questions = [
{
"type": "confirm",
"name": "dry_run",
"message": "Do you want to enable Dry-run (simulated trades)?",
"default": True,
},
{
"type": "text",
"name": "stake_currency",
"message": "Please insert your stake currency:",
"default": 'BTC',
},
{
"type": "text",
"name": "stake_amount",
"message": "Please insert your stake amount:",
"default": "0.01",
},
{
"type": "text",
"name": "max_open_trades",
"message": "Please insert max_open_trades:",
"default": "3",
},
{
"type": "text",
"name": "ticker_interval",
"message": "Please insert your ticker interval:",
"default": "5m",
},
{
"type": "text",
"name": "fiat_display_currency",
"message": "Please insert your display Currency (for reporting):",
"default": 'USD',
},
{
"type": "select",
"name": "exchange_name",
"message": "Select exchange",
"choices": [
"bittrex",
"binance",
"binanceje",
"binanceus",
"kraken",
Separator(),
"other",
],
},
{
"type": "autocomplete",
"name": "exchange_name",
"message": "Type your exchange name (Must be supported by ccxt)",
"choices": available_exchanges(),
"when": lambda x: x["exchange_name"] == 'other'
},
{
"type": "password",
"name": "exchange_key",
"message": "Insert Exchange Key",
"when": lambda x: not x['dry_run']
},
{
"type": "password",
"name": "exchange_secret",
"message": "Insert Exchange Secret",
"when": lambda x: not x['dry_run']
},
{
"type": "confirm",
"name": "telegram",
"message": "Do you want to enable Telegram?",
"default": False,
},
{
"type": "password",
"name": "telegram_token",
"message": "Insert Telegram token",
"when": lambda x: x['telegram']
},
{
"type": "text",
"name": "telegram_chat_id",
"message": "Insert Telegram chat id",
"when": lambda x: x['telegram']
},
]
answers = prompt(questions)

print(answers)

sample_selections = {
'max_open_trades': 3,
'stake_currency': 'USDT',
Expand Down Expand Up @@ -167,5 +263,3 @@ def start_new_config(args: Dict[str, Any]) -> None:
selections = ask_user_config()
config_path = Path(args['config'][0])
deploy_new_config(config_path, selections)


3 changes: 3 additions & 0 deletions requirements-common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ flask==1.1.1

# Support for colorized terminal output
colorama==0.4.3
# Building config files interactively
questionary==1.5.1
prompt-toolkit==3.0.3
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
'sdnotify',
'colorama',
'jinja2',
'questionary',
'prompt-toolkit',
# from requirements.txt
'numpy',
'pandas',
Expand Down

0 comments on commit e250c56

Please sign in to comment.