stable/freqtrade/optimize
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
..
space Improve performance of decimalspace.py 2021-10-24 18:14:24 +02:00
__init__.py Small adjustments for moved commands 2020-01-26 13:46:01 +01:00
backtesting.py Safer exit_tag is not None check 2022-01-18 15:29:59 +00:00
bt_progress.py Fix typo in bt_progress 2022-01-02 19:38:03 +01:00
edge_cli.py Fix @informative decorator failing with edge. 2022-01-15 17:31:16 +02:00
hyperopt_auto.py Simplify "no-space-configured" error handling by moving it to hyperopt_auto 2021-10-13 19:54:35 +02:00
hyperopt_epoch_filters.py Stream hyperopt-result in small batches 2021-08-10 10:12:57 +02:00
hyperopt_interface.py Add possibility to override estimator from within hyperopt 2021-09-15 21:36:53 +02:00
hyperopt_loss_calmar.py Fix some tests after drawdown calculation change 2022-01-04 17:07:31 +01:00
hyperopt_loss_interface.py Provide full backtest-statistics to Hyperopt loss functions 2021-07-04 10:15:19 +02:00
hyperopt_loss_max_drawdown.py simplify expression 2021-10-09 06:36:23 +05:30
hyperopt_loss_onlyprofit.py Update onlyprofit loss should use absolute profit 2021-05-28 08:38:46 +02:00
hyperopt_loss_sharpe_daily.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_loss_sharpe.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_loss_short_trade_dur.py rename default_hyperopt_loss file 2021-08-26 19:39:57 +02:00
hyperopt_loss_sortino_daily.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_loss_sortino.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_tools.py Update hyperopt-tools to use account drawdown 2022-01-04 17:43:39 +01:00
hyperopt.py Remove btdata from generate_strategy_stats 2022-01-07 09:27:07 +01:00
optimize_reports.py Implement previous backtest result reuse when config and strategy did not change. 2022-01-15 17:30:40 +02:00