From 0e70d23beffbf71e702e2cf825b9aa42c7f11f90 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 13 Nov 2021 09:13:32 +0100 Subject: [PATCH] Add documentation for exit_tags --- docs/strategy-advanced.md | 72 +++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/docs/strategy-advanced.md b/docs/strategy-advanced.md index fcd6138ed..47d7ee6ae 100644 --- a/docs/strategy-advanced.md +++ b/docs/strategy-advanced.md @@ -143,6 +143,52 @@ def custom_sell(self, pair: str, trade: Trade, current_time: datetime, current_r !!! Note `buy_tag` is limited to 100 characters, remaining data will be truncated. +## Exit tag + +Similar to [Buy Tagging](#buy-tag), you can also specify a sell tag. + +``` python +def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: + dataframe.loc[ + ( + (dataframe['rsi'] > 70) & + (dataframe['volume'] > 0) + ), + ['sell', 'exit_tag']] = (1, 'exit_rsi') + + return dataframe +``` + +The provided exit-tag is then used as sell-reason - and shown as such in backtest results. + +!!! Note + `sell_reason` is limited to 100 characters, remaining data will be truncated. + +## Bot loop start callback + +A simple callback which is called once at the start of every bot throttling iteration. +This can be used to perform calculations which are pair independent (apply to all pairs), loading of external data, etc. + +``` python +import requests + +class AwesomeStrategy(IStrategy): + + # ... populate_* methods + + def bot_loop_start(self, **kwargs) -> None: + """ + Called at the start of the bot iteration (one loop). + Might be used to perform pair-independent tasks + (e.g. gather some remote resource for comparison) + :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. + """ + if self.config['runmode'].value in ('live', 'dry_run'): + # Assign this to the class by using self.* + # can then be used by populate_* methods + self.remote_data = requests.get('https://some_remote_source.example.com') + +``` ## Custom stoploss @@ -501,32 +547,6 @@ class AwesomeStrategy(IStrategy): --- -## Bot loop start callback - -A simple callback which is called once at the start of every bot throttling iteration. -This can be used to perform calculations which are pair independent (apply to all pairs), loading of external data, etc. - -``` python -import requests - -class AwesomeStrategy(IStrategy): - - # ... populate_* methods - - def bot_loop_start(self, **kwargs) -> None: - """ - Called at the start of the bot iteration (one loop). - Might be used to perform pair-independent tasks - (e.g. gather some remote resource for comparison) - :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. - """ - if self.config['runmode'].value in ('live', 'dry_run'): - # Assign this to the class by using self.* - # can then be used by populate_* methods - self.remote_data = requests.get('https://some_remote_source.example.com') - -``` - ## Bot order confirmation ### Trade entry (buy order) confirmation