Optimize indicators with long calculation times.
vsaveris opened this issue · 7 comments
Tasks:
- Optimize code for the indicators with long calculation times (those in bold in the list below).
- Execute regression testing after each change.
The task is targeting planned release: 0.2 stable-release (01-01-2021)
Technical Indicators calculation times, for 3169 trading days.
- Indicator = AccumulationDistributionLine Calculation time = 0.1 seconds.
- Indicator = AverageTrueRange Calculation time = 0.02 seconds.
- Indicator = BollingerBands Calculation time = 0.01 seconds.
- Indicator = ChaikinMoneyFlow Calculation time = 0.01 seconds.
- Indicator = ChaikinOscillator Calculation time = 0.1 seconds.
- Indicator = ChandeMomentumOscillator Calculation time = 0.01 seconds.
- Indicator = CommodityChannelIndex Calculation time = 0.94 seconds.
- Indicator = DetrendedPriceOscillator Calculation time = 0.01 seconds.
- Indicator = DirectionalMovementIndex Calculation time = 4.58 seconds.
- Indicator = DoubleExponentialMovingAverage Calculation time = 0.01 seconds.
- Indicator = EaseOfMovement Calculation time = 0.01 seconds.
- Indicator = Envelopes Calculation time = 0.01 seconds.
- Indicator = FibonacciRetracement Calculation time = 0.01 seconds.
- Indicator = ForecastOscillator Calculation time = 2.37 seconds.
- Indicator = IchimokuCloud Calculation time = 0.02 seconds.
- Indicator = IntradayMovementIndex Calculation time = 0.01 seconds.
- Indicator = KlingerOscillator Calculation time = 0.06 seconds.
- Indicator = LinearRegressionIndicator Calculation time = 2.3 seconds.
- Indicator = LinearRegressionSlope Calculation time = 0.01 seconds.
- Indicator = MarketFacilitationIndex Calculation time = 0.01 seconds.
- Indicator = MassIndex Calculation time = 0.01 seconds.
- Indicator = MedianPrice Calculation time = 0.01 seconds.
- Indicator = Momentum Calculation time = 0.01 seconds.
- Indicator = MovingAverage (simple) Calculation time = 0.01 seconds.
- Indicator = MovingAverage (exponential) Calculation time = 0.01 seconds.
- Indicator = MovingAverage (time_series) Calculation time = 2.31 seconds.
- Indicator = MovingAverage (triangular) Calculation time = 0.01 seconds.
- Indicator = MovingAverage (variable) Calculation time = 0.35 seconds.
- Indicator = MovingAverageConvergenceDivergence Calculation time = 0.01 seconds.
- Indicator = NegativeVolumeIndex Calculation time = 0.21 seconds.
- Indicator = OnBalanceVolume Calculation time = 0.01 seconds.
- Indicator = ParabolicSAR Calculation time = 2.72 seconds.
- Indicator = Performance Calculation time = 0.01 seconds.
- Indicator = PositiveVolumeIndex Calculation time = 0.2 seconds.
- Indicator = PriceAndVolumeTrend Calculation time = 0.22 seconds.
- Indicator = PriceChannel Calculation time = 0.01 seconds.
- Indicator = PriceOscillator Calculation time = 0.01 seconds.
- Indicator = PriceRateOfChange Calculation time = 0.01 seconds.
- Indicator = ProjectionBands Calculation time = 2.97 seconds.
- Indicator = ProjectionOscillator Calculation time = 2.95 seconds.
- Indicator = Qstick Calculation time = 0.01 seconds.
- Indicator = RangeIndicator Calculation time = 0.18 seconds.
- Indicator = RelativeMomentumIndex Calculation time = 0.3 seconds.
- Indicator = RelativeStrengthIndex Calculation time = 1.06 seconds.
- Indicator = RelativeVolatilityIndex Calculation time = 0.58 seconds.
- Indicator = StandardDeviation Calculation time = 0.01 seconds.
- Indicator = StochasticMomentumIndex Calculation time = 0.02 seconds.
- Indicator = StochasticOscillator (fast) Calculation time = 0.01 seconds.
- Indicator = StochasticOscillator (slow) Calculation time = 0.01 seconds.
- Indicator = SwingIndex Calculation time = 0.02 seconds.
- Indicator = TimeSeriesForecast Calculation time = 2.32 seconds.
- Indicator = TripleExponentialMovingAverage Calculation time = 0.01 seconds.
- Indicator = TypicalPrice Calculation time = 0.0 seconds.
- Indicator = UltimateOscillator Calculation time = 0.02 seconds.
- Indicator = VerticalHorizontalFilter Calculation time = 0.01 seconds.
- Indicator = VolatilityChaikins Calculation time = 0.01 seconds.
- Indicator = VolumeOscillator Calculation time = 0.01 seconds.
- Indicator = VolumeRateOfChange Calculation time = 0.01 seconds.
- Indicator = WeightedClose Calculation time = 0.01 seconds.
- Indicator = WildersSmoothing Calculation time = 0.15 seconds.
- Indicator = WilliamsAccumulationDistribution Calculation time = 0.02 seconds.
- Indicator = WilliamsR Calculation time = 0.01 seconds.
DirectionalMovementIndex optimized and calculation time dropped from 4.58 seconds to 0.47 seconds.
Linear regression optimization (using statsmodels instead of scikit-learn). Below indicators calculations improved:
- ForecastOscillator Calculation time = from 2.37 seconds to 0.28 seconds
- LinearRegressionIndicator Calculation time = from 2.3 seconds to 0.28 seconds
- MovingAverage (time_series) Calculation time = from 2.31 seconds to 0.27 seconds
- TimeSeriesForecast Calculation time = from 2.32 seconds to 0.26 seconds
RelativeStrengthIndex optimized from Calculation time = 1.06 seconds to 0.35 seconds
CommodityChannelIndex optimized from Calculation time = 0.94 seconds to 0.80 seconds
ParabolicSAR optimized from Calculation time = 2.72 seconds to 0.18 seconds.
ProjectionBands optimized from Calculation time = 2.97 seconds to 1.02 seconds
ProjectionOscillator optimized from Calculation time = 2.95 seconds to 1.01 seconds
Regression tests executed after finishing all the code updates:
Ran 1558 tests in 152.756s
OK
91% lines coverage
Updates ready for release (stable release 0.2).