stable/freqtrade
Italo 5f1235a031
Safer exit_tag is not None check
the comparison using `is not None` fails if the column  `exit_tag` is stored with the more efficient dtype `Sparse[string]`. The reason is that none values are stored as np.nan which is a float. This would raise an error when `len` is called at the next condition.

```
2022-01-18 15:18:22,548 - freqtrade - ERROR - Fatal exception!
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 436, in _process_worker
    r = call_item()
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 288, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py", line 262, in __call__
    return [func(*args, **kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py", line 262, in <listcomp>
    return [func(*args, **kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/cloudpickle_wrapper.py", line 38, in __call__
    return self._obj(*args, **kwargs)
  File "/freqtrade/freqtrade/optimize/hyperopt.py", line 317, in generate_optimizer
    bt_results = self.backtesting.backtest(
  File "/freqtrade/freqtrade/optimize/backtesting.py", line 658, in backtest
    trade_entry = self._get_sell_trade_entry(trade, row)
  File "/freqtrade/freqtrade/optimize/backtesting.py", line 461, in _get_sell_trade_entry
    return self._get_sell_trade_entry_for_candle(trade, sell_row)
  File "/freqtrade/freqtrade/optimize/backtesting.py", line 426, in _get_sell_trade_entry_for_candle
    and len(sell_row[EXIT_TAG_IDX]) > 0
TypeError: object of type 'float' has no len()
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/freqtrade/freqtrade/main.py", line 37, in main
    return_code = args['func'](args)
  File "/freqtrade/freqtrade/commands/optimize_commands.py", line 103, in start_hyperopt
    hyperopt.start()
  File "/freqtrade/freqtrade/optimize/hyperopt.py", line 482, in start
    f_val = self.run_optimizer_parallel(parallel, asked, i)
  File "/freqtrade/freqtrade/optimize/hyperopt.py", line 396, in run_optimizer_parallel
    return parallel(delayed(
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py", line 1056, in __call__
    self.retrieve()
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py", line 935, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
    return future.result(timeout=timeout)
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 445, in result
    return self.__get_result()
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
    raise self._exception
TypeError: object of type 'float' has no len()
ERROR: 1
```
2022-01-18 15:29:59 +00:00
..
commands Implement previous backtest result reuse when config and strategy did not change. 2022-01-15 17:30:40 +02:00
configuration Implement previous backtest result reuse when config and strategy did not change. 2022-01-15 17:30:40 +02:00
data Implement previous backtest result reuse when config and strategy did not change. 2022-01-15 17:30:40 +02:00
edge Add a decorator which can be used to declare populate_indicators() functions for informative pairs. 2021-09-18 10:48:18 +03:00
enums OrderTypeValues should be in enums 2021-12-03 15:34:28 +01:00
exchange Dry-run orders should have filled set correctly 2022-01-15 15:25:16 +01:00
mixins Improve wording, fix bug 2020-12-07 15:48:06 +01:00
optimize Safer exit_tag is not None check 2022-01-18 15:29:59 +00:00
persistence Add eager-loading for orders. This allows access to trade.orders in all callbacks. 2022-01-17 13:23:37 +02:00
plot Update drawdown calculation to account drawdown 2022-01-04 17:07:31 +01:00
plugins Spreadfilter log % fix 2022-01-18 14:05:03 +05:30
resolvers Refactoring to use strategy based configuration 2021-12-24 12:38:43 +02:00
rpc Readd trailing white line 2022-01-17 20:00:35 +01:00
strategy Convert nan to None in get_signal. 2022-01-16 08:04:39 +01:00
templates improved unfilledtimeout defaults 2022-01-16 13:17:12 +01:00
vendor Disable ability to use lookahead-biased vwap 2021-10-17 11:23:58 +02:00
__init__.py Exclude some parts from coverage that can't really be tested 2021-09-05 09:14:44 +02:00
__main__.py Remove support for 3.6 2020-12-14 19:18:54 +01:00
constants.py Add unknown_fee_rate parameter 2021-12-11 15:26:08 +01:00
exceptions.py Small formatting upgrades 2021-11-11 12:06:18 +01:00
freqtradebot.py Add eager-loading for orders. This allows access to trade.orders in all callbacks. 2022-01-17 13:23:37 +02:00
loggers.py Fix empty "/log" endpoint in certain moments 2022-01-16 15:37:00 +01:00
main.py Exclude more untestable sections from coverage 2021-09-05 15:40:21 +02:00
misc.py Implement previous backtest result reuse when config and strategy did not change. 2022-01-15 17:30:40 +02:00
wallets.py Integration-test for DCA order 2022-01-02 20:20:56 +01:00
worker.py Slightly reduce verbosity when reload_conf is issued 2021-12-23 20:33:13 +01:00