Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
id: talib_c
run: |
set -euo pipefail
V=$(sed -n 's/^ TALIB_C_VER: *//p' .github/workflows/wheels.yml)
[ -n "$V" ] || { echo "::error::no TALIB_C_VER in wheels.yml"; exit 1; }
V=$(sed -n "s/^TALIB_C_VERSION = '\(.*\)'$/\1/p" setup.py)
[ -n "$V" ] || { echo "::error::no TALIB_C_VERSION in setup.py"; exit 1; }
echo "version=$V" >> "$GITHUB_OUTPUT"

- name: Set up TA-Lib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
workflow_dispatch:

env:
TALIB_C_VER: 0.8.1
PIP_NO_VERIFY: 0
PIP_VERBOSE: 1
CIBW_BEFORE_BUILD: pip install -U setuptools Cython wheel meson-python ninja && pip install -U numpy
Expand Down Expand Up @@ -197,6 +196,7 @@ jobs:
env:
CIBW_TEST_COMMAND: >
cd .. &&
python -c "import talib; assert talib._ta_lib._ta_get_runtime_info('vmath.transcendental') == 1, 'TA-Lib C is not using vForce'" &&
pytest -k "not RSI and not threading" {project}/tests
CIBW_ARCHS_MACOS: arm64
CIBW_ENVIRONMENT_MACOS : >
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
0.8.3
=====

- [NEW]: Source builds download and verify TA-Lib C 0.8.1, build it as a
- [NEW]: Source builds download and verify TA-Lib C 0.8.3, build it as a
static library and link it into the extension. A compiler, CMake and network
access are required; a separate TA-Lib C installation is no longer needed.
Generated C files remain included in source distributions.
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ conda install -c conda-forge ta-lib
Binary wheels include the [TA-Lib](http://ta-lib.org) C library and do not
require a compiler or a separate TA-Lib C installation.

Starting with version 0.8.3, source builds download the pinned TA-Lib C 0.8.1
Starting with version 0.8.3, source builds download the pinned TA-Lib C 0.8.3
release, verify its checksum, and build and statically link it into the Python
extension. This requires network access, a C compiler and CMake. On Windows,
source builds require the Microsoft C++ Build Tools. CMake is installed
Expand Down Expand Up @@ -123,24 +123,24 @@ your-arm64-python -m pip install --no-cache-dir ta-lib

For 64-bit Windows, the easiest way is to get the *executable installer*:

1. Download [ta-lib-0.8.1-windows-x86_64.msi](https://github.com/ta-lib/ta-lib/releases/download/v0.8.1/ta-lib-0.8.1-windows-x86_64.msi).
1. Download [ta-lib-0.8.3-windows-x86_64.msi](https://github.com/ta-lib/ta-lib/releases/download/v0.8.3/ta-lib-0.8.3-windows-x86_64.msi).
2. Run the Installer or run `msiexec` [from the command-line](https://learn.microsoft.com/en-us/windows/win32/msi/standard-installer-command-line-options).

Alternatively, if you prefer to get the libraries without installing, or
would like to use the 32-bit version:

* Intel/AMD 64-bit [ta-lib-0.8.1-windows-x86_64.zip](https://github.com/ta-lib/ta-lib/releases/download/v0.8.1/ta-lib-0.8.1-windows-x86_64.zip)
* Intel/AMD 32-bit [ta-lib-0.8.1-windows-x86_32.zip](https://github.com/ta-lib/ta-lib/releases/download/v0.8.1/ta-lib-0.8.1-windows-x86_32.zip)
* Intel/AMD 64-bit [ta-lib-0.8.3-windows-x86_64.zip](https://github.com/ta-lib/ta-lib/releases/download/v0.8.3/ta-lib-0.8.3-windows-x86_64.zip)
* Intel/AMD 32-bit [ta-lib-0.8.3-windows-x86_32.zip](https://github.com/ta-lib/ta-lib/releases/download/v0.8.3/ta-lib-0.8.3-windows-x86_32.zip)

#### Linux

Download
[ta-lib-0.8.1-src.tar.gz](https://github.com/ta-lib/ta-lib/releases/download/v0.8.1/ta-lib-0.8.1-src.tar.gz)
[ta-lib-0.8.3-src.tar.gz](https://github.com/ta-lib/ta-lib/releases/download/v0.8.3/ta-lib-0.8.3-src.tar.gz)
and:

```shell
tar -xzf ta-lib-0.8.1-src.tar.gz
cd ta-lib-0.8.1/
tar -xzf ta-lib-0.8.3-src.tar.gz
cd ta-lib-0.8.3/
./configure --prefix=/usr
make
sudo make install
Expand Down Expand Up @@ -446,6 +446,13 @@ Functions marked in the docs as having an unstable period start with that
extra unstable-period setting at `0`. In other words, `get_unstable_period()`
returns `0` until you explicitly change it with `set_unstable_period()`.

Instead of a count, `set_unstable_period()` also takes an Auto level. With
`talib.set_unstable_period('ALL', talib.UNSTABLE_AUTO_PREC_4)` each function
works out how many leading values to discard, so that the first 4 significant
digits of what it returns no longer depend on where your data starts;
`UNSTABLE_AUTO_PREC_8` targets 8. `get_unstable_period()` then returns the
level. See [Unstable Period](https://ta-lib.org/api/unstable-period/#auto).

### NaN's

The underlying TA-Lib C library handles NaN's in a sometimes surprising manner
Expand Down Expand Up @@ -539,7 +546,8 @@ slowk, slowd = STOCH(inputs, 5, 3, 0, 3, 0, prices=['high', 'low', 'open'])
The Streaming API keeps a handle per indicator instead of recomputing from the
whole array. Opening one costs a pass over the history; every bar after that is
O(1), and each value it produces is identical to the one the Function API
reports for that bar.
reports for that bar. On Apple Silicon macOS, a function using a transcendental
math function (SIN, EXP, LN, ...) may differ from it in the last bits.

```python
import talib
Expand Down
12 changes: 12 additions & 0 deletions docs/func.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ from talib import MA_Type
upper, middle, lower = talib.BBANDS(close, matype=MA_Type.T3)
```

Every `matype` argument (for example `STOCH`'s `slowk_matype` and
`slowd_matype`) takes an `MA_Type` value. The integer defaults shown in the
function docs are those values: `0` is `MA_Type.SMA`, and `MA_Type[n]` names
value `n`.

Calculating momentum of the close prices, with a time period of 5:

```python
Expand All @@ -45,6 +50,13 @@ Functions documented as having an unstable period start with that extra
unstable-period setting at ``0``. ``get_unstable_period()`` only returns a
non-zero value after you set one explicitly with ``set_unstable_period()``.

Instead of a count, ``set_unstable_period()`` also takes an Auto level. With
``talib.set_unstable_period('ALL', talib.UNSTABLE_AUTO_PREC_4)`` each function
works out how many leading values to discard, so that the first 4 significant
digits of what it returns no longer depend on where your data starts;
``UNSTABLE_AUTO_PREC_8`` targets 8. ``get_unstable_period()`` then returns the
level. See [Unstable Period](https://ta-lib.org/api/unstable-period/#auto).

Documentation for all functions:

* [Overlap Studies](func_groups/overlap_studies.md)
Expand Down
18 changes: 18 additions & 0 deletions docs/func_groups/cycle_indicators.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ NOTE: The ``HT_TRENDMODE`` function has an unstable period.
integer = HT_TRENDMODE(close)
```

### SWAK_2PHP - Swiss Army Knife - Two-Pole High-Pass Filter
NOTE: The ``SWAK_2PHP`` function has an unstable period.
```python
real = SWAK_2PHP(close, timeperiod=20)
```

### SWAK_BP - Swiss Army Knife - Band-Pass Filter
NOTE: The ``SWAK_BP`` function has an unstable period.
```python
real = SWAK_BP(close, timeperiod=20, delta=0.1)
```

### SWAK_HP - Swiss Army Knife - High-Pass Filter
NOTE: The ``SWAK_HP`` function has an unstable period.
```python
real = SWAK_HP(close, timeperiod=20)
```


[Documentation Index](../doc_index.md)
[FLOAT_RIGHTAll Function Groups](../funcs.md)
83 changes: 83 additions & 0 deletions docs/func_groups/momentum_indicators.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ aroondown, aroonup = AROON(high, low, timeperiod=14)
real = AROONOSC(high, low, timeperiod=14)
```

### ASI - Wilder Accumulative Swing Index
```python
real = ASI(open, high, low, close, limitmove=3)
```

### BOP - Balance Of Power
```python
real = BOP(open, high, low, close)
Expand All @@ -45,6 +50,21 @@ real = BOP(open, high, low, close)
real = CCI(high, low, close, timeperiod=14)
```

### CG - Center of Gravity Oscillator
```python
real = CG(close, timeperiod=10)
```

### CHOP - Choppiness Index
```python
real = CHOP(high, low, close, timeperiod=14)
```

### CHOPTR - Choppiness Index (True Range Box)
```python
real = CHOPTR(high, low, close, timeperiod=14)
```

### CMO - Chande Momentum Oscillator
NOTE: The ``CMO`` function has an unstable period.
```python
Expand All @@ -61,6 +81,21 @@ real = CMOU(close, timeperiod=14)
real = COPPOCK(close, wmaperiod=10, roc1period=11, roc2period=14)
```

### CRSI - Connors Relative Strength Index
```python
real = CRSI(close, timeperiod=3, streakperiod=2, rankperiod=100)
```

### CTI - Correlation Trend Indicator
```python
real = CTI(close, timeperiod=20)
```

### DOSC - Derivative Oscillator
```python
real = DOSC(close, timeperiod=14, firstperiod=5, secondperiod=3, signalperiod=9)
```

### DPO - Detrended Price Oscillator
```python
real = DPO(close, timeperiod=20)
Expand All @@ -82,6 +117,12 @@ real = ER(close, timeperiod=10)
bullpower, bearpower = ERI(high, low, close, timeperiod=13)
```

### FISHER - Fisher Transform
NOTE: The ``FISHER`` function has an unstable period.
```python
fisher, trigger = FISHER(high, low, timeperiod=10)
```

### FOSC - Forecast Oscillator
```python
real = FOSC(close, timeperiod=5)
Expand All @@ -92,6 +133,11 @@ real = FOSC(close, timeperiod=5)
swinghigh, swinglow = FRACTAL(high, low, leftbars=2, rightbars=2)
```

### IBS - Internal Bar Strength
```python
real = IBS(high, low, close)
```

### IMI - Intraday Momentum Index
```python
real = IMI(open, close, timeperiod=14)
Expand All @@ -102,6 +148,16 @@ real = IMI(open, close, timeperiod=14)
k, d, j = KDJ(high, low, close, fastk_period=9, slowk_period=3, slowk_matype=13, slowd_period=3, slowd_matype=13)
```

### KST - Know Sure Thing (Pring)
```python
kst, kstsignal = KST(close, roc1period=10, roc2period=15, roc3period=20, roc4period=30, sma1period=10, sma2period=10, sma3period=10, sma4period=15, signalperiod=9)
```

### KSTEXT - Know Sure Thing with controllable MA type
```python
kst, kstsignal = KSTEXT(close, roc1period=10, roc2period=15, roc3period=20, roc4period=30, ma1period=10, ma2period=10, ma3period=10, ma4period=15, signalperiod=9, rocmatype=0, signalmatype=0)
```

### MACD - Moving Average Convergence/Divergence
```python
macd, macdsignal, macdhist = MACD(close, fastperiod=12, slowperiod=26, signalperiod=9)
Expand Down Expand Up @@ -156,6 +212,11 @@ real = PLUS_DM(high, low, timeperiod=14)
real = PPO(close, fastperiod=12, slowperiod=26, matype=1)
```

### PSO - Premier Stochastic Oscillator
```python
real = PSO(high, low, close, fastk_period=8, emaperiod=5)
```

### QSTICK - Qstick
```python
real = QSTICK(open, close, timeperiod=10)
Expand Down Expand Up @@ -187,12 +248,29 @@ NOTE: The ``RSI`` function has an unstable period.
real = RSI(close, timeperiod=14)
```

### SI - Wilder Swing Index
```python
real = SI(open, high, low, close, limitmove=3)
```

### SMI - Stochastic Momentum Index
```python
smi, smisignal = SMI(high, low, close, timeperiod=13, fastperiod=2, slowperiod=25, signalperiod=9)
```

### SQZMOM - Squeeze Momentum and Level
```python
momentum, squeeze = SQZMOM(high, low, close, bbperiod=20, nbdev=2, kcperiod=20, factorwide=2, factornormal=1.5, factornarrow=1)
```

### STC - Schaff Trend Cycle
NOTE: The ``STC`` function has an unstable period.
```python
real = STC(close, fastperiod=23, slowperiod=50, cycleperiod=10)
```

### STOCH - Stochastic
NOTE: `slowk_matype` and `slowd_matype` take an `MA_Type` value. See [STOCH](https://ta-lib.org/functions/stoch) for the formula.
```python
slowk, slowd = STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=0, slowd_period=3, slowd_matype=0)
```
Expand Down Expand Up @@ -237,6 +315,11 @@ plusvi, minusvi = VORTEX(high, low, close, timeperiod=14)
real = WAD(high, low, close)
```

### WAVETREND - WaveTrend Oscillator
```python
wt1, wt2 = WAVETREND(high, low, close, channelperiod=10, averageperiod=21, signalperiod=4)
```

### WILLR - Williams' %R
```python
real = WILLR(high, low, close, timeperiod=14)
Expand Down
Loading
Loading