From 4de7202101c57ccf2bc099e490996962acd2420a Mon Sep 17 00:00:00 2001 From: DongGeon Lee Date: Thu, 17 Mar 2022 13:39:13 +0900 Subject: [PATCH] docs: general updates for v0.6.0 (#182) +semver: minor Co-authored-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com> --- docs/_includes/candle-result.md | 8 ++ docs/_indicators/.unimplemented/VolSma.md | 74 ------------------- docs/_indicators/Doji.md | 72 ++++++++++++++++++ docs/_indicators/Marubozu.md | 72 ++++++++++++++++++ .../{.unimplemented => }/Ultimate.md | 56 ++++++++------ .../{.unimplemented => }/VolatilityStop.md | 61 ++++++++------- .../{.unimplemented => }/Vortex.md | 52 +++++++------ docs/_indicators/{.unimplemented => }/Vwap.md | 65 ++++++++-------- docs/_indicators/{.unimplemented => }/Vwma.md | 54 ++++++++------ .../{.unimplemented => }/WilliamsR.md | 52 +++++++------ docs/_indicators/{.unimplemented => }/Wma.md | 54 ++++++++------ docs/guide.md | 44 +++++++++++ docs/utilities.md | 13 ++++ 13 files changed, 433 insertions(+), 244 deletions(-) create mode 100644 docs/_includes/candle-result.md delete mode 100644 docs/_indicators/.unimplemented/VolSma.md create mode 100644 docs/_indicators/Doji.md create mode 100644 docs/_indicators/Marubozu.md rename docs/_indicators/{.unimplemented => }/Ultimate.md (51%) rename docs/_indicators/{.unimplemented => }/VolatilityStop.md (55%) rename docs/_indicators/{.unimplemented => }/Vortex.md (56%) rename docs/_indicators/{.unimplemented => }/Vwap.md (50%) rename docs/_indicators/{.unimplemented => }/Vwma.md (54%) rename docs/_indicators/{.unimplemented => }/WilliamsR.md (56%) rename docs/_indicators/{.unimplemented => }/Wma.md (54%) diff --git a/docs/_includes/candle-result.md b/docs/_includes/candle-result.md new file mode 100644 index 00000000..fa598755 --- /dev/null +++ b/docs/_includes/candle-result.md @@ -0,0 +1,8 @@ +### CandleResult + +| name | type | notes +| -- |-- |-- +| `date` | datetime | Date +| `price` | decimal, Optional | Price of the most relevant OHLC candle element when a signal is present +| `signal` | [Signal]({{site.baseurl}}/guide/#signal) | Generated signal type +| `candle` | [CandleProperties]({{site.baseurl}}/guide/#candle) | Candle properties diff --git a/docs/_indicators/.unimplemented/VolSma.md b/docs/_indicators/.unimplemented/VolSma.md deleted file mode 100644 index 02ffac19..00000000 --- a/docs/_indicators/.unimplemented/VolSma.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Volume Simple Moving Average -permalink: /indicators/VolSma/ -type: moving-average -layout: indicator ---- - -# {{ page.title }} - -The Volume Simple Moving Average is the average volume over a lookback window. This is helpful when you are trying to assess whether volume is above or below normal. -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/230 "Community discussion about this indicator") - -:warning: **Deprecation Warning!** `GetVolSma` is now redundant and will be removed from the library at the end of 2021. It is replaced by [GetSma()](../Sma/#content) with a `CandlePart.Volume` specification. - -![image]({{site.charturl}}/VolSma.png) - -```python -// legacy usage -IEnumerable results = - quotes.GetVolSma(lookbackPeriods) - -// please convert to equivalent: -IEnumerable results = - quotes.GetSma(lookbackPeriods, CandlePart.Volume) -``` - -## Parameters - -| name | type | notes -| -- |-- |-- -| `lookbackPeriods` | int | Number of periods (`N`) in the moving average. Must be greater than 0. - -### Historical quotes requirements - -You must have at least `N` periods of `quotes`. - -`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. - -## Return - -```python -IEnumerable -``` - -- This method returns a time series of all available indicator values for the `quotes` provided. -- 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-1` periods will have `None` values for `VolSma` since there's not enough data to calculate. - -### VolSmaResult - -| name | type | notes -| -- |-- |-- -| `Date` | DateTime | Date -| `Volume` | decimal | Volume -| `VolSma` | decimal | Simple moving average of `Volume` for `N` lookback periods - -### Utilities - -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) - -See [Utilities and Helpers]({{site.baseurl}}/utilities#utilities-for-indicator-results) for more information. - -## Example - -```python -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("MSFT") - -// calculate 20-period SMA of Volume -IEnumerable results = quotes.GetVolSma(20) -``` diff --git a/docs/_indicators/Doji.md b/docs/_indicators/Doji.md new file mode 100644 index 00000000..aba647d3 --- /dev/null +++ b/docs/_indicators/Doji.md @@ -0,0 +1,72 @@ +--- +title: Doji (Preview) +permalink: /indicators/Doji/ +layout: indicator +type: candlestick-pattern +--- + +# {{ page.title }} +
+ +## **get_doji**(*quotes, max_price_change_percent=0.001*) + +## Parameters + +| name | type | notes +| -- |-- |-- +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `max_price_change_percent` | float, *default 0.001* | Optional. Maximum absolute decimalized percent difference in open and close price. Must be between 0 and 0.005, if specified. + +### Historical quotes requirements + +You must have at least one historical quote; however, more is typically provided since this is a chartable candlestick pattern. + +`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. + +## Return + +```python +CandleResults[CandleResult] +``` + +- This method returns a time series of all available indicator values for the `quotes` provided. +- `CandleResults` is just a list of `CandleResult`. +- 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 candlestick pattern is indicated on dates where `signal` is `Signal.NEUTRAL`. +- `price` is `close` price; however, all OHLC elements are included in the `candle` properties. +- There is no intrinsic basis or confirmation signal provided for this pattern. + +{% include candle-result.md %} + +### 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_history_from_feed("SPY") + +# Calculate +results = indicators.get_doji(quotes); +``` + +## About: {{ page.title }} + +[Doji](https://en.wikipedia.org/wiki/Doji) is a single candlestick pattern where open and close price are virtually identical, representing market indecision. +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/734 "Community discussion about this indicator") + +![image]({{site.charturl}}/Doji.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/a-d/Doji/Doji.cs) +- [Python wrapper]({{site.sourceurl}}/doji.py) diff --git a/docs/_indicators/Marubozu.md b/docs/_indicators/Marubozu.md new file mode 100644 index 00000000..2f6c1d63 --- /dev/null +++ b/docs/_indicators/Marubozu.md @@ -0,0 +1,72 @@ +--- +title: Marubozu (Preview) +permalink: /indicators/Marubozu/ +layout: indicator +type: candlestick-pattern +--- + +# {{ page.title }} +
+ +## **get_marubozu**(*quotes, min_body_percent=0.95*) + +## Parameters + +| name | type | notes +| -- |-- |-- +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `min_body_percent` | float, *default 0.95* | Minimum body size as a decimalized percent of total candle size. Must be between 0.8 and 1, if specified. + +### Historical quotes requirements + +You must have at least one historical quote; however, more is typically provided since this is a chartable candlestick pattern. + +`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. + +## Return + +```csharp +CandleResults[CandleResult] +``` + +- This method returns a time series of all available indicator values for the `quotes` provided. +- `CandleResults` is just a list of `CandleResult`. +- 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 candlestick pattern is indicated on dates where `signal` is `Signal.BULL_SIGNAL` or `Signal.BEAR_SIGNAL`. +- `price` is `close` price; however, all OHLC elements are included in the `candle` properties. +- There is no intrinsic basis or confirmation signal provided for this pattern. + +{% include candle-result.md %} + +### 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_history_from_feed("SPY") + +# Calculate +results = indicators.get_marubozu(quotes); +``` + +## About: {{ page.title }} + +[Marubozu](https://en.wikipedia.org/wiki/Marubozu) is a single candlestick pattern that has no wicks, representing consistent directional movement. +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/512 "Community discussion about this indicator") + +![image]({{site.charturl}}/Marubozu.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/m-r/Marubozu/Marubozu.cs) +- [Python wrapper]({{site.sourceurl}}/marubozu.py) diff --git a/docs/_indicators/.unimplemented/Ultimate.md b/docs/_indicators/Ultimate.md similarity index 51% rename from docs/_indicators/.unimplemented/Ultimate.md rename to docs/_indicators/Ultimate.md index ccdd0ff3..efb4b3d3 100644 --- a/docs/_indicators/.unimplemented/Ultimate.md +++ b/docs/_indicators/Ultimate.md @@ -6,25 +6,18 @@ layout: indicator --- # {{ page.title }} +
-Created by Larry Williams, the [Ultimate Oscillator](https://en.wikipedia.org/wiki/Ultimate_oscillator) uses several lookback periods to weigh buying power against true range price to produce on oversold / overbought oscillator. -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/231 "Community discussion about this indicator") - -![image]({{site.charturl}}/Ultimate.png) - -```python -// usage -IEnumerable results = - quotes.GetUltimate(shortPeriods, middlePeriods, longPeriods) -``` - +## **get_ultimate**(*quotes, short_periods=7, middle_periods=14, long_periods=28*) + ## Parameters | name | type | notes | -- |-- |-- -| `shortPeriods` | int | Number of periods (`S`) in the short lookback. Must be greater than 0. Default is 7. -| `middlePeriods` | int | Number of periods (`M`) in the middle lookback. Must be greater than `S`. Default is 14. -| `longPeriods` | int | Number of periods (`L`) in the long lookback. Must be greater than `M`. Default is 28. +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `short_periods` | int, *default 7* | Number of periods (`S`) in the short lookback. Must be greater than 0. +| `middle_periods` | int, *default 14* | Number of periods (`M`) in the middle lookback. Must be greater than `S`. +| `long_periods` | int, *default 28* | Number of periods (`L`) in the long lookback. Must be greater than `M`. ### Historical quotes requirements @@ -35,10 +28,11 @@ You must have at least `L+1` periods of `quotes` to cover the warmup periods. ## Return ```python -IEnumerable +UltimateResults[UltimateResult] ``` - This method returns a time series of all available indicator values for the `quotes` provided. +- `UltimateResults` is just a list of `UltimateResult`. - 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 `L-1` periods will have `None` Ultimate values since there's not enough data to calculate. @@ -47,23 +41,37 @@ IEnumerable | name | type | notes | -- |-- |-- -| `Date` | DateTime | Date -| `Ultimate` | decimal | Simple moving average for `N` lookback periods +| `date` | datetime | Date +| `ultimate` | Decimal, Optional | Simple moving average for `N` lookback periods ### Utilities -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.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 -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("MSFT") +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_history_from_feed("SPY") -// calculate 20-period Ultimate -IEnumerable results = quotes.GetUltimate(7,14,28) +# calculate 20-period Ultimate +results = indicators.get_ultimate(quotes, 7, 14, 28) ``` + +## About: {{ page.title }} + +Created by Larry Williams, the [Ultimate Oscillator](https://en.wikipedia.org/wiki/Ultimate_oscillator) uses several lookback periods to weigh buying power against true range price to produce on oversold / overbought oscillator. +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/231 "Community discussion about this indicator") + +![image]({{site.charturl}}/Ultimate.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/s-z/Ultimate/Ultimate.cs) +- [Python wrapper]({{site.sourceurl}}/ultimate.py) diff --git a/docs/_indicators/.unimplemented/VolatilityStop.md b/docs/_indicators/VolatilityStop.md similarity index 55% rename from docs/_indicators/.unimplemented/VolatilityStop.md rename to docs/_indicators/VolatilityStop.md index ed170d69..f01800ae 100644 --- a/docs/_indicators/.unimplemented/VolatilityStop.md +++ b/docs/_indicators/VolatilityStop.md @@ -6,24 +6,17 @@ layout: indicator --- # {{ page.title }} +
-Created by J. Welles Wilder, [Volatility Stop](https://archive.org/details/newconceptsintec00wild), also known his Volatility System, is an [ATR](../Atr/) based indicator used to determine trend direction, stops, and reversals. It is similar to Wilder's [Parabolic SAR](../ParabolicSar/#content) and [SuperTrend](../SuperTrend/#content). -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/564 "Community discussion about this indicator") - -![image]({{site.charturl}}/VolatilityStop.png) - -```python -// usage -IEnumerable results = - quotes.GetVolatilityStop(lookbackPeriods, multiplier) -``` +## **get_volatility_stop**(*quotes, lookback_periods=7, multiplier=3*) ## Parameters | name | type | notes | -- |-- |-- -| `lookbackPeriods` | int | Number of periods (`N`) ATR lookback window. Must be greater than 1. Default is 7. -| `multiplier` | double | ATR multiplier for the offset. Must be greater than 0. Default is 3.0. +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `lookback_periods` | int, *default 7* | Number of periods (`N`) ATR lookback window. Must be greater than 1. +| `multiplier` | float, *default 3* | ATR multiplier for the offset. Must be greater than 0. ### Historical quotes requirements @@ -34,10 +27,11 @@ You must have at least `N+100` periods of `quotes` to cover the convergence peri ## Return ```python -IEnumerable +VolatilityStopResults[VolatilityStopResult] ``` - This method returns a time series of all available indicator values for the `quotes` provided. +- `VolatilityStopResults` is just a list of `VolatilityStopResult`. - 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 trend will have `None` values since it is not accurate and based on an initial guess. @@ -48,29 +42,42 @@ IEnumerable | name | type | notes | -- |-- |-- -| `Date` | DateTime | Date -| `Sar` | decimal | Stop and Reverse value contains both Upper and Lower segments -| `IsStop` | bool | Indicates a trend reversal -| `UpperBand` | decimal | Upper band only (bearish/red) -| `LowerBand` | decimal | Lower band only (bullish/green) +| `date` | datetime | Date +| `sar` | Decimal, Optional | Stop and Reverse value contains both Upper and Lower segments +| `is_stop` | bool, Optional | Indicates a trend reversal +| `upper_band` | Decimal, Optional | Upper band only (bearish/red) +| `lower_band` | Decimal, Optional | Lower band only (bullish/green) -`UpperBand` and `LowerBand` values are provided to differentiate bullish vs bearish trends and to clearly demark trend reversal. `Sar` is the contiguous combination of both upper and lower line data. +`upper_band` and `lower_band` values are provided to differentiate bullish vs bearish trends and to clearly demark trend reversal. `sar` is the contiguous combination of both upper and lower line data. ### Utilities -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.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 -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("SPY") +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_history_from_feed("SPY") -// calculate VolatilityStop(20,2.5) -IEnumerable results - = quotes.VolatilityStop(20,2.5m) +# Calculate VolatilityStop(20,2.5) +results = indicators.get_volatility_stop(quotes, 20, 2.5) ``` + +## About: {{ page.title }} + +Created by J. Welles Wilder, [Volatility Stop](https://archive.org/details/newconceptsintec00wild), also known his Volatility System, is an [ATR](../Atr/) based indicator used to determine trend direction, stops, and reversals. It is similar to Wilder's [Parabolic SAR](../ParabolicSar/#content) and [SuperTrend](../SuperTrend/#content). +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/564 "Community discussion about this indicator") + +![image]({{site.charturl}}/VolatilityStop.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/s-z/VolatilityStop/VolatilityStop.cs) +- [Python wrapper]({{site.sourceurl}}/volatility_stop.py) diff --git a/docs/_indicators/.unimplemented/Vortex.md b/docs/_indicators/Vortex.md similarity index 56% rename from docs/_indicators/.unimplemented/Vortex.md rename to docs/_indicators/Vortex.md index dbbc7e7f..e8d895b2 100644 --- a/docs/_indicators/.unimplemented/Vortex.md +++ b/docs/_indicators/Vortex.md @@ -6,23 +6,16 @@ layout: indicator --- # {{ page.title }} +
-Created by Etienne Botes and Douglas Siepman, the [Vortex Indicator](https://en.wikipedia.org/wiki/Vortex_indicator) is a measure of price directional movement. It includes positive and negative indicators, and is often used to identify trends and reversals. -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/339 "Community discussion about this indicator") - -![image]({{site.charturl}}/Vortex.png) - -```python -// usage -IEnumerable results = - quotes.GetVortex(lookbackPeriods) -``` +## **get_vortex**(*quotes, lookback_periods*) ## Parameters | name | type | notes | -- |-- |-- -| `lookbackPeriods` | int | Number of periods (`N`) to consider. Must be greater than 1 and is usually between 14 and 30. +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `lookback_periods` | int | Number of periods (`N`) to consider. Must be greater than 1 and is usually between 14 and 30. ### Historical quotes requirements @@ -33,10 +26,11 @@ You must have at least `N+1` periods of `quotes` to cover the warmup periods. ## Return ```python -IEnumerable +VortexResults[VortexResult] ``` - This method returns a time series of all available indicator values for the `quotes` provided. +- `VortexResults` is just a list of `VortexResult`. - 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 VI since there's not enough data to calculate. @@ -45,24 +39,38 @@ IEnumerable | name | type | notes | -- |-- |-- -| `Date` | DateTime | Date -| `Pvi` | double | Positive Vortex Indicator (VI+) -| `Nvi` | double | Negative Vortex Indicator (VI-) +| `date` | datetime | Date +| `pvi` | float, Optional | Positive Vortex Indicator (VI+) +| `nvi` | float, Optional | Negative Vortex Indicator (VI-) ### Utilities -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.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 -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("SPY") +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_history_from_feed("SPY") -// calculate 14-period VI -IEnumerable results = quotes.GetVortex(14) +# Calculate 14-period VI +results = indicators.get_vortex(quotes, 14); ``` + +## About: {{ page.title }} + +Created by Etienne Botes and Douglas Siepman, the [Vortex Indicator](https://en.wikipedia.org/wiki/Vortex_indicator) is a measure of price directional movement. It includes positive and negative indicators, and is often used to identify trends and reversals. +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/339 "Community discussion about this indicator") + +![image]({{site.charturl}}/Vortex.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/s-z/Vortex/Vortex.cs) +- [Python wrapper]({{site.sourceurl}}/vortex.py) diff --git a/docs/_indicators/.unimplemented/Vwap.md b/docs/_indicators/Vwap.md similarity index 50% rename from docs/_indicators/.unimplemented/Vwap.md rename to docs/_indicators/Vwap.md index 97266367..09fa5489 100644 --- a/docs/_indicators/.unimplemented/Vwap.md +++ b/docs/_indicators/Vwap.md @@ -6,67 +6,74 @@ layout: indicator --- # {{ page.title }} +
-The [Volume Weighted Average Price](https://en.wikipedia.org/wiki/Volume-weighted_average_price) is a Volume weighted average of Close price, typically used on intraday data. -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/310 "Community discussion about this indicator") +## **get_vwap**(*quotes, start=None*) -![image]({{site.charturl}}/Vwap.png) - -```python -// usage -IEnumerable results = - quotes.GetVwap() - -// usage with optional anchored start date -IEnumerable results = - quotes.GetVwap(startDate) -``` +## **get_vwap**(*quotes, year, month=1, day=1, hour=0, minute=0*) ## Parameters | name | type | notes | -- |-- |-- -| `startDate` | DateTime | Optional. The anchor date used to start the VWAP accumulation. The earliest date in `quotes` is used when not provided. +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `start` | datetime, Optional | The anchor date used to start the VWAP accumulation. The earliest date in `quotes` is used when not provided. +| `year`, `month`, `day`, `hour`, `minute`| int, Optional | The anchor date used to start the VWAP accumulation. The earliest date in `quotes` is used when not provided. ### Historical quotes requirements -You must have at least one historical quote to calculate; however, more is often needed to be useful. Historical quotes are typically provided for a single day using minute-based intraday periods. Since this is an accumulated weighted average price, different start dates will produce different results. The accumulation starts at the first period in the provided `quotes`, unless it is specified in the optional `startDate` parameter. +You must have at least one historical quote to calculate; however, more is often needed to be useful. Historical quotes are typically provided for a single day using minute-based intraday periods. Since this is an accumulated weighted average price, different start dates will produce different results. The accumulation starts at the first period in the provided `quotes`, unless it is specified in the optional `start` parameter. `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. ## Return -```python -IEnumerable +```csharp +VWAPResults[VWAPResult] ``` - This method returns a time series of all available indicator values for the `quotes` provided. +- `VWAPResults` is just a list of `VWAPResult`. - 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 or the `startDate` will have a `Vwap = Close` value since it is the initial starting point. -- `Vwap` values before `startDate`, if specified, will be `None`. +- The first period or the `start` will have a `vwap = close` value since it is the initial starting point. +- `vwap` values before `start`, if specified, will be `None`. -### VwapResult +### VWAPResult | name | type | notes | -- |-- |-- -| `Date` | DateTime | Date -| `Vwap` | decimal | Volume Weighted Average Price +| `date` | datetime | Date +| `vwap` | Decimal, Optional | Volume Weighted Average Price ### Utilities -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.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 -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("SPY") +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_history_from_feed("SPY") -// calculate -IEnumerable results = quotes.GetVwap() +# Calculate +results = indicators.get_vwap(quotes); ``` + +## About: {{ page.title }} + +The [Volume Weighted Average Price](https://en.wikipedia.org/wiki/Volume-weighted_average_price) is a Volume weighted average of Close price, typically used on intraday data. +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/310 "Community discussion about this indicator") + +![image]({{site.charturl}}/Vwap.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/s-z/Vwap/Vwap.cs) +- [Python wrapper]({{site.sourceurl}}/vwap.py) diff --git a/docs/_indicators/.unimplemented/Vwma.md b/docs/_indicators/Vwma.md similarity index 54% rename from docs/_indicators/.unimplemented/Vwma.md rename to docs/_indicators/Vwma.md index 26c07980..d7f9a601 100644 --- a/docs/_indicators/.unimplemented/Vwma.md +++ b/docs/_indicators/Vwma.md @@ -6,23 +6,16 @@ layout: indicator --- # {{ page.title }} +
-Volume Weighted Moving Average is the volume adjusted average price over a lookback window. -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/657 "Community discussion about this indicator") - -![image]({{site.charturl}}/Vwma.png) - -```python -// legacy usage -IEnumerable results = - quotes.GetVwma(lookbackPeriods) -``` - +## **get_vwma**(*quotes, lookback_periods*) + ## Parameters | name | type | notes | -- |-- |-- -| `lookbackPeriods` | int | Number of periods (`N`) in the moving average. Must be greater than 0. +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `lookback_periods` | int | Number of periods (`N`) in the moving average. Must be greater than 0. ### Historical quotes requirements @@ -33,35 +26,50 @@ You must have at least `N` periods of `quotes` to cover the warmup periods. ## Return ```python -IEnumerable +VWMAResults[VWMAResult] ``` - This method returns a time series of all available indicator values for the `quotes` provided. +- `VWMAResults` is just a list of `VWMAResult`. - 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-1` periods will have `None` values for `Vwma` since there's not enough data to calculate. -### VwmaResult +### VWMAResult | name | type | notes | -- |-- |-- -| `Date` | DateTime | Date -| `Vwma` | decimal | Volume Weighted Moving Average for `N` lookback periods +| `date` | datetime | Date +| `vwma` | Decimal, Optional | Volume Weighted Moving Average for `N` lookback periods ### Utilities -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.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 -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("MSFT") +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_history_from_feed("SPY") -// calculate 10-period VWMA -IEnumerable results = quotes.GetVwma(10) +# Calculate 10-period VWMA +results = indicators.get_vwma(quotes, 10) ``` + +## About: {{ page.title }} + +Volume Weighted Moving Average is the volume adjusted average price over a lookback window. +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/657 "Community discussion about this indicator") + +![image]({{site.charturl}}/Vwma.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/s-z/Vwma/Vwma.cs) +- [Python wrapper]({{site.sourceurl}}/vwma.py) diff --git a/docs/_indicators/.unimplemented/WilliamsR.md b/docs/_indicators/WilliamsR.md similarity index 56% rename from docs/_indicators/.unimplemented/WilliamsR.md rename to docs/_indicators/WilliamsR.md index bfe43e9a..6006c976 100644 --- a/docs/_indicators/.unimplemented/WilliamsR.md +++ b/docs/_indicators/WilliamsR.md @@ -6,23 +6,16 @@ layout: indicator --- # {{ page.title }} +
-Created by Larry Williams, the [Williams %R](https://en.wikipedia.org/wiki/Williams_%25R) momentum indicator is a stochastic oscillator with scale of -100 to 0. It is exactly the same as the Fast variant of [Stochastic Oscillator](../Stoch#content), but with a different scaling. -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/229 "Community discussion about this indicator") - -![image]({{site.charturl}}/WilliamsR.png) - -```python -// usage -IEnumerable results = - quotes.GetWilliamsR(lookbackPeriods) -``` - +## **get_williams_r**(*quotes, lookback_periods=14*) + ## Parameters | name | type | notes | -- |-- |-- -| `lookbackPeriods` | int | Number of periods (`N`) in the lookback period. Must be greater than 0. Default is 14. +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `lookback_periods` | int, *default 14* | Number of periods (`N`) in the lookback period. Must be greater than 0. Default is 14. ### Historical quotes requirements @@ -33,10 +26,11 @@ You must have at least `N` periods of `quotes` to cover the warmup periods. ## Return ```python -IEnumerable +WilliamsResult[WilliamsResult] ``` - This method returns a time series of all available indicator values for the `quotes` provided. +- `WilliamsResults` is just a list of `WilliamsResult`. - 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-1` periods will have `None` Oscillator values since there's not enough data to calculate. @@ -45,23 +39,37 @@ IEnumerable | name | type | notes | -- |-- |-- -| `Date` | DateTime | Date -| `WilliamsR` | decimal | Oscillator over prior `N` lookback periods +| `date` | datetime | Date +| `williams_r` | Decimal, Optional | Oscillator over prior `N` lookback periods ### Utilities -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.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 -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("SPY") +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_history_from_feed("SPY") -// calculate WilliamsR(14) -IEnumerable results = quotes.GetWilliamsR(14) +# Calculate WilliamsR(14) +results = indicators.get_williams_r(quotes, 14) ``` + +## About: {{ page.title }} + +Created by Larry Williams, the [Williams %R](https://en.wikipedia.org/wiki/Williams_%25R) momentum indicator is a stochastic oscillator with scale of -100 to 0. It is exactly the same as the Fast variant of [Stochastic Oscillator](../Stoch#content), but with a different scaling. +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/229 "Community discussion about this indicator") + +![image]({{site.charturl}}/WilliamsR.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/s-z/WilliamsR/WilliamsR.cs) +- [Python wrapper]({{site.sourceurl}}/williams_r.py) diff --git a/docs/_indicators/.unimplemented/Wma.md b/docs/_indicators/Wma.md similarity index 54% rename from docs/_indicators/.unimplemented/Wma.md rename to docs/_indicators/Wma.md index 7b209e08..b8447416 100644 --- a/docs/_indicators/.unimplemented/Wma.md +++ b/docs/_indicators/Wma.md @@ -6,23 +6,16 @@ layout: indicator --- # {{ page.title }} +
-[Weighted Moving Average](https://en.wikipedia.org/wiki/Moving_average#Weighted_moving_average) is the linear weighted average of `Close` price over `N` lookback periods. This also called Linear Weighted Moving Average (LWMA). -[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/227 "Community discussion about this indicator") - -![image]({{site.charturl}}/Wma.png) - -```python -// usage -IEnumerable results = - quotes.GetWma(lookbackPeriods) -``` - +## **get_wma**(*quotes, lookback_periods*) + ## Parameters | name | type | notes | -- |-- |-- -| `lookbackPeriods` | int | Number of periods (`N`) in the moving average. Must be greater than 0. +| `quotes` | Iterable[Quote] | Iterable(such as list or an object having `__iter__()`) of the Quote class or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). +| `lookback_periods` | int | Number of periods (`N`) in the moving average. Must be greater than 0. ### Historical quotes requirements @@ -33,35 +26,50 @@ You must have at least `N` periods of `quotes` to cover the warmup periods. ## Return ```python -IEnumerable +WMAResults[WMAResult] ``` - This method returns a time series of all available indicator values for the `quotes` provided. +- `WMAResults` is just a list of `WMAResult`. - 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-1` periods will have `None` values since there's not enough data to calculate. -### WmaResult +### WMAResult | name | type | notes | -- |-- |-- -| `Date` | DateTime | Date -| `Wma` | decimal | Weighted moving average for `N` lookback periods +| `date` | datetime | Date +| `wma` | Decimal, Optional | Weighted moving average for `N` lookback periods ### Utilities -- [.Find(lookupDate)]({{site.baseurl}}/utilities#find-indicator-result-by-date) -- [.RemoveWarmupPeriods()]({{site.baseurl}}/utilities#remove-warmup-periods) -- [.RemoveWarmupPeriods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) +- [.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 -// fetch historical quotes from your feed (your method) -IEnumerable quotes = GetHistoryFromFeed("MSFT") +from stock_indicators import indicators + +# This method is NOT a part of the library. +quotes = get_history_from_feed("SPY") -// calculate 20-period WMA -IEnumerable results = quotes.GetWma(20) +# Calculate 20-period WMA +results = indicators.get_wma(quotes, 20) ``` + +## About: {{ page.title }} + +[Weighted Moving Average](https://en.wikipedia.org/wiki/Moving_average#Weighted_moving_average) is the linear weighted average of `close` price over `N` lookback periods. This also called Linear Weighted Moving Average (LWMA). +[[Discuss] :speech_balloon:]({{site.github.base_repository_url}}/discussions/227 "Community discussion about this indicator") + +![image]({{site.charturl}}/Wma.png) + +### Sources + +- [C# core]({{site.base_sourceurl}}/s-z/Wma/Wma.cs) +- [Python wrapper]({{site.sourceurl}}/wma.py) diff --git a/docs/guide.md b/docs/guide.md index 2927511c..793f084a 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -13,6 +13,7 @@ layout: default - [Using custom quote classes](#using-custom-quote-classes) - [Using derived results classes](#using-derived-results-classes) - [Generating indicator of indicators](#generating-indicator-of-indicators) +- [Candlestick patterns](#candlestick-patterns) - [Utilities and Helper functions]({{site.baseurl}}/utilities/#content) - [Contributing guidelines]({{site.baseurl}}/contributing/#content) @@ -242,6 +243,49 @@ sma_of_ema = indicators.get_sma(quotes_from_ema, 20) ``` +## Candlestick patterns + +[Candlestick Patterns]({{site.baseurl}}/indicators/#candlestick-pattern) are a unique form of indicator and have a common output model. + +{% include candle-result.md %} + +### Signal + +When a candlestick pattern is recognized, it produces a signal. In some cases, an intrinsic confirmation is also available. In cases where previous bars were used to identify a pattern, they are indicates as the basis for the signal. [Documentation for each candlestick pattern]({{site.baseurl}}/indicators/#candlestick-pattern) will indicate whether confirmation and/or basis information is produced. + +| type | description +|-- |:-- +| `Signal.BULL_CONFIRMED` | Confirmation of a prior bull signal +| `Signal.BULL_SIGNAL` | Matching bullish pattern +| `Signal.BULL_BASIS` | Bars supporting a bullish signal +| `Signal.NEUTRAL` | Matching for non-directional patterns +| `Signal.NONE` | No match +| `Signal.BEAR_BASIS` | Bars supporting a bearish signal +| `Signal.BEAR_SIGNAL` | Matching bearish pattern +| `Signal.BEAR_CONFIRMED` | Confirmation of a prior bear signal + +### Candle + +The `CandleProperties` class is an extended version of `Quote`, and contains additional calculated properties. + +| name | type | notes +| -- |-- |-- +| `date` | datetime | Date +| `open` | Decimal | Open price +| `high` | Decimal | High price +| `low` | Decimal | Low price +| `close` | Decimal | Close price +| `volume` | Decimal | Volume +| `size` | Decimal | `high-low` +| `body` | Decimal | `|open-close|` +| `upper_wick` | Decimal | Upper wick size +| `lower_wick` | Decimal | Lower wick size +| `body_pct` | float | `body/size` +| `upper_wick_pct` | float | `upper_wick/size` +| `lower_wick_pct` | float | `lower_wick/size` +| `is_bullish` | bool | `close>open` direction +| `is_bearish` | bool | `close