Extract custom_tag limit from interface file
This commit is contained in:
		| @@ -64,6 +64,7 @@ USERPATH_FREQAIMODELS = 'freqaimodels' | ||||
| TELEGRAM_SETTING_OPTIONS = ['on', 'off', 'silent'] | ||||
| WEBHOOK_FORMAT_OPTIONS = ['form', 'json', 'raw'] | ||||
| FULL_DATAFRAME_THRESHOLD = 100 | ||||
| CUSTOM_TAG_MAX_LENGTH = 64 | ||||
|  | ||||
| ENV_VAR_PREFIX = 'FREQTRADE__' | ||||
|  | ||||
|   | ||||
| @@ -10,7 +10,7 @@ from typing import Dict, List, Optional, Tuple, Union | ||||
| import arrow | ||||
| from pandas import DataFrame | ||||
|  | ||||
| from freqtrade.constants import Config, IntOrInf, ListPairsWithTimeframes | ||||
| from freqtrade.constants import CUSTOM_TAG_MAX_LENGTH, Config, IntOrInf, ListPairsWithTimeframes | ||||
| from freqtrade.data.dataprovider import DataProvider | ||||
| from freqtrade.enums import (CandleType, ExitCheckTuple, ExitType, MarketDirection, RunMode, | ||||
|                              SignalDirection, SignalTagType, SignalType, TradingMode) | ||||
| @@ -27,7 +27,6 @@ from freqtrade.wallets import Wallets | ||||
|  | ||||
|  | ||||
| logger = logging.getLogger(__name__) | ||||
| CUSTOM_EXIT_MAX_LENGTH = 64 | ||||
|  | ||||
|  | ||||
| class IStrategy(ABC, HyperStrategyMixin): | ||||
| @@ -1118,11 +1117,11 @@ class IStrategy(ABC, HyperStrategyMixin): | ||||
|                     exit_signal = ExitType.CUSTOM_EXIT | ||||
|                     if isinstance(reason_cust, str): | ||||
|                         custom_reason = reason_cust | ||||
|                         if len(reason_cust) > CUSTOM_EXIT_MAX_LENGTH: | ||||
|                         if len(reason_cust) > CUSTOM_TAG_MAX_LENGTH: | ||||
|                             logger.warning(f'Custom exit reason returned from ' | ||||
|                                            f'custom_exit is too long and was trimmed' | ||||
|                                            f'to {CUSTOM_EXIT_MAX_LENGTH} characters.') | ||||
|                             custom_reason = reason_cust[:CUSTOM_EXIT_MAX_LENGTH] | ||||
|                                            f'to {CUSTOM_TAG_MAX_LENGTH} characters.') | ||||
|                             custom_reason = reason_cust[:CUSTOM_TAG_MAX_LENGTH] | ||||
|                     else: | ||||
|                         custom_reason = '' | ||||
|             if ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user