Warn and trim custom sell reason if it is too long.
This commit is contained in:
parent
1aad128d85
commit
a90e795695
@ -572,12 +572,14 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
trade.pair, trade, date, current_rate, current_profit)
|
trade.pair, trade, date, current_rate, current_profit)
|
||||||
if custom_reason:
|
if custom_reason:
|
||||||
sell_signal = SellType.CUSTOM_SELL
|
sell_signal = SellType.CUSTOM_SELL
|
||||||
if isinstance(custom_reason, bool):
|
if isinstance(custom_reason, str):
|
||||||
custom_reason = None
|
|
||||||
elif isinstance(custom_reason, str):
|
|
||||||
if len(custom_reason) > CUSTOM_SELL_MAX_LENGTH:
|
if len(custom_reason) > CUSTOM_SELL_MAX_LENGTH:
|
||||||
raise OperationalException('Custom sell reason returned '
|
logger.warning(f'Custom sell reason returned from custom_sell is too '
|
||||||
'from custom_sell is too long.')
|
f'long and was trimmed to {CUSTOM_SELL_MAX_LENGTH} '
|
||||||
|
f'characters.')
|
||||||
|
custom_reason = custom_reason[:CUSTOM_SELL_MAX_LENGTH]
|
||||||
|
else:
|
||||||
|
custom_reason = None
|
||||||
# TODO: return here if sell-signal should be favored over ROI
|
# TODO: return here if sell-signal should be favored over ROI
|
||||||
|
|
||||||
# Start evaluations
|
# Start evaluations
|
||||||
|
Loading…
Reference in New Issue
Block a user