This commit is contained in:
Sam Germain 2021-07-10 21:20:06 -06:00
parent 681c15f021
commit 31cd136e94
6 changed files with 23 additions and 21 deletions

View File

@ -14,7 +14,7 @@ ARGS_COMMON = ["verbosity", "logfile", "version", "config", "datadir", "user_dat
ARGS_STRATEGY = ["strategy", "strategy_path"] ARGS_STRATEGY = ["strategy", "strategy_path"]
ARGS_TRADE = ["db_url", "sd_notify", "dry_run", "dry_run_wallet", "fee"] #TODO: leverage? ARGS_TRADE = ["db_url", "sd_notify", "dry_run", "dry_run_wallet", "fee"] # TODO-mg: leverage?
ARGS_COMMON_OPTIMIZE = ["timeframe", "timerange", "dataformat_ohlcv", ARGS_COMMON_OPTIMIZE = ["timeframe", "timerange", "dataformat_ohlcv",
"max_open_trades", "stake_amount", "fee", "pairs"] "max_open_trades", "stake_amount", "fee", "pairs"]
@ -58,7 +58,7 @@ ARGS_BUILD_HYPEROPT = ["user_data_dir", "hyperopt", "template"]
ARGS_CONVERT_DATA = ["pairs", "format_from", "format_to", "erase"] ARGS_CONVERT_DATA = ["pairs", "format_from", "format_to", "erase"]
ARGS_CONVERT_DATA_OHLCV = ARGS_CONVERT_DATA + ["timeframes"] ARGS_CONVERT_DATA_OHLCV = ARGS_CONVERT_DATA + ["timeframes"]
ARGS_LIST_DATA = ["exchange", "dataformat_ohlcv", "pairs"] #TODO: Leverage? ARGS_LIST_DATA = ["exchange", "dataformat_ohlcv", "pairs"] # TODO-mg: Leverage?
ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "new_pairs_days", "timerange", ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "new_pairs_days", "timerange",
"download_trades", "exchange", "timeframes", "erase", "dataformat_ohlcv", "download_trades", "exchange", "timeframes", "erase", "dataformat_ohlcv",

View File

@ -167,7 +167,8 @@ def ask_user_config() -> Dict[str, Any]:
"when": lambda x: x['api_server'] "when": lambda x: x['api_server']
}, },
] ]
#TODO: Enable short trading, trade with leverage
# TODO-mg: Enable short trading, trade with leverage
answers = prompt(questions) answers = prompt(questions)
if not answers: if not answers:
@ -194,7 +195,7 @@ def deploy_new_config(config_path: Path, selections: Dict[str, Any]) -> None:
selections['exchange'] = render_template( selections['exchange'] = render_template(
templatefile=f"subtemplates/exchange_{exchange_template}.j2", templatefile=f"subtemplates/exchange_{exchange_template}.j2",
arguments=selections arguments=selections
) )
except TemplateNotFound: except TemplateNotFound:
selections['exchange'] = render_template( selections['exchange'] = render_template(
templatefile="subtemplates/exchange_generic.j2", templatefile="subtemplates/exchange_generic.j2",

View File

@ -548,7 +548,7 @@ AVAILABLE_CLI_OPTIONS = {
help='Do not print epoch details header.', help='Do not print epoch details header.',
action='store_true', action='store_true',
), ),
#TODO: Set up these options # TODO-mg: Set up these options
# "leverage": Arg( # "leverage": Arg(
# '-L', '--leverage', # '-L', '--leverage',
# help='Leverage applied for margin and futures trading.', # help='Leverage applied for margin and futures trading.',

View File

@ -38,15 +38,15 @@ def deploy_new_strategy(strategy_name: str, strategy_path: Path, subtemplate: st
indicators = render_template_with_fallback( indicators = render_template_with_fallback(
templatefile=f"subtemplates/indicators_{subtemplate}.j2", templatefile=f"subtemplates/indicators_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/indicators_{fallback}.j2", templatefallbackfile=f"subtemplates/indicators_{fallback}.j2",
) )
buy_trend = render_template_with_fallback( buy_trend = render_template_with_fallback(
templatefile=f"subtemplates/buy_trend_{subtemplate}.j2", templatefile=f"subtemplates/buy_trend_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/buy_trend_{fallback}.j2", templatefallbackfile=f"subtemplates/buy_trend_{fallback}.j2",
) )
sell_trend = render_template_with_fallback( sell_trend = render_template_with_fallback(
templatefile=f"subtemplates/sell_trend_{subtemplate}.j2", templatefile=f"subtemplates/sell_trend_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/sell_trend_{fallback}.j2", templatefallbackfile=f"subtemplates/sell_trend_{fallback}.j2",
) )
plot_config = render_template_with_fallback( plot_config = render_template_with_fallback(
templatefile=f"subtemplates/plot_config_{subtemplate}.j2", templatefile=f"subtemplates/plot_config_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/plot_config_{fallback}.j2", templatefallbackfile=f"subtemplates/plot_config_{fallback}.j2",
@ -55,7 +55,7 @@ def deploy_new_strategy(strategy_name: str, strategy_path: Path, subtemplate: st
templatefile=f"subtemplates/strategy_methods_{subtemplate}.j2", templatefile=f"subtemplates/strategy_methods_{subtemplate}.j2",
templatefallbackfile="subtemplates/strategy_methods_empty.j2", templatefallbackfile="subtemplates/strategy_methods_empty.j2",
) )
#TODO: Short Trend, Exit short trend # TODO-mg: Short Trend, Exit short trend
strategy_text = render_template(templatefile='base_strategy.py.j2', strategy_text = render_template(templatefile='base_strategy.py.j2',
arguments={"strategy": strategy_name, arguments={"strategy": strategy_name,
@ -98,20 +98,20 @@ def deploy_new_hyperopt(hyperopt_name: str, hyperopt_path: Path, subtemplate: st
buy_guards = render_template_with_fallback( buy_guards = render_template_with_fallback(
templatefile=f"subtemplates/hyperopt_buy_guards_{subtemplate}.j2", templatefile=f"subtemplates/hyperopt_buy_guards_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/hyperopt_buy_guards_{fallback}.j2", templatefallbackfile=f"subtemplates/hyperopt_buy_guards_{fallback}.j2",
) )
sell_guards = render_template_with_fallback( sell_guards = render_template_with_fallback(
templatefile=f"subtemplates/hyperopt_sell_guards_{subtemplate}.j2", templatefile=f"subtemplates/hyperopt_sell_guards_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/hyperopt_sell_guards_{fallback}.j2", templatefallbackfile=f"subtemplates/hyperopt_sell_guards_{fallback}.j2",
) )
buy_space = render_template_with_fallback( buy_space = render_template_with_fallback(
templatefile=f"subtemplates/hyperopt_buy_space_{subtemplate}.j2", templatefile=f"subtemplates/hyperopt_buy_space_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/hyperopt_buy_space_{fallback}.j2", templatefallbackfile=f"subtemplates/hyperopt_buy_space_{fallback}.j2",
) )
sell_space = render_template_with_fallback( sell_space = render_template_with_fallback(
templatefile=f"subtemplates/hyperopt_sell_space_{subtemplate}.j2", templatefile=f"subtemplates/hyperopt_sell_space_{subtemplate}.j2",
templatefallbackfile=f"subtemplates/hyperopt_sell_space_{fallback}.j2", templatefallbackfile=f"subtemplates/hyperopt_sell_space_{fallback}.j2",
) )
#TODO: short_guards, exit_short_guards, short_space, exit_short_space # TODO-mg: short_guards, exit_short_guards, short_space, exit_short_space
strategy_text = render_template(templatefile='base_hyperopt.py.j2', strategy_text = render_template(templatefile='base_hyperopt.py.j2',
arguments={"hyperopt": hyperopt_name, arguments={"hyperopt": hyperopt_name,
@ -119,7 +119,8 @@ def deploy_new_hyperopt(hyperopt_name: str, hyperopt_path: Path, subtemplate: st
"sell_guards": sell_guards, "sell_guards": sell_guards,
"buy_space": buy_space, "buy_space": buy_space,
"sell_space": sell_space, "sell_space": sell_space,
}) #TODO: short_guards, exit_short_guards, short_space, exit_short_space })
# TODO-mg: short_guards, exit_short_guards, short_space, exit_short_space
logger.info(f"Writing hyperopt to `{hyperopt_path}`.") logger.info(f"Writing hyperopt to `{hyperopt_path}`.")
hyperopt_path.write_text(strategy_text) hyperopt_path.write_text(strategy_text)

View File

@ -187,7 +187,7 @@ def _hyperopt_filter_epochs_trade_count(epochs: List, filteroptions: dict) -> Li
x for x in epochs x for x in epochs
if x['results_metrics'].get( if x['results_metrics'].get(
'trade_count', x['results_metrics'].get('total_trades') 'trade_count', x['results_metrics'].get('total_trades')
) < filteroptions['filter_max_trades'] ) < filteroptions['filter_max_trades']
] ]
return epochs return epochs
@ -239,7 +239,7 @@ def _hyperopt_filter_epochs_profit(epochs: List, filteroptions: dict) -> List:
x for x in epochs x for x in epochs
if x['results_metrics'].get( if x['results_metrics'].get(
'avg_profit', x['results_metrics'].get('profit_mean', 0) * 100 'avg_profit', x['results_metrics'].get('profit_mean', 0) * 100
) < filteroptions['filter_max_avg_profit'] ) < filteroptions['filter_max_avg_profit']
] ]
if filteroptions['filter_min_total_profit'] is not None: if filteroptions['filter_min_total_profit'] is not None:
epochs = _hyperopt_filter_epochs_trade(epochs, 0) epochs = _hyperopt_filter_epochs_trade(epochs, 0)
@ -247,7 +247,7 @@ def _hyperopt_filter_epochs_profit(epochs: List, filteroptions: dict) -> List:
x for x in epochs x for x in epochs
if x['results_metrics'].get( if x['results_metrics'].get(
'profit', x['results_metrics'].get('profit_total_abs', 0) 'profit', x['results_metrics'].get('profit_total_abs', 0)
) > filteroptions['filter_min_total_profit'] ) > filteroptions['filter_min_total_profit']
] ]
if filteroptions['filter_max_total_profit'] is not None: if filteroptions['filter_max_total_profit'] is not None:
epochs = _hyperopt_filter_epochs_trade(epochs, 0) epochs = _hyperopt_filter_epochs_trade(epochs, 0)
@ -255,7 +255,7 @@ def _hyperopt_filter_epochs_profit(epochs: List, filteroptions: dict) -> List:
x for x in epochs x for x in epochs
if x['results_metrics'].get( if x['results_metrics'].get(
'profit', x['results_metrics'].get('profit_total_abs', 0) 'profit', x['results_metrics'].get('profit_total_abs', 0)
) < filteroptions['filter_max_total_profit'] ) < filteroptions['filter_max_total_profit']
] ]
return epochs return epochs
@ -273,4 +273,4 @@ def _hyperopt_filter_epochs_objective(epochs: List, filteroptions: dict) -> List
return epochs return epochs
#TODO: Hyperopt optimal leverage # TODO-mg: Hyperopt optimal leverage

View File

@ -148,7 +148,7 @@ def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None:
quote_currencies = args.get('quote_currencies', []) quote_currencies = args.get('quote_currencies', [])
try: try:
#TODO: Add leverage amount to get markets that support a certain leverage # TODO-mg: Add leverage amount to get markets that support a certain leverage
pairs = exchange.get_markets(base_currencies=base_currencies, pairs = exchange.get_markets(base_currencies=base_currencies,
quote_currencies=quote_currencies, quote_currencies=quote_currencies,
pairs_only=pairs_only, pairs_only=pairs_only,