From b5fa2f2406dd55994dd7f4179c05e74049d1b363 Mon Sep 17 00:00:00 2001 From: DongGeon Lee Date: Mon, 6 May 2024 22:51:16 +0900 Subject: [PATCH] docs: Update docs for v1.3.0 (#379) --- docs/_indicators/Adl.md | 2 +- docs/_indicators/Adx.md | 1 + docs/_indicators/Alligator.md | 1 + docs/_indicators/Alma.md | 1 + docs/_indicators/Aroon.md | 1 + docs/_indicators/Atr.md | 1 + docs/_indicators/AtrStop.md | 96 ++++++++++++++++ docs/_indicators/Awesome.md | 1 + docs/_indicators/Beta.md | 1 + docs/_indicators/BollingerBands.md | 1 + docs/_indicators/Bop.md | 1 + docs/_indicators/Cci.md | 1 + docs/_indicators/ChaikinOsc.md | 1 + docs/_indicators/Chandelier.md | 1 + docs/_indicators/Chop.md | 1 + docs/_indicators/Cmf.md | 1 + docs/_indicators/Cmo.md | 75 ++++++++++++ docs/_indicators/ConnorsRsi.md | 1 + docs/_indicators/Correlation.md | 1 + docs/_indicators/Dema.md | 1 + docs/_indicators/Donchian.md | 1 + docs/_indicators/Dpo.md | 2 +- docs/_indicators/Dynamic.md | 84 ++++++++++++++ docs/_indicators/ElderRay.md | 1 + docs/_indicators/Ema.md | 1 + docs/_indicators/Epma.md | 1 + docs/_indicators/Fcb.md | 1 + docs/_indicators/FisherTransform.md | 1 + docs/_indicators/ForceIndex.md | 1 + docs/_indicators/Fractal.md | 1 + docs/_indicators/Gator.md | 1 + docs/_indicators/HeikinAshi.md | 1 - docs/_indicators/Hma.md | 1 + docs/_indicators/HtTrendline.md | 1 + docs/_indicators/Hurst.md | 2 +- docs/_indicators/Ichimoku.md | 1 + docs/_indicators/Kama.md | 1 + docs/_indicators/Keltner.md | 1 + docs/_indicators/Kvo.md | 1 + docs/_indicators/MaEnvelopes.md | 1 + docs/_indicators/Macd.md | 1 + docs/_indicators/Mama.md | 1 + docs/_indicators/Mfi.md | 1 + docs/_indicators/Obv.md | 2 +- docs/_indicators/ParabolicSar.md | 1 + docs/_indicators/Pivots.md | 1 + docs/_indicators/Pmo.md | 1 + docs/_indicators/Prs.md | 1 + docs/_indicators/Pvo.md | 1 + docs/_indicators/Renko.md | 1 - docs/_indicators/Roc.md | 1 + docs/_indicators/Rsi.md | 2 +- docs/_indicators/Slope.md | 1 + docs/_indicators/Sma.md | 1 + docs/_indicators/Smi.md | 1 + docs/_indicators/Smma.md | 1 + docs/_indicators/StarcBands.md | 1 + docs/_indicators/Stc.md | 1 + docs/_indicators/StdDev.md | 1 + docs/_indicators/StdDevChannels.md | 1 + docs/_indicators/Stoch.md | 22 ++-- docs/_indicators/StochRsi.md | 1 + docs/_indicators/SuperTrend.md | 1 + docs/_indicators/T3.md | 1 + docs/_indicators/Tema.md | 1 + docs/_indicators/Trix.md | 1 + docs/_indicators/Tsi.md | 1 + docs/_indicators/UlcerIndex.md | 1 + docs/_indicators/Ultimate.md | 1 + docs/_indicators/VolatilityStop.md | 1 + docs/_indicators/Vortex.md | 1 + docs/_indicators/Vwap.md | 1 + docs/_indicators/Vwma.md | 1 + docs/_indicators/WilliamsR.md | 1 + docs/_indicators/Wma.md | 1 + docs/_indicators/ZigZag.md | 1 + docs/pages/performance.md | 107 ++++++++++++++++++ docs/pages/utilities.md | 6 +- stock_indicators/indicators/common/candles.py | 2 +- 79 files changed, 447 insertions(+), 22 deletions(-) create mode 100644 docs/_indicators/AtrStop.md create mode 100644 docs/_indicators/Cmo.md create mode 100644 docs/_indicators/Dynamic.md diff --git a/docs/_indicators/Adl.md b/docs/_indicators/Adl.md index 476baed1..cb856838 100644 --- a/docs/_indicators/Adl.md +++ b/docs/_indicators/Adl.md @@ -47,7 +47,7 @@ ADLResults[ADLResult] ### Utilities -- ~~[.to_quotes()]({{site.baseurl}}/utilities#convert-to-quotes)~~ [deprecated] +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Adx.md b/docs/_indicators/Adx.md index e53fd725..bf1c147a 100644 --- a/docs/_indicators/Adx.md +++ b/docs/_indicators/Adx.md @@ -48,6 +48,7 @@ ADXResults[ADXResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Alligator.md b/docs/_indicators/Alligator.md index d850aa1b..39447ffe 100644 --- a/docs/_indicators/Alligator.md +++ b/docs/_indicators/Alligator.md @@ -52,6 +52,7 @@ AlligatorResults[AlligatorResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Alma.md b/docs/_indicators/Alma.md index 090214b2..10b46291 100644 --- a/docs/_indicators/Alma.md +++ b/docs/_indicators/Alma.md @@ -45,6 +45,7 @@ ALMAResults[ALMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Aroon.md b/docs/_indicators/Aroon.md index 17c561bc..a2ea408c 100644 --- a/docs/_indicators/Aroon.md +++ b/docs/_indicators/Aroon.md @@ -45,6 +45,7 @@ AroonResults[AroonResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Atr.md b/docs/_indicators/Atr.md index 385f55c0..ffcda96f 100644 --- a/docs/_indicators/Atr.md +++ b/docs/_indicators/Atr.md @@ -52,6 +52,7 @@ ATRResults[ATRResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/AtrStop.md b/docs/_indicators/AtrStop.md new file mode 100644 index 00000000..bcd6979e --- /dev/null +++ b/docs/_indicators/AtrStop.md @@ -0,0 +1,96 @@ +--- +title: ATR Trailing Stop +description: Created by Welles Wilder, the ATR Trailing Stop indicator attempts to determine the primary trend of financial market prices by using Average True Range (ATR) band thresholds. It can indicate a buy/sell signal or a trailing stop when the trend changes. +permalink: /indicators/AtrStop/ +type: price-trend +layout: indicator +--- + +# {{ page.title }} + +>**get_atr_stop**(*quotes, lookback_periods=21, multiplier=3, end_type=EndType.CLOSE*) + +## Parameters + +| name | type | notes +| -- |-- |-- +| `quotes` | Iterable[Quote] | Iterable of the [Quote class]({{site.baseurl}}/guide/#historical-quotes) or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes).
• [See here]({{site.baseurl}}/guide/#using-pandasdataframe) for usage with pandas.DataFrame +| `lookback_periods` | int, *default 21* | Number of periods (`N`) for the ATR evaluation. Must be greater than 1. +| `multiplier` | float, *default 3* | Multiplier sets the ATR band width. Must be greater than 0 and is usually set around 2 to 3. +| `end_type` | EndType, *default EndType.Close* | Determines whether `Close` or `High/Low` is used as basis for stop offset. See [EndType options](#endtype-options) below. + +### Historical quotes requirements + +You must have at least `N+100` periods of `quotes` to cover the convergence periods. Since this uses a smoothing technique, we recommend you use at least `N+250` periods prior to the intended usage date for optimal precision. + +`quotes` is an `Iterable[Quote]` collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See [the Guide]({{site.baseurl}}/guide/#historical-quotes) for more information. + +### EndType options + +```python +from stock_indicators.indicators.common.enums import EndType +``` + +| type | description +|-- |-- +| `CLOSE` | Stop offset from `Close` price (default) +| `HIGH_LOW` | Stop offset from `High` or `Low` price + +## Returns + +```python +AtrStopResults[AtrStopResult] +``` + +- This method returns a time series of all available indicator values for the `quotes` provided. +- `AtrStopResults` is just a list of `AtrStopResult`. +- It always returns the same number of elements as there are in the historical quotes. +- It does not return a single incremental indicator value. +- The first `N` periods will have `None` AtrStop values since there's not enough data to calculate. + +>⚞ **Convergence warning**: the line segment before the first reversal and the first `N+100` periods are unreliable due to an initial guess of trend direction and precision convergence for the underlying ATR values. + +### AtrStopResult + +| name | type | notes +| -- |-- |-- +| `date` | datetime | Date +| `atr_stop` | Decimal, Optional | ATR Trailing Stop line contains both Upper and Lower segments +| `buy_stop` | Decimal, Optional | Upper band only (green) +| `sell_stop` | Decimal, Optional | Lower band only (red) + +`buy_stop` and `sell_stop` values are provided to differentiate buy vs sell stop lines and to clearly demark trend reversal. `atr_stop` is the contiguous combination of both upper and lower line data. + +### Utilities + +- [.condense()]({{site.baseurl}}/utilities#condense) +- [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) +- [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) + +See [Utilities and Helpers]({{site.baseurl}}/utilities#utilities-for-indicator-results) for more information. + +## Example + +```python +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_historical_quotes("SPY") + +# calculate 21-period ATR Stop +results = indicators.get_atr_stop(quotes) +``` + +## About {{ page.title }} + +Created by Welles Wilder, the ATR Trailing Stop indicator attempts to determine the primary trend of Close prices by using [Average True Range (ATR)]({{site.baseurl}}/indicators/Atr/#content) band thresholds. It can indicate a buy/sell signal or a trailing stop when the trend changes. +[[Discuss] 💬]({{site.dotnet.repo}}/discussions/724 "Community discussion about this indicator") + +![chart for {{page.title}}]({{site.dotnet.charts}}/AtrStop.png) + + +### Sources + +- [C# core]({{site.dotnet.src}}/a-d/AtrStop/AtrStop.Series.cs) +- [Python wrapper]({{site.python.src}}/atr_stop.py) diff --git a/docs/_indicators/Awesome.md b/docs/_indicators/Awesome.md index ea1a363c..cad32bc4 100644 --- a/docs/_indicators/Awesome.md +++ b/docs/_indicators/Awesome.md @@ -46,6 +46,7 @@ AwesomeResults[AwesomeResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Beta.md b/docs/_indicators/Beta.md index c49489f9..5d4e56d7 100644 --- a/docs/_indicators/Beta.md +++ b/docs/_indicators/Beta.md @@ -63,6 +63,7 @@ BetaResults[BetaResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/BollingerBands.md b/docs/_indicators/BollingerBands.md index 3f3f8edc..b07d8251 100644 --- a/docs/_indicators/BollingerBands.md +++ b/docs/_indicators/BollingerBands.md @@ -49,6 +49,7 @@ BollingerBandsResults[BollingerBandsResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Bop.md b/docs/_indicators/Bop.md index 0137f434..b25a6f78 100644 --- a/docs/_indicators/Bop.md +++ b/docs/_indicators/Bop.md @@ -44,6 +44,7 @@ BOPResults[BOPResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Cci.md b/docs/_indicators/Cci.md index da51ec9b..1755bc46 100644 --- a/docs/_indicators/Cci.md +++ b/docs/_indicators/Cci.md @@ -43,6 +43,7 @@ CCIResults[CCIResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/ChaikinOsc.md b/docs/_indicators/ChaikinOsc.md index 0f757cef..819bdce7 100644 --- a/docs/_indicators/ChaikinOsc.md +++ b/docs/_indicators/ChaikinOsc.md @@ -51,6 +51,7 @@ ChaikinOscResults[ChaikinOscResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Chandelier.md b/docs/_indicators/Chandelier.md index b2530698..2b724ac0 100644 --- a/docs/_indicators/Chandelier.md +++ b/docs/_indicators/Chandelier.md @@ -56,6 +56,7 @@ ChandelierResults[ChandelierResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Chop.md b/docs/_indicators/Chop.md index 88afbef2..ee810939 100644 --- a/docs/_indicators/Chop.md +++ b/docs/_indicators/Chop.md @@ -43,6 +43,7 @@ ChopResults[ChopResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Cmf.md b/docs/_indicators/Cmf.md index 4a90c24c..beb428db 100644 --- a/docs/_indicators/Cmf.md +++ b/docs/_indicators/Cmf.md @@ -47,6 +47,7 @@ CMFResults[CMFResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Cmo.md b/docs/_indicators/Cmo.md new file mode 100644 index 00000000..2f89003c --- /dev/null +++ b/docs/_indicators/Cmo.md @@ -0,0 +1,75 @@ +--- +title: Chande Momentum Oscillator (CMO) +description: The Chande Momentum Oscillator is a momentum indicator depicting the weighted percent of higher prices in financial markets. +permalink: /indicators/Cmo/ +type: oscillator +layout: indicator +--- + +# {{ page.title }} + +>**get_cmo**(*quotes, lookback_periods*) + +## Parameters + +| name | type | notes +| -- | -- | -- +| `quotes` | Iterable[Quote] | Iterable of the [Quote class]({{site.baseurl}}/guide/#historical-quotes) or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes).
• [See here]({{site.baseurl}}/guide/#using-pandasdataframe) for usage with pandas.DataFrame +| `lookback_periods` | int | Number of periods (`N`) in the lookback window. Must be greater than 0. + +### Historical quotes requirements + +You must have at least `N+1` periods of `quotes` to cover the warmup periods. + +`quotes` is an `Iterable[Quote]` collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See [the Guide]({{site.baseurl}}/guide/#historical-quotes) for more information. + +## Returns + +```python +CMOResults[CMOResult] +``` + +- This method returns a time series of all available indicator values for the `quotes` provided. +- `CMOResults` is just a list of `CMOResult`. +- It always returns the same number of elements as there are in the historical quotes. +- It does not return a single incremental indicator value. +- The first `N` periods will have `None` values for CMO since there's not enough data to calculate. + +### CmoResult + +| name | type | notes +| -- |-- |-- +| `date` | datetime | Date +| `cmo` | float, Optional | Chande Momentum Oscillator + +### Utilities + +- [.condense()]({{site.baseurl}}/utilities#condense) +- [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) +- [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) + +See [Utilities and Helpers]({{site.baseurl}}/utilities#utilities-for-indicator-results) for more information. + +## Example + +```python +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_historical_quotes("SPY") + +results = indicators.get_cmo(quotes, lookback_periods) +``` + +## About {{ page.title }} + +Created by Tushar Chande, the [Chande Momentum Oscillator](https://www.investopedia.com/terms/c/chandemomentumoscillator.asp) is a weighted percent of higher prices over a lookback window. +[[Discuss] 💬]({{site.dotnet.repo}}/discussions/892 "Community discussion about this indicator") + +![chart for {{page.title}}]({{site.dotnet.charts}}/Cmo.png) + +### Sources + +- [C# core]({{site.dotnet.src}}/a-d/Cmo/Cmo.Series.cs) +- [Python wrapper]({{site.python.src}}/cmo.py) diff --git a/docs/_indicators/ConnorsRsi.md b/docs/_indicators/ConnorsRsi.md index 3f4c14c8..765b3c65 100644 --- a/docs/_indicators/ConnorsRsi.md +++ b/docs/_indicators/ConnorsRsi.md @@ -50,6 +50,7 @@ ConnorsRSIResults[ConnorsRSIResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Correlation.md b/docs/_indicators/Correlation.md index 0e36f3d5..5a8517c8 100644 --- a/docs/_indicators/Correlation.md +++ b/docs/_indicators/Correlation.md @@ -49,6 +49,7 @@ CorrelationResults[CorrelationResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Dema.md b/docs/_indicators/Dema.md index 627521ab..d821be53 100644 --- a/docs/_indicators/Dema.md +++ b/docs/_indicators/Dema.md @@ -45,6 +45,7 @@ DEMAResults[DEMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Donchian.md b/docs/_indicators/Donchian.md index 865e4381..63d498c2 100644 --- a/docs/_indicators/Donchian.md +++ b/docs/_indicators/Donchian.md @@ -47,6 +47,7 @@ DonchianResults[DonchianResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Dpo.md b/docs/_indicators/Dpo.md index 23372889..9981a176 100644 --- a/docs/_indicators/Dpo.md +++ b/docs/_indicators/Dpo.md @@ -44,7 +44,7 @@ DPOResults[DPOResult] ### Utilities -- ~~[.to_quotes()]({{site.baseurl}}/utilities#convert-to-quotes)~~ [deprecated] +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Dynamic.md b/docs/_indicators/Dynamic.md new file mode 100644 index 00000000..44bb7499 --- /dev/null +++ b/docs/_indicators/Dynamic.md @@ -0,0 +1,84 @@ +--- +title: McGinley Dynamic +description: Created by John R. McGinley, the McGinley Dynamic is a more responsive variant of exponential moving average. +permalink: /indicators/Dynamic/ +type: moving-average +layout: indicator +--- + +# {{ page.title }} + +>**get_dynamic**(*quotes, lookback_periods, k_factor=0.6*) + +## Parameters + +| name | type | notes +| -- |-- |-- +| `quotes` | Iterable[Quote] | Iterable of the [Quote class]({{site.baseurl}}/guide/#historical-quotes) or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes).
• [See here]({{site.baseurl}}/guide/#using-pandasdataframe) for usage with pandas.DataFrame +| `lookback_periods` | int | Number of periods (`N`) in the moving average. Must be greater than 0. +| `k_factor` | float, *default 0.6* | Range adjustment factor (`K`). Must be greater than 0. + +### Historical quotes requirements + +You must have at least `2` periods of `quotes`, to cover the initialization periods. Since this uses a smoothing technique, we recommend you use at least `4×N` data points prior to the intended usage date for better precision. + +`quotes` is an `Iterable[Quote]` collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See [the Guide]({{site.baseurl}}/guide/#historical-quotes) for more information. + +### Pro tips + +> Use a `k_factor` value of `1` if you do not want to adjust the `N` value. +> +> McGinley suggests that using a `K` value of 60% (0.6) allows you to use a `N` equivalent to other moving averages. For example, DYNAMIC(20,0.6) is comparable to EMA(20); conversely, DYNAMIC(20,1) uses the raw 1:1 `N` value and is not equivalent. + +## Returns + +```python +DynamicResults[DynamicResult] +``` + +- This method returns a time series of all available indicator values for the `quotes` provided. +- `DynamicResults` is just a list of `DynamicResult`. +- It always returns the same number of elements as there are in the historical quotes. +- It does not return a single incremental indicator value. +- The first period will have a `None` value since there's not enough data to calculate. + +>⚞ **Convergence warning**: The first `4×N` periods will have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods. + +### DynamicResult + +| name | type | notes +| -- |-- |-- +| `date` | datetime | Date +| `dynamic` | float, Optional | McGinley Dynamic + +### Utilities + +- [.condense()]({{site.baseurl}}/utilities#condense) +- [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) +- [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) + +See [Utilities and Helpers]({{site.baseurl}}/utilities#utilities-for-indicator-results) for more information. + +## Example + +```python +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_historical_quotes("SPY") + +# calculate 14-period McGinley Dynamic +results = indicators.get_dynamic(quotes, 14) +``` + +## About {{ page.title }} + +Created by John R. McGinley, the [McGinley Dynamic](https://www.investopedia.com/terms/m/mcginley-dynamic.asp) is a more responsive variant of exponential moving average. +[[Discuss] 💬]({{site.dotnet.repo}}/discussions/866 "Community discussion about this indicator") + +![chart for {{page.title}}]({{site.dotnet.charts}}/Dynamic.png) + +### Sources + +- [C# core]({{site.dotnet.src}}/a-d/Dynamic/Dynamic.Series.cs) +- [Python wrapper]({{site.python.src}}/dynamic.py) diff --git a/docs/_indicators/ElderRay.md b/docs/_indicators/ElderRay.md index fb6156fb..8cd509db 100644 --- a/docs/_indicators/ElderRay.md +++ b/docs/_indicators/ElderRay.md @@ -48,6 +48,7 @@ ElderRayResults[ElderRayResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Ema.md b/docs/_indicators/Ema.md index 3dfdd9fa..f58dbe23 100644 --- a/docs/_indicators/Ema.md +++ b/docs/_indicators/Ema.md @@ -48,6 +48,7 @@ EMAResults[EMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Epma.md b/docs/_indicators/Epma.md index 7f9c5c20..fc464b62 100644 --- a/docs/_indicators/Epma.md +++ b/docs/_indicators/Epma.md @@ -44,6 +44,7 @@ EPMAResults[EPMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Fcb.md b/docs/_indicators/Fcb.md index 429de331..a86ea693 100644 --- a/docs/_indicators/Fcb.md +++ b/docs/_indicators/Fcb.md @@ -46,6 +46,7 @@ FCBResults[FCBResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/FisherTransform.md b/docs/_indicators/FisherTransform.md index 02a11313..ed689108 100644 --- a/docs/_indicators/FisherTransform.md +++ b/docs/_indicators/FisherTransform.md @@ -45,6 +45,7 @@ FisherTransformResults[FisherTransformResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/ForceIndex.md b/docs/_indicators/ForceIndex.md index b17075bd..1290c21a 100644 --- a/docs/_indicators/ForceIndex.md +++ b/docs/_indicators/ForceIndex.md @@ -45,6 +45,7 @@ ForceIndexResults[ForceIndexResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Fractal.md b/docs/_indicators/Fractal.md index 0d654f5a..f18229ef 100644 --- a/docs/_indicators/Fractal.md +++ b/docs/_indicators/Fractal.md @@ -64,6 +64,7 @@ FractalResults[FractalResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Gator.md b/docs/_indicators/Gator.md index ed1aa5ff..fc97c358 100644 --- a/docs/_indicators/Gator.md +++ b/docs/_indicators/Gator.md @@ -49,6 +49,7 @@ GatorResults[GatorResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/HeikinAshi.md b/docs/_indicators/HeikinAshi.md index 055301b4..f3112ad0 100644 --- a/docs/_indicators/HeikinAshi.md +++ b/docs/_indicators/HeikinAshi.md @@ -45,7 +45,6 @@ HeikinAshiResults[HeikinAshiResult] ### Utilities -- ~~[.to_quotes()]({{site.baseurl}}/utilities#convert-to-quotes)~~ [deprecated] - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Hma.md b/docs/_indicators/Hma.md index af231076..f5fa5c29 100644 --- a/docs/_indicators/Hma.md +++ b/docs/_indicators/Hma.md @@ -43,6 +43,7 @@ HMAResults[HMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/HtTrendline.md b/docs/_indicators/HtTrendline.md index 1520bb78..11a3aa6f 100644 --- a/docs/_indicators/HtTrendline.md +++ b/docs/_indicators/HtTrendline.md @@ -47,6 +47,7 @@ HTTrendlineResults[HTTrendlineResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Hurst.md b/docs/_indicators/Hurst.md index 9a4cfdf2..65f19d0e 100644 --- a/docs/_indicators/Hurst.md +++ b/docs/_indicators/Hurst.md @@ -44,7 +44,7 @@ HurstResults[HurstResult] ### Utilities -- ~~[.to_quotes()]({{site.baseurl}}/utilities#convert-to-quotes)~~ [deprecated] +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Ichimoku.md b/docs/_indicators/Ichimoku.md index 44bee6e6..aa57d840 100644 --- a/docs/_indicators/Ichimoku.md +++ b/docs/_indicators/Ichimoku.md @@ -62,6 +62,7 @@ IchimokuResults[IchimokuResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Kama.md b/docs/_indicators/Kama.md index 2ebac9e6..7e931382 100644 --- a/docs/_indicators/Kama.md +++ b/docs/_indicators/Kama.md @@ -50,6 +50,7 @@ More about Efficiency Ratio(ER): ER fluctuates between 0 and 1, but these extrem ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Keltner.md b/docs/_indicators/Keltner.md index d90e3280..520cda4a 100644 --- a/docs/_indicators/Keltner.md +++ b/docs/_indicators/Keltner.md @@ -50,6 +50,7 @@ KeltnerResults[KeltnerResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Kvo.md b/docs/_indicators/Kvo.md index 15b2765f..3d9f4c08 100644 --- a/docs/_indicators/Kvo.md +++ b/docs/_indicators/Kvo.md @@ -48,6 +48,7 @@ KVOResults[KVOResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/MaEnvelopes.md b/docs/_indicators/MaEnvelopes.md index 87098fc3..de3eb1bd 100644 --- a/docs/_indicators/MaEnvelopes.md +++ b/docs/_indicators/MaEnvelopes.md @@ -71,6 +71,7 @@ The moving average `center_line` is based on the `ma_type` type specified. ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Macd.md b/docs/_indicators/Macd.md index 43f6b869..be7d8be9 100644 --- a/docs/_indicators/Macd.md +++ b/docs/_indicators/Macd.md @@ -54,6 +54,7 @@ MACDResults[MACDResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Mama.md b/docs/_indicators/Mama.md index a7ea0fe5..7ff77972 100644 --- a/docs/_indicators/Mama.md +++ b/docs/_indicators/Mama.md @@ -47,6 +47,7 @@ MAMAResults[MAMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Mfi.md b/docs/_indicators/Mfi.md index 40ca131f..1593731d 100644 --- a/docs/_indicators/Mfi.md +++ b/docs/_indicators/Mfi.md @@ -43,6 +43,7 @@ MFIResults[MFIResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Obv.md b/docs/_indicators/Obv.md index 7acb681d..d7d08756 100644 --- a/docs/_indicators/Obv.md +++ b/docs/_indicators/Obv.md @@ -46,7 +46,7 @@ OBVResults[OBVResult] ### Utilities -- ~~[.to_quotes()]({{site.baseurl}}/utilities#convert-to-quotes)~~ [deprecated] +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/ParabolicSar.md b/docs/_indicators/ParabolicSar.md index d8844c88..da8c3ce6 100644 --- a/docs/_indicators/ParabolicSar.md +++ b/docs/_indicators/ParabolicSar.md @@ -50,6 +50,7 @@ ParabolicSARResults[ParabolicSARResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Pivots.md b/docs/_indicators/Pivots.md index a6efdeef..5aeb216b 100644 --- a/docs/_indicators/Pivots.md +++ b/docs/_indicators/Pivots.md @@ -79,6 +79,7 @@ from stock_indicators.indicators.common.enums import PivotTrend ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Pmo.md b/docs/_indicators/Pmo.md index a0f4bdf7..0a478001 100644 --- a/docs/_indicators/Pmo.md +++ b/docs/_indicators/Pmo.md @@ -46,6 +46,7 @@ PMOResults[PMOResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Prs.md b/docs/_indicators/Prs.md index 66454ab4..8ace48c5 100644 --- a/docs/_indicators/Prs.md +++ b/docs/_indicators/Prs.md @@ -47,6 +47,7 @@ PRSResults[PRSResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Pvo.md b/docs/_indicators/Pvo.md index f35bdcb0..33644e1f 100644 --- a/docs/_indicators/Pvo.md +++ b/docs/_indicators/Pvo.md @@ -49,6 +49,7 @@ PVOResults[PVOResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Renko.md b/docs/_indicators/Renko.md index cf10835a..adaab760 100644 --- a/docs/_indicators/Renko.md +++ b/docs/_indicators/Renko.md @@ -64,7 +64,6 @@ Each result record represents one Renko brick. ### Utilities -- ~~[.to_quotes()]({{site.baseurl}}/utilities#convert-to-quotes)~~ [deprecated] - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Roc.md b/docs/_indicators/Roc.md index b3dc1557..b61438cb 100644 --- a/docs/_indicators/Roc.md +++ b/docs/_indicators/Roc.md @@ -47,6 +47,7 @@ ROCResults[ROCResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Rsi.md b/docs/_indicators/Rsi.md index c2ac9310..38ccfab7 100644 --- a/docs/_indicators/Rsi.md +++ b/docs/_indicators/Rsi.md @@ -45,7 +45,7 @@ RSIResults[RSIResult] ### Utilities -- ~~[.to_quotes()]({{site.baseurl}}/utilities#convert-to-quotes)~~ [deprecated] +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Slope.md b/docs/_indicators/Slope.md index 98b0491b..eed0902c 100644 --- a/docs/_indicators/Slope.md +++ b/docs/_indicators/Slope.md @@ -49,6 +49,7 @@ SlopeResults[SlopeResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Sma.md b/docs/_indicators/Sma.md index e4644ee5..46e3b23f 100644 --- a/docs/_indicators/Sma.md +++ b/docs/_indicators/Sma.md @@ -46,6 +46,7 @@ SMAResults[SMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Smi.md b/docs/_indicators/Smi.md index 5b81c528..e908fab4 100644 --- a/docs/_indicators/Smi.md +++ b/docs/_indicators/Smi.md @@ -49,6 +49,7 @@ SMIResults[SMIResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Smma.md b/docs/_indicators/Smma.md index 79dbba1e..c920fe4b 100644 --- a/docs/_indicators/Smma.md +++ b/docs/_indicators/Smma.md @@ -46,6 +46,7 @@ SMMAResults[SMMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/StarcBands.md b/docs/_indicators/StarcBands.md index e9be64db..91e3612a 100644 --- a/docs/_indicators/StarcBands.md +++ b/docs/_indicators/StarcBands.md @@ -49,6 +49,7 @@ STARCBandsResults[STARCBandsResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Stc.md b/docs/_indicators/Stc.md index 70932dee..b1e2a669 100644 --- a/docs/_indicators/Stc.md +++ b/docs/_indicators/Stc.md @@ -47,6 +47,7 @@ STCResults[STCResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/StdDev.md b/docs/_indicators/StdDev.md index ab4b6e32..e23fe9f2 100644 --- a/docs/_indicators/StdDev.md +++ b/docs/_indicators/StdDev.md @@ -48,6 +48,7 @@ StdevResults[StdevResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/StdDevChannels.md b/docs/_indicators/StdDevChannels.md index 28c200fb..36e27a17 100644 --- a/docs/_indicators/StdDevChannels.md +++ b/docs/_indicators/StdDevChannels.md @@ -49,6 +49,7 @@ StdevChannelsResults[StdevChannelsResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Stoch.md b/docs/_indicators/Stoch.md index d7ed8ef5..92f4080c 100644 --- a/docs/_indicators/Stoch.md +++ b/docs/_indicators/Stoch.md @@ -8,7 +8,7 @@ layout: indicator # {{ page.title }} ->**get_stoch**(*quotes, lookback_periods=14, signal_periods=3, smooth_periods=3*) +>**get_stoch**(*quotes, lookback_periods=14, signal_periods=3, smooth_periods=3, k_factor=3, d_factor=2, ma_type=MAType.SMA*) ## Parameters @@ -18,10 +18,9 @@ layout: indicator | `lookback_periods` | int, *default 14* | Lookback period (`N`) for the oscillator (%K). Must be greater than 0. | `signal_periods` | int, *default 3* | Smoothing period for the signal (%D). Must be greater than 0. | `smooth_periods` | int, *default 3* | Smoothing period (`S`) for the Oscillator (%K). "Slow" stochastic uses 3, "Fast" stochastic uses 1. Must be greater than 0. - - +| `k_factor` | int, *default 3* | Weight of %K in the %J calculation. Must be greater than 0. +| `d_factor` | int, *default 2* | Weight of %D in the %J calculation. Must be greater than 0. +| `ma_type` | MAType, *default MAType.SMA* | Type of moving average (SMA or SMMA) used for smoothing. See [MAType options](#matype-options) below. ### Historical quotes requirements @@ -29,14 +28,16 @@ You must have at least `N+S` periods of `quotes` to cover the warmup periods. `quotes` is an `Iterable[Quote]` collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See [the Guide]({{site.baseurl}}/guide/#historical-quotes) for more information. - +| `MAType.SMA` | [Simple Moving Average]({{site.baseurl}}/indicators/Sma#content) (default) +| `MAType.SMMA` | [Smoothed Moving Average]({{site.baseurl}}/indicators/Smma#content) ## Returns @@ -50,7 +51,7 @@ StochResults[StochResult] - It does not return a single incremental indicator value. - The first `N+S-2` periods will have `None` Oscillator values since there's not enough data to calculate. - +>⚞ **Convergence warning**: The first `N+100` periods will have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods when using `MAType.SMMA`. Standard use of `MAType.SMA` does not have convergence-related precision errors. ### StochResult @@ -65,6 +66,7 @@ Note: aliases of `k`, `d`, and `j` are also provided. They can be used intercha ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/StochRsi.md b/docs/_indicators/StochRsi.md index 62fe793f..5fb07b97 100644 --- a/docs/_indicators/StochRsi.md +++ b/docs/_indicators/StochRsi.md @@ -51,6 +51,7 @@ StochRSIResults[StochRSIResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/SuperTrend.md b/docs/_indicators/SuperTrend.md index d447c0c8..d0f8b53e 100644 --- a/docs/_indicators/SuperTrend.md +++ b/docs/_indicators/SuperTrend.md @@ -50,6 +50,7 @@ SuperTrendResults[SuperTrendResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/T3.md b/docs/_indicators/T3.md index 7b3a63ac..5dc830e2 100644 --- a/docs/_indicators/T3.md +++ b/docs/_indicators/T3.md @@ -46,6 +46,7 @@ T3Results[T3Result] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Tema.md b/docs/_indicators/Tema.md index 54ca5ee3..94d1e9d3 100644 --- a/docs/_indicators/Tema.md +++ b/docs/_indicators/Tema.md @@ -45,6 +45,7 @@ TEMAResults[TEMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Trix.md b/docs/_indicators/Trix.md index 8eae082a..dc2a9c5c 100644 --- a/docs/_indicators/Trix.md +++ b/docs/_indicators/Trix.md @@ -48,6 +48,7 @@ TRIXResults[TRIXResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Tsi.md b/docs/_indicators/Tsi.md index ce5f4a3e..23191303 100644 --- a/docs/_indicators/Tsi.md +++ b/docs/_indicators/Tsi.md @@ -49,6 +49,7 @@ TSIResults[TSIResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/UlcerIndex.md b/docs/_indicators/UlcerIndex.md index 48758667..d70acc17 100644 --- a/docs/_indicators/UlcerIndex.md +++ b/docs/_indicators/UlcerIndex.md @@ -43,6 +43,7 @@ UlcerIndexResults[UlcerIndexResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Ultimate.md b/docs/_indicators/Ultimate.md index 3f1f3c69..bd50fa42 100644 --- a/docs/_indicators/Ultimate.md +++ b/docs/_indicators/Ultimate.md @@ -45,6 +45,7 @@ UltimateResults[UltimateResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/VolatilityStop.md b/docs/_indicators/VolatilityStop.md index 1f4db609..3e9e53d5 100644 --- a/docs/_indicators/VolatilityStop.md +++ b/docs/_indicators/VolatilityStop.md @@ -51,6 +51,7 @@ VolatilityStopResults[VolatilityStopResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Vortex.md b/docs/_indicators/Vortex.md index ac36cbde..51660391 100644 --- a/docs/_indicators/Vortex.md +++ b/docs/_indicators/Vortex.md @@ -44,6 +44,7 @@ VortexResults[VortexResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Vwap.md b/docs/_indicators/Vwap.md index 836051ee..4cf40dde 100644 --- a/docs/_indicators/Vwap.md +++ b/docs/_indicators/Vwap.md @@ -47,6 +47,7 @@ VWAPResults[VWAPResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Vwma.md b/docs/_indicators/Vwma.md index d111dfdc..a41aa74a 100644 --- a/docs/_indicators/Vwma.md +++ b/docs/_indicators/Vwma.md @@ -43,6 +43,7 @@ VWMAResults[VWMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/WilliamsR.md b/docs/_indicators/WilliamsR.md index 84d7eac5..dc077af6 100644 --- a/docs/_indicators/WilliamsR.md +++ b/docs/_indicators/WilliamsR.md @@ -43,6 +43,7 @@ WilliamsResults[WilliamsResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/Wma.md b/docs/_indicators/Wma.md index 808610c2..dab6eb0c 100644 --- a/docs/_indicators/Wma.md +++ b/docs/_indicators/Wma.md @@ -46,6 +46,7 @@ WMAResults[WMAResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/_indicators/ZigZag.md b/docs/_indicators/ZigZag.md index 88fff92e..82000c9b 100644 --- a/docs/_indicators/ZigZag.md +++ b/docs/_indicators/ZigZag.md @@ -64,6 +64,7 @@ ZigZagResults[ZigZagResult] ### Utilities +- [.condense()]({{site.baseurl}}/utilities#condense) - [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) - [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) diff --git a/docs/pages/performance.md b/docs/pages/performance.md index 8beffa74..ababb42f 100644 --- a/docs/pages/performance.md +++ b/docs/pages/performance.md @@ -7,6 +7,113 @@ noindex: true sitemap: false --- +# {{ page.title }} for v1.3.0 + +These are the execution times for the current indicators using two years of historical daily stock quotes (502 periods) with default or typical parameters. + +``` bash +pytest=v7.4.3, pytest-benchmark=v4.0.0 OS=macOS Sonoma 14.1.2 +Apple M1, 8 cores, MacBook Air (2020) +.NET 8 +``` + +## Indicators + +```bash +--------------------------------------------------------------------------------------- benchmark: 82 tests ---------------------------------------------------------------------------------------- +Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +test_benchmark_renko 1.2585 (1.0) 7.1339 (2.08) 1.4255 (1.0) 0.6497 (3.04) 1.2972 (1.0) 0.0320 (1.02) 4;31 701.5283 (1.0) 202 1 +test_benchmark_obv 1.7588 (1.40) 8.1598 (2.38) 1.9686 (1.38) 0.7293 (3.41) 1.8420 (1.42) 0.0725 (2.31) 3;39 507.9661 (0.72) 226 1 +test_benchmark_tsi 1.7689 (1.41) 8.2460 (2.40) 1.9641 (1.38) 0.6134 (2.87) 1.8590 (1.43) 0.0635 (2.02) 3;38 509.1439 (0.73) 222 1 +test_benchmark_dynamic 1.7696 (1.41) 7.6489 (2.23) 1.9724 (1.38) 0.6662 (3.11) 1.8505 (1.43) 0.0585 (1.86) 4;39 506.9985 (0.72) 250 1 +test_benchmark_smma 1.7726 (1.41) 8.1047 (2.36) 1.9092 (1.34) 0.5630 (2.63) 1.8197 (1.40) 0.0559 (1.78) 3;38 523.7885 (0.75) 252 1 +test_benchmark_roc 1.7737 (1.41) 8.9954 (2.62) 1.9591 (1.37) 0.7754 (3.63) 1.8248 (1.41) 0.0651 (2.07) 6;45 510.4417 (0.73) 301 1 +test_benchmark_t3 1.7775 (1.41) 11.7603 (3.43) 2.1454 (1.51) 0.8088 (3.78) 2.0509 (1.58) 0.2591 (8.25) 2;11 466.1120 (0.66) 214 1 +test_benchmark_kvo 1.7781 (1.41) 7.9855 (2.33) 1.9980 (1.40) 0.6448 (3.02) 1.8855 (1.45) 0.0411 (1.31) 4;47 500.5057 (0.71) 184 1 +test_benchmark_rsi 1.7793 (1.41) 8.4612 (2.47) 1.9653 (1.38) 0.7093 (3.32) 1.8206 (1.40) 0.1379 (4.39) 4;23 508.8401 (0.73) 324 1 +test_benchmark_vwap 1.7795 (1.41) 8.6102 (2.51) 2.0152 (1.41) 0.7644 (3.57) 1.9038 (1.47) 0.0697 (2.22) 4;33 496.2174 (0.71) 225 1 +test_benchmark_dema 1.7803 (1.41) 9.0687 (2.64) 2.0809 (1.46) 0.8071 (3.77) 1.9528 (1.51) 0.1468 (4.68) 6;28 480.5682 (0.69) 220 1 +test_benchmark_vwma 1.7822 (1.42) 8.4545 (2.47) 1.9997 (1.40) 0.6480 (3.03) 1.8940 (1.46) 0.0638 (2.03) 5;38 500.0852 (0.71) 227 1 +test_benchmark_ma_envelopes 1.7860 (1.42) 12.0710 (3.52) 2.1361 (1.50) 1.0476 (4.90) 1.9309 (1.49) 0.3045 (9.70) 4;13 468.1368 (0.67) 209 1 +test_benchmark_pvo 1.7862 (1.42) 8.8010 (2.57) 1.9974 (1.40) 0.6403 (2.99) 1.8909 (1.46) 0.0469 (1.49) 3;60 500.6452 (0.71) 218 1 +test_benchmark_elder_ray 1.7877 (1.42) 8.8606 (2.58) 2.0410 (1.43) 0.7771 (3.63) 1.8890 (1.46) 0.1293 (4.12) 3;27 489.9447 (0.70) 201 1 +test_benchmark_triple_ema 1.7881 (1.42) 9.9722 (2.91) 2.0434 (1.43) 0.8185 (3.83) 1.9260 (1.48) 0.0593 (1.89) 3;48 489.3781 (0.70) 224 1 +test_benchmark_kama 1.7882 (1.42) 7.9429 (2.32) 1.9896 (1.40) 0.7282 (3.40) 1.8300 (1.41) 0.0488 (1.55) 5;41 502.6232 (0.72) 225 1 +test_benchmark_slope 1.7936 (1.43) 8.1865 (2.39) 1.9765 (1.39) 0.6715 (3.14) 1.8535 (1.43) 0.0648 (2.06) 4;31 505.9492 (0.72) 197 1 +test_benchmark_fisher_transform 1.7963 (1.43) 9.7324 (2.84) 2.1592 (1.51) 0.9010 (4.21) 1.9242 (1.48) 0.2668 (8.50) 8;13 463.1421 (0.66) 184 1 +test_benchmark_stdev 1.7971 (1.43) 8.2240 (2.40) 2.0152 (1.41) 0.7060 (3.30) 1.8638 (1.44) 0.0643 (2.05) 4;32 496.2408 (0.71) 184 1 +test_benchmark_cci 1.7976 (1.43) 7.7434 (2.26) 2.0109 (1.41) 0.7725 (3.61) 1.8355 (1.41) 0.0663 (2.11) 6;34 497.2990 (0.71) 181 1 +test_benchmark_smi 1.8046 (1.43) 8.1505 (2.38) 2.0257 (1.42) 0.7920 (3.70) 1.8707 (1.44) 0.0529 (1.68) 6;39 493.6448 (0.70) 195 1 +test_benchmark_cmo 1.8066 (1.44) 7.8525 (2.29) 2.0081 (1.41) 0.7356 (3.44) 1.8476 (1.42) 0.0716 (2.28) 4;26 497.9728 (0.71) 148 1 +test_benchmark_gator 1.8076 (1.44) 8.1598 (2.38) 2.1922 (1.54) 0.7067 (3.30) 2.0888 (1.61) 0.1736 (5.53) 6;20 456.1615 (0.65) 165 1 +test_benchmark_keltner 1.8078 (1.44) 7.9031 (2.30) 2.0301 (1.42) 0.6243 (2.92) 1.9061 (1.47) 0.0642 (2.05) 5;37 492.5856 (0.70) 198 1 +test_benchmark_vortex 1.8080 (1.44) 9.2847 (2.71) 2.0050 (1.41) 0.8078 (3.78) 1.8636 (1.44) 0.0685 (2.18) 5;38 498.7596 (0.71) 224 1 +test_benchmark_bollinger_bands 1.8101 (1.44) 10.4971 (3.06) 2.4527 (1.72) 1.0814 (5.06) 2.1751 (1.68) 0.4479 (14.27) 6;8 407.7181 (0.58) 131 1 +test_benchmark_stoch 1.8133 (1.44) 9.1480 (2.67) 2.0241 (1.42) 0.7329 (3.43) 1.9006 (1.47) 0.0701 (2.23) 7;42 494.0452 (0.70) 272 1 +test_benchmark_chop 1.8147 (1.44) 7.7068 (2.25) 2.0871 (1.46) 0.7829 (3.66) 1.9035 (1.47) 0.0703 (2.24) 5;31 479.1277 (0.68) 176 1 +test_benchmark_bop 1.8168 (1.44) 7.4662 (2.18) 1.9810 (1.39) 0.5809 (2.72) 1.8594 (1.43) 0.0314 (1.0) 3;20 504.7914 (0.72) 111 1 +test_benchmark_fractal 1.8178 (1.44) 7.7022 (2.25) 2.0290 (1.42) 0.6841 (3.20) 1.8687 (1.44) 0.0717 (2.28) 3;29 492.8639 (0.70) 148 1 +test_benchmark_mfi 1.8188 (1.45) 7.9977 (2.33) 2.0459 (1.44) 0.6332 (2.96) 1.8858 (1.45) 0.1985 (6.32) 5;13 488.7794 (0.70) 206 1 +test_benchmark_parabolic_sar 1.8193 (1.45) 8.4833 (2.47) 2.0177 (1.42) 0.7847 (3.67) 1.8702 (1.44) 0.0553 (1.76) 3;24 495.6118 (0.71) 150 1 +test_benchmark_force_index 1.8204 (1.45) 7.9626 (2.32) 2.0150 (1.41) 0.6729 (3.15) 1.8770 (1.45) 0.0594 (1.89) 3;27 496.2877 (0.71) 161 1 +test_benchmark_super_trend 1.8217 (1.45) 8.5440 (2.49) 2.1051 (1.48) 0.7142 (3.34) 1.9530 (1.51) 0.1143 (3.64) 3;22 475.0327 (0.68) 171 1 +test_benchmark_williams_r 1.8224 (1.45) 11.4220 (3.33) 2.0683 (1.45) 0.8473 (3.96) 1.9014 (1.47) 0.1918 (6.11) 4;18 483.4991 (0.69) 249 1 +test_benchmark_trix 1.8232 (1.45) 8.4281 (2.46) 2.1212 (1.49) 0.6874 (3.21) 2.0508 (1.58) 0.1688 (5.38) 4;16 471.4323 (0.67) 181 1 +test_benchmark_sma 1.8243 (1.45) 8.3734 (2.44) 1.9736 (1.38) 0.6936 (3.24) 1.8574 (1.43) 0.0396 (1.26) 4;53 506.6934 (0.72) 328 1 +test_benchmark_mama 1.8244 (1.45) 8.4141 (2.45) 2.0859 (1.46) 0.7686 (3.59) 1.9472 (1.50) 0.0637 (2.03) 3;37 479.4204 (0.68) 199 1 +test_benchmark_marubozu 1.8251 (1.45) 8.8512 (2.58) 2.0676 (1.45) 0.7350 (3.44) 1.9229 (1.48) 0.0629 (2.00) 9;48 483.6410 (0.69) 267 1 +test_benchmark_wma 1.8258 (1.45) 8.4532 (2.47) 2.0184 (1.42) 0.7211 (3.37) 1.8844 (1.45) 0.0407 (1.30) 5;60 495.4479 (0.71) 330 1 +test_benchmark_macd 1.8283 (1.45) 8.3914 (2.45) 2.0431 (1.43) 0.6530 (3.05) 1.9295 (1.49) 0.0571 (1.82) 4;37 489.4549 (0.70) 206 1 +test_benchmark_chandelier 1.8287 (1.45) 7.6908 (2.24) 2.0556 (1.44) 0.6684 (3.13) 1.9117 (1.47) 0.0835 (2.66) 4;29 486.4792 (0.69) 160 1 +test_benchmark_stoch_rsi 1.8300 (1.45) 8.6547 (2.52) 2.0695 (1.45) 0.7247 (3.39) 1.9348 (1.49) 0.0845 (2.69) 4;31 483.2072 (0.69) 175 1 +test_benchmark_volatility_stop 1.8326 (1.46) 8.6608 (2.53) 2.0360 (1.43) 0.7046 (3.29) 1.9183 (1.48) 0.0764 (2.43) 3;34 491.1705 (0.70) 184 1 +test_benchmark_ultimate 1.8381 (1.46) 8.6942 (2.54) 2.0911 (1.47) 0.6169 (2.88) 1.9439 (1.50) 0.2581 (8.22) 5;7 478.2073 (0.68) 147 1 +test_benchmark_fcb 1.8391 (1.46) 8.8419 (2.58) 2.1507 (1.51) 0.7601 (3.55) 1.9637 (1.51) 0.1330 (4.24) 6;28 464.9576 (0.66) 156 1 +test_benchmark_ema 1.8408 (1.46) 8.0106 (2.34) 2.1367 (1.50) 0.7347 (3.44) 1.9461 (1.50) 0.2057 (6.55) 5;14 468.0143 (0.67) 140 1 +test_benchmark_ht_trendline 1.8465 (1.47) 8.1379 (2.37) 2.0875 (1.46) 0.6565 (3.07) 1.9903 (1.53) 0.2430 (7.74) 2;5 479.0500 (0.68) 95 1 +test_benchmark_chaikin_osc 1.8498 (1.47) 8.4174 (2.45) 2.1535 (1.51) 0.6105 (2.85) 2.0381 (1.57) 0.0950 (3.03) 4;25 464.3633 (0.66) 129 1 +test_benchmark_epma 1.8509 (1.47) 8.5513 (2.49) 2.0569 (1.44) 0.6423 (3.00) 1.9252 (1.48) 0.0964 (3.07) 2;19 486.1785 (0.69) 122 1 +test_benchmark_starc_bands 1.8511 (1.47) 8.6071 (2.51) 2.0535 (1.44) 0.7044 (3.29) 1.9327 (1.49) 0.0703 (2.24) 3;30 486.9755 (0.69) 173 1 +test_benchmark_doji 1.8518 (1.47) 7.7608 (2.26) 2.1216 (1.49) 0.5503 (2.57) 2.0040 (1.54) 0.0417 (1.33) 7;39 471.3503 (0.67) 129 1 +test_benchmark_heikin_ashi 1.8626 (1.48) 7.8933 (2.30) 2.1421 (1.50) 0.6538 (3.06) 2.0222 (1.56) 0.0690 (2.20) 4;51 466.8348 (0.67) 185 1 +test_benchmark_cmf 1.8825 (1.50) 8.0208 (2.34) 2.1480 (1.51) 0.6549 (3.06) 1.9634 (1.51) 0.2755 (8.78) 2;4 465.5497 (0.66) 110 1 +test_benchmark_stc 1.8951 (1.51) 8.4350 (2.46) 2.2106 (1.55) 0.8526 (3.99) 1.9755 (1.52) 0.2264 (7.21) 7;11 452.3631 (0.64) 147 1 +test_benchmark_ulcer_index 1.8958 (1.51) 8.4489 (2.46) 2.1192 (1.49) 0.7992 (3.74) 1.9596 (1.51) 0.0571 (1.82) 4;37 471.8701 (0.67) 196 1 +test_benchmark_dpo 1.8966 (1.51) 8.0983 (2.36) 2.1876 (1.53) 0.7747 (3.62) 1.9716 (1.52) 0.2085 (6.64) 3;5 457.1191 (0.65) 75 1 +test_benchmark_stdev_channels 1.9018 (1.51) 8.3629 (2.44) 2.1714 (1.52) 0.8647 (4.04) 1.9750 (1.52) 0.1013 (3.23) 4;22 460.5377 (0.66) 115 1 +test_benchmark_zig_zag 1.9037 (1.51) 9.0048 (2.63) 2.3466 (1.65) 0.7733 (3.62) 2.1832 (1.68) 0.0763 (2.43) 4;28 426.1518 (0.61) 107 1 +test_benchmark_pmo 1.9134 (1.52) 8.2805 (2.41) 2.1128 (1.48) 0.7435 (3.48) 1.9609 (1.51) 0.0496 (1.58) 3;27 473.3028 (0.67) 147 1 +test_benchmark_pivot_points 1.9282 (1.53) 8.1749 (2.38) 2.1298 (1.49) 0.6417 (3.00) 1.9628 (1.51) 0.0780 (2.48) 5;24 469.5195 (0.67) 129 1 +test_benchmark_pivots 1.9403 (1.54) 10.5121 (3.07) 2.2570 (1.58) 1.0629 (4.97) 2.0031 (1.54) 0.0803 (2.56) 4;25 443.0673 (0.63) 134 1 +test_benchmark_hma 1.9428 (1.54) 7.9225 (2.31) 2.1076 (1.48) 0.6158 (2.88) 1.9753 (1.52) 0.0447 (1.42) 5;21 474.4837 (0.68) 104 1 +test_benchmark_connors_rsi 1.9687 (1.56) 7.8200 (2.28) 2.2975 (1.61) 0.6854 (3.20) 2.0595 (1.59) 0.2954 (9.41) 7;10 435.2526 (0.62) 101 1 +test_benchmark_rolling_pivots 2.0844 (1.66) 9.3352 (2.72) 2.3649 (1.66) 0.9036 (4.23) 2.1514 (1.66) 0.0769 (2.45) 6;32 422.8526 (0.60) 146 1 +test_benchmark_donchian 2.1403 (1.70) 3.4292 (1.0) 2.2631 (1.59) 0.2139 (1.0) 2.1764 (1.68) 0.0801 (2.55) 8;9 441.8627 (0.63) 55 1 +test_benchmark_ichimoku 2.3985 (1.91) 11.0861 (3.23) 3.6059 (2.53) 1.4614 (6.83) 2.8280 (2.18) 2.1525 (68.56) 5;2 277.3228 (0.40) 97 1 +test_benchmark_hurst 2.4920 (1.98) 11.3203 (3.30) 3.8322 (2.69) 1.6483 (7.71) 2.7599 (2.13) 2.7665 (88.11) 12;1 260.9485 (0.37) 94 1 +test_benchmark_prs 2.6791 (2.13) 8.8663 (2.59) 2.9523 (2.07) 0.6611 (3.09) 2.7741 (2.14) 0.3018 (9.61) 6;8 338.7161 (0.48) 186 1 +test_benchmark_awesome 2.7292 (2.17) 13.7035 (4.00) 4.2339 (2.97) 2.3418 (10.95) 3.6867 (2.84) 0.9787 (31.17) 7;8 236.1890 (0.34) 85 1 +test_benchmark_correlation 2.7535 (2.19) 10.3690 (3.02) 3.0844 (2.16) 0.8548 (4.00) 2.8946 (2.23) 0.2470 (7.87) 5;9 324.2149 (0.46) 189 1 +test_benchmark_beta 3.3920 (2.70) 7.4792 (2.18) 3.7100 (2.60) 0.6651 (3.11) 3.4976 (2.70) 0.3218 (10.25) 3;3 269.5424 (0.38) 48 1 +test_benchmark_atr 3.7880 (3.01) 57.3916 (16.74) 6.7444 (4.73) 5.8703 (27.45) 5.2072 (4.01) 1.0141 (32.30) 8;17 148.2702 (0.21) 126 1 +test_benchmark_adx 4.4439 (3.53) 10.0030 (2.92) 4.7729 (3.35) 0.8014 (3.75) 4.5812 (3.53) 0.1903 (6.06) 2;6 209.5160 (0.30) 50 1 +test_benchmark_alligator 4.6729 (3.71) 33.2788 (9.70) 6.4312 (4.51) 5.4937 (25.69) 4.8222 (3.72) 0.2898 (9.23) 4;9 155.4928 (0.22) 58 1 +test_benchmark_alma 4.7904 (3.81) 60.5278 (17.65) 7.2740 (5.10) 8.7015 (40.69) 4.9374 (3.81) 0.3540 (11.28) 6;13 137.4769 (0.20) 96 1 +test_benchmark_adl 4.9485 (3.93) 18.7524 (5.47) 5.9097 (4.15) 2.3649 (11.06) 5.4686 (4.22) 0.6942 (22.11) 1;3 169.2123 (0.24) 33 1 +test_benchmark_aroon 5.1281 (4.07) 17.9128 (5.22) 5.8846 (4.13) 1.8233 (8.53) 5.3664 (4.14) 0.3588 (11.43) 6;11 169.9361 (0.24) 89 1 +test_benchmark_atr_stop 5.3465 (4.25) 11.3764 (3.32) 5.9407 (4.17) 0.9901 (4.63) 5.5619 (4.29) 0.5414 (17.24) 4;4 168.3309 (0.24) 66 1 +test_benchmark_sma_longlong 42.0639 (33.42) 56.3594 (16.44) 46.0736 (32.32) 4.1143 (19.24) 43.8380 (33.80) 7.4969 (238.78) 6;0 21.7044 (0.03) 23 1 +test_benchmark_hurst_longlong 59.2381 (47.07) 69.1008 (20.15) 64.3999 (45.18) 3.5578 (16.64) 65.1903 (50.26) 6.9522 (221.43) 5;0 15.5280 (0.02) 14 1 +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +Legend: + Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile. + OPS: Operations Per Second, computed as 1 / Mean +``` + + +--- # {{ page.title }} for v1.1.0 These are the execution times for the current indicators using two years of historical daily stock quotes (502 periods) with default or typical parameters. diff --git a/docs/pages/utilities.md b/docs/pages/utilities.md index ade72273..49303931 100644 --- a/docs/pages/utilities.md +++ b/docs/pages/utilities.md @@ -19,11 +19,9 @@ layout: page results = quotes.get_marubozu(quotes).condense(); ``` -Currently, `.condense()` is only available on a select few indicators. If you find an indicator that is a good candidate for this utility, please [submit an Issue]({{site.dotnet.repo}}/issues). - >🚩 **Warning**: In all cases, `.condense()` will remove non-essential results and will produce fewer records than are in `quotes`. -### Convert to quotes + ### Find indicator result by date diff --git a/stock_indicators/indicators/common/candles.py b/stock_indicators/indicators/common/candles.py index d46990c3..598164c1 100644 --- a/stock_indicators/indicators/common/candles.py +++ b/stock_indicators/indicators/common/candles.py @@ -108,4 +108,4 @@ class CandleResults(CondenseMixin, IndicatorResults[_T]): @override def condense(self): - return self.__class__(filter(lambda x: x.match != Match.NONE, self), self._wrapper_class) \ No newline at end of file + return self.__class__(filter(lambda x: x.match != Match.NONE, self), self._wrapper_class)