Use exchange_mapping to determine correct exchange-template

This commit is contained in:
Matthias 2020-02-01 13:46:58 +01:00
parent d69ef4380b
commit c40a4d77f8

View File

@ -5,7 +5,7 @@ from typing import Any, Dict
from questionary import Separator, prompt from questionary import Separator, prompt
from freqtrade.constants import UNLIMITED_STAKE_AMOUNT from freqtrade.constants import UNLIMITED_STAKE_AMOUNT
from freqtrade.exchange import available_exchanges from freqtrade.exchange import available_exchanges, MAP_EXCHANGE_CHILDCLASS
from freqtrade.misc import render_template from freqtrade.misc import render_template
from freqtrade.exceptions import OperationalException from freqtrade.exceptions import OperationalException
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -141,8 +141,11 @@ def deploy_new_config(config_path: Path, selections: Dict[str, Any]) -> None:
""" """
from jinja2.exceptions import TemplateNotFound from jinja2.exceptions import TemplateNotFound
try: try:
exchange_template = MAP_EXCHANGE_CHILDCLASS.get(
selections['exchange_name'], selections['exchange_name'])
selections['exchange'] = render_template( selections['exchange'] = render_template(
templatefile=f"subtemplates/exchange_{selections['exchange_name']}.j2", templatefile=f"subtemplates/exchange_{exchange_template}.j2",
arguments=selections arguments=selections
) )
except TemplateNotFound: except TemplateNotFound: