Skip to content

Performance improvement on TA functions #6

@pegaltier

Description

@pegaltier

The library works well in overall but in terms of performance it has some issue for instance when I load the whole historical data provided by Binance for BNBUSDT in 4h interval I get around 16500 candles and in this case the library take 174 seconds to do the calculation of the squeeze momentum indicator, of course this indicator is a combination of many indicators so I understand it takes a bit of time but maybe not that long.

I suspect its because of two reasons :

  1. how the indicators are calculated it has no maximum lookback so the more we advance to recent candles the more it has to calculate the previous bar, for instance by hardcoding a max lookback to 300 in all ocurrence of TechnicalAnalysis class (slice(0).reverse().slice(0, 300) instead of slice(0).reverse()) it takes now 56 seconds to calculate instead of 174 s
  2. how the indicators are calculated it redo one complete calculation for each candle, I could suggest instead to refactor the TA functions to use one existing optimized technical indicators library like trading-signals

It could be significantly faster because the candles are streamed and thus calculate only the minimum between each candle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions