Skip to content

Much Faster Version of Supertrend.py #242

Open
@perkmeister

Description

Describe your environment

  • Operating system: Windows10 Pro
  • Python Version: 3.8.10
  • CCXT version: 1.72.36
  • Freqtrade Version: develop-119d4d520
  • Strategy: Supertrend.py

Describe the problem:

This is not strictly a problem per se, but Supertrend.py is very slow due to dataframe accesses within the loops that it uses. It also uses the old way of creating columns during hyperopting by creating multiple columns in the dataframe, and can result in performance warnings.

Here is an updated version that uses numpy arrays in place of the dataframe accesses within the loops, and this has resulted in a 46 times speed improvement with the supertrend() function when testing ATOM/USDT over the timerange 20210801-20220201. Also dataframe columns are now calculated in populate_buy_trend() rather than creating multiple columns in the dataframe.

As far as I can tell the behaviour is identical to the Supertrend.py strategy, except much faster.

These are the results with the default settings using ATOM/USDT over the range above showing the results are exactly the same and the difference in speed. I've attached the updated FastSupertrend.py.

FastSupertrend1
FastSupertrend2
FastSupertrend.py.TXT

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions