Simplify trading_mode selection
This commit is contained in:
parent
894c8f64f2
commit
2ab64cbbd3
@ -127,7 +127,7 @@ def ask_user_config() -> Dict[str, Any]:
|
|||||||
"name": "trading_mode",
|
"name": "trading_mode",
|
||||||
"message": "Do you want to trade Perpetual Swaps (perpetual futures)?",
|
"message": "Do you want to trade Perpetual Swaps (perpetual futures)?",
|
||||||
"default": False,
|
"default": False,
|
||||||
"filter": lambda val: '"futures"' if val else '"spot"',
|
"filter": lambda val: 'futures' if val else 'spot',
|
||||||
"when": lambda x: x["exchange_name"] in ['binance', 'gateio'],
|
"when": lambda x: x["exchange_name"] in ['binance', 'gateio'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -202,16 +202,15 @@ def ask_user_config() -> Dict[str, Any]:
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
answers = prompt(questions)
|
answers = prompt(questions)
|
||||||
answers["margin_mode"] = (
|
|
||||||
'\n "margin_mode": "isolated",'
|
|
||||||
if answers["trading_mode"] == '"futures"'
|
|
||||||
else ''
|
|
||||||
)
|
|
||||||
|
|
||||||
if not answers:
|
if not answers:
|
||||||
# Interrupted questionary sessions return an empty dict.
|
# Interrupted questionary sessions return an empty dict.
|
||||||
raise OperationalException("User interrupted interactive questions.")
|
raise OperationalException("User interrupted interactive questions.")
|
||||||
|
answers["margin_mode"] = (
|
||||||
|
'\n "margin_mode": "isolated",'
|
||||||
|
if answers.get("trading_mode") == 'futures'
|
||||||
|
else ''
|
||||||
|
)
|
||||||
# Force JWT token to be a random string
|
# Force JWT token to be a random string
|
||||||
answers['api_server_jwt_key'] = secrets.token_hex()
|
answers['api_server_jwt_key'] = secrets.token_hex()
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
"fiat_display_currency": "{{ fiat_display_currency }}",{{ ('\n "timeframe": "' + timeframe + '",') if timeframe else '' }}
|
"fiat_display_currency": "{{ fiat_display_currency }}",{{ ('\n "timeframe": "' + timeframe + '",') if timeframe else '' }}
|
||||||
"dry_run": {{ dry_run | lower }},
|
"dry_run": {{ dry_run | lower }},
|
||||||
"cancel_open_orders_on_exit": false,
|
"cancel_open_orders_on_exit": false,
|
||||||
"trading_mode": {{ trading_mode }},{{ margin_mode }}
|
"trading_mode": "{{ trading_mode }}",{{ margin_mode }}
|
||||||
"unfilledtimeout": {
|
"unfilledtimeout": {
|
||||||
"buy": 10,
|
"buy": 10,
|
||||||
"sell": 10,
|
"sell": 10,
|
||||||
|
Loading…
Reference in New Issue
Block a user