stable/freqtrade
Simon Ebner df033d92ef Improve performance of decimalspace.py
decimalspace.py is heavily used in the hyperoptimization. The following
benchmark code runs an optimization which is taken from optimizing a
real strategy (wtc).
The optimized version takes on my machine approx. 11/12s compared to the
original 32s. Results are equivalent in both cases.

```
import freqtrade.optimize.space
import numpy as np
import skopt
import timeit

def init():
    Decimal = freqtrade.optimize.space.decimalspace.SKDecimal
    Integer = skopt.space.space.Integer
    dimensions = [Decimal(low=-1.0,
        high=1.0,
        decimals=4,
        prior='uniform',
        transform='identity')] * 20

    return skopt.Optimizer(
        dimensions,
        base_estimator="ET",
        acq_optimizer="auto",
        n_initial_points=5,
        acq_optimizer_kwargs={'n_jobs': 96},
        random_state=0,
        model_queue_size=10,
    )

def test():
    opt = init()
    actual = opt.ask(n_points=2)
    expected = [[
        0.7515, -0.4723, -0.6941, -0.7988, 0.0448, 0.8605, -0.108, 0.5399,
        0.763, -0.2948, 0.8345, -0.7683, 0.7077, -0.2478, -0.333, 0.8575,
        0.6108, 0.4514, 0.5982, 0.3506
    ], [
        0.5563, 0.7386, -0.6407, 0.9073, -0.5211, -0.8167, -0.3771,
        -0.0318, 0.2861, 0.1176, 0.0943, -0.6077, -0.9317, -0.5372,
        -0.4934, -0.3637, -0.8035, -0.8627, -0.5399, 0.6036
    ]]

    absdiff = np.max(np.abs(np.asarray(expected) - np.asarray(actual)))
    assert absdiff < 1e-5

def time():
    opt = init()
    print('dt', timeit.timeit("opt.ask(n_points=20)", globals=locals()))

if __name__ == "__main__":
    test()
    time()
```
2021-10-24 18:14:24 +02:00
..
commands Merge pull request #4606 from rextea/add_days_breakdown_to_backtesting_summary 2021-10-21 13:56:30 +02:00
configuration Merge pull request #4606 from rextea/add_days_breakdown_to_backtesting_summary 2021-10-21 13:56:30 +02:00
data Fix unreliable backtest-result when using webserver mode 2021-09-26 15:07:48 +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 Split protection-notification into global and per-pair 2021-09-20 19:23:40 +02:00
exchange Reallow bitstamp 2021-10-19 19:12:35 +02:00
mixins Improve wording, fix bug 2020-12-07 15:48:06 +01:00
optimize Improve performance of decimalspace.py 2021-10-24 18:14:24 +02:00
persistence ProtectionManager should return the lock just created 2021-09-19 19:41:19 +02:00
plot fix: typo spelling grammar 2021-08-16 19:16:24 +07:00
plugins Allow StaticPairlist in non-first position 2021-10-19 19:48:56 +02:00
resolvers Remove legacy hyperopt interface from hyperopt.py 2021-09-12 08:18:13 +02:00
rpc Rollback after each request 2021-10-17 10:30:06 +02:00
strategy [SQUASH] Remove mypy import. 2021-09-18 15:27:58 +03:00
templates Remove ratelimit from kucoin template 2021-10-04 20:22:41 +02: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 Support day/week/month breakdowns 2021-10-21 06:58:40 +02:00
exceptions.py spell corrections 2021-06-25 22:10:04 +05:30
freqtradebot.py Rename update_open_trades to clarify it's only called at startup 2021-09-30 07:24:16 +02:00
loggers.py Exclude some parts from coverage that can't really be tested 2021-09-05 09:14:44 +02:00
main.py Exclude more untestable sections from coverage 2021-09-05 15:40:21 +02:00
misc.py feat: add one additional asterisk 2021-07-12 12:27:59 +00:00
wallets.py Don't log from wallet in backtest mode 2021-07-16 19:57:49 +02:00
worker.py spell corrections 2021-06-25 22:10:04 +05:30