updated new-config command to add trading_mode and margin_mode to config

This commit is contained in:
Sam Germain 2022-01-31 11:46:36 -06:00
parent b423c61127
commit 22da2e059f
2 changed files with 18 additions and 1 deletions

View File

@ -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.

View File

@ -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,