Skip to content

Commit

Permalink
Add exchange templates
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Jan 29, 2020
1 parent 122c916 commit c80d8f4
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 26 deletions.
19 changes: 17 additions & 2 deletions freqtrade/commands/deploy_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,22 @@ def deploy_new_config(config_path: Path, selections: Dict[str, Any]) -> None:
:param config_path: Path object for new config file. Should not exist yet
:param selecions: Dict containing selections taken by the user.
"""
from jinja2.exceptions import TemplateNotFound
try:
selections['exchange'] = render_template(
templatefile=f"subtemplates/exchange_{selections['exchange_name']}.j2",
arguments=selections
)
except TemplateNotFound:
selections['exchange'] = render_template(
templatefile=f"subtemplates/exchange_generic.j2",
arguments=selections
)

config_text = render_template(templatefile='base_config.json.j2',
arguments=selections)

logger.info(f"Writing config to `{config_path}`.")
config_path.write_text(config_text)


Expand All @@ -135,12 +148,14 @@ def start_new_config(args: Dict[str, Any]) -> None:
'fiat_display_currency': 'EUR',
'ticker_interval': '15m',
'dry_run': True,
'exchange': 'binance',
'exchange_name': 'binance',
'exchange_key': 'sampleKey',
'exchange_secret': 'Samplesecret',
'telegram': True,
'telegram': False,
'telegram_token': 'asdf1244',
'telegram_chat_id': '1144444',
}
config_path = Path(args['config'][0])
deploy_new_config(config_path, sample_selections)


1 change: 0 additions & 1 deletion freqtrade/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,4 @@ def render_template(templatefile: str, arguments: dict = {}):
autoescape=select_autoescape(['html', 'xml'])
)
template = env.get_template(templatefile)

return template.render(**arguments)
24 changes: 1 addition & 23 deletions freqtrade/templates/base_config.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,7 @@
"ignore_roi_if_buy_signal": false
},
"exchange": {
"name": "bittrex",
"key": "your_exchange_key",
"secret": "your_exchange_secret",
"ccxt_config": {"enableRateLimit": true},
"ccxt_async_config": {
"enableRateLimit": true,
"rateLimit": 500
},
"pair_whitelist": [
"ETH/BTC",
"LTC/BTC",
"ETC/BTC",
"DASH/BTC",
"ZEC/BTC",
"XLM/BTC",
"NXT/BTC",
"TRX/BTC",
"ADA/BTC",
"XMR/BTC"
],
"pair_blacklist": [
"DOGE/BTC"
]
{{ exchange | indent(8) }}
},
"pairlists": [
{"method": "StaticPairList"}
Expand Down
28 changes: 28 additions & 0 deletions freqtrade/templates/subtemplates/exchange_binance.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"name": "{{ exchange_name | lower }}",
"key": "{{ exchange_key }}",
"secret": "{{ exchange_secret }}",
"ccxt_config": {"enableRateLimit": true},
"ccxt_async_config": {
"enableRateLimit": true,
"rateLimit": 200
},
"pair_whitelist": [
"ALGO/BTC",
"ATOM/BTC",
"BAT/BTC",
"BCH/BTC",
"BRD/BTC",
"EOS/BTC",
"ETH/BTC",
"IOTA/BTC",
"LINK/BTC",
"LTC/BTC",
"NEO/BTC",
"NXS/BTC",
"XMR/BTC",
"XRP/BTC",
"XTZ/BTC"
],
"pair_blacklist": [
"BNB/BTC"
]
13 changes: 13 additions & 0 deletions freqtrade/templates/subtemplates/exchange_generic.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"name": "{{ exchange_name | lower }}",
"key": "{{ exchange_key }}",
"secret": "{{ exchange_secret }}",
"ccxt_config": {"enableRateLimit": true},
"ccxt_async_config": {
"enableRateLimit": true,
},
"pair_whitelist": [

],
"pair_blacklist": [

]
33 changes: 33 additions & 0 deletions freqtrade/templates/subtemplates/exchange_kraken.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"name": "kraken",
"key": "{{ exchange_key }}",
"secret": "{{ exchange_secret }}",
"ccxt_config": {"enableRateLimit": true},
"ccxt_async_config": {
"enableRateLimit": true,
"rateLimit": 1000
},
"pair_whitelist": [
"ADA/EUR",
"ATOM/EUR",
"BAT/EUR",
"BCH/EUR",
"BTC/EUR",
"DAI/EUR",
"DASH/EUR",
"EOS/EUR",
"ETC/EUR",
"ETH/EUR",
"LINK/EUR",
"LTC/EUR",
"QTUM/EUR",
"REP/EUR",
"WAVES/EUR",
"XLM/EUR",
"XMR/EUR",
"XRP/EUR",
"XTZ/EUR",
"ZEC/EUR"
],
"pair_blacklist": [

]

0 comments on commit c80d8f4

Please sign in to comment.