From 22da2e059fad22ebb7d6435e666d9372f015600b Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Mon, 31 Jan 2022 11:46:36 -0600 Subject: [PATCH] updated new-config command to add trading_mode and margin_mode to config --- freqtrade/commands/build_config_commands.py | 18 +++++++++++++++++- freqtrade/templates/base_config.json.j2 | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/freqtrade/commands/build_config_commands.py b/freqtrade/commands/build_config_commands.py index 9d2d5ba0a..c90b1d750 100644 --- a/freqtrade/commands/build_config_commands.py +++ b/freqtrade/commands/build_config_commands.py @@ -103,11 +103,18 @@ def ask_user_config() -> Dict[str, Any]: "message": "Please insert your display Currency (for reporting):", "default": 'USD', }, + { + "type": "confirm", + "name": "trading_mode", + "message": "Do you want to trade Perpetual Swaps (perpetual futures)?", + "default": False, + "filter": lambda val: '"futures"' if val else '"spot"', + }, { "type": "select", "name": "exchange_name", "message": "Select exchange", - "choices": [ + "choices": lambda x: [ "binance", "binanceus", "okex", @@ -118,6 +125,10 @@ def ask_user_config() -> Dict[str, Any]: "kucoin", Separator(), "other", + ] if x['trading_mode'] == '"spot"' else [ + "binance", + # "okex", + "gateio", ], }, { @@ -192,6 +203,11 @@ def ask_user_config() -> Dict[str, Any]: }, ] answers = prompt(questions) + answers["margin_mode"] = ( + '\n "margin_mode": "isolated",' + if answers["trading_mode"] == '"futures"' + else '' + ) if not answers: # Interrupted questionary sessions return an empty dict. diff --git a/freqtrade/templates/base_config.json.j2 b/freqtrade/templates/base_config.json.j2 index c91715b1f..922213ee7 100644 --- a/freqtrade/templates/base_config.json.j2 +++ b/freqtrade/templates/base_config.json.j2 @@ -13,6 +13,7 @@ "fiat_display_currency": "{{ fiat_display_currency }}",{{ ('\n "timeframe": "' + timeframe + '",') if timeframe else '' }} "dry_run": {{ dry_run | lower }}, "cancel_open_orders_on_exit": false, + "trading_mode": {{ trading_mode }},{{ margin_mode }} "unfilledtimeout": { "buy": 10, "sell": 10,