匡醍量化|大富翁量化

ta-lib v0.6.1: A 17-Year Update for Quant Developers

中文 📅 2024-12-31 👁 views this month —

As you read this, 2024 is drawing to a close, and the new year awaits our sprint. As quantitative researchers, what gifts will you receive in the coming year?

Let me share a personal gift I received. Early yesterday morning, I received a copy of Shanhe Du Cuiqiao (Mountains and Rivers Stand Alone in Desolation) from Mr. Sun Le, who thoughtfully inscribed it for me. Mr. Sun Le is a member of a democratic party, a director of the Jiangsu Provincial Collectors Association, deputy secretary-general of the Medal Collection Professional Committee, and a member of the American Numismatic Society.

The book’s preface contains this passage:

The essence of knowledge is considered to be "seeing" the world—seeing the essence and truth of things. This book is about understanding history from a different angle, turning "what is seen as what" and "what is not seen as what" into a philosophical act. I believe that quantitative investing, at its core, requires us to step back from data manifestations. "Seeing what as what" is finding patterns; "not seeing what as what" is filtering noise to preserve the signal.

A small anecdote here: The author originally preferred the title Jiangshan Duzi Cuiqiao (Rivers and Mountains Stand Alone in Desolation). While I’m not versed in phonology, I felt the former title was more resonant and rhythmic. However, the book includes over 100 exquisite images (color-printed on coated paper) without censorship or blurring—they represent the world as it was. I look forward to this book being listed on JD.com and Dangdang soon.

So, what kind of gift will you receive this New Year? As quantitative researchers, we have all received a major gift: ta-lib’s C library has been updated! hV3*ifARjC@cp8O!

ta-lib Reloaded!

Just before the New Year, ta-lib quietly released version 0.6.1. The previous version, 0.4.0, was released 17 years ago.

The reason for such a long hiatus was that the original author, Mario Fortier, hoped to find a younger developer to maintain the library. He felt unfamiliar with modern C++ language features, particularly cross-platform compilation. In reality, he is a highly experienced C++ network developer and invented a real-time data compression algorithm used in 3G communications. However, his recent work has shifted to Python, and he founded his own company (focused on blockchain and network software development).

Since he couldn’t find a successor, Mario decided to continue maintaining it himself. On December 23, he released version 0.6.1. This version did not add new features but primarily addressed compilation and automation tooling issues. Previously, installing ta-lib’s C library was not a smooth path for beginners, especially on Windows: users had to either accept the risk of malware or download several gigabytes of Visual Studio compilers from scratch. This is one of the reasons why Quantitative 24 Lessons includes a module on installing Ta-lib.

Version 0.6.1 received enthusiastic feedback, including bug reports. Consequently, just three days later, Mario released version 0.6.2. Thanks to the tooling improvements in 0.6.1, the new ta-lib’s maintainability has increased significantly, allowing new versions to be released within three days. This includes the introduction of GitHub Actions to automate the entire packaging and release process.

Now, installing ta-lib on Windows has become effortless:

However, its Python wrapper, although updated to 0.6.1, failed our installation tests. When installing python-talib (via pip install TA-Lib), it still prompts for vsc++ build tools 14. We trust this issue will be resolved shortly.

On macOS, installing the latest ta-lib is straightforward:

brew install ta-lib

If you previously installed an older version of ta-lib, the system will prompt you that this installation will update it.

On Debian-based Linux distributions (e.g., Ubuntu, Mint), installation is also easy. Download the *.deb package and execute:

sudo dpkg -i ta-lib_0.6.0_*.deb

The Linux version supports CPU architectures including 386, amd64, and arm64, with the asterisk matching the specific architecture. For other Linux distributions, you still need to build from source, though building on Linux is relatively straightforward.

ta-lib Ecosystem

The most important ecosystem component is ta-lib-python on GitHub. It has nearly 10,000 stars—a level typically occupied by AI projects—highlighting the rapid expansion of quantitative finance’s audience in recent years.

ta-lib-python has also responded quickly to ta-lib’s updates. The latest release, 0.5.2, is compatible with ta-lib 0.6.1. According to our tests, the installation process on macOS is smooth: installing the ta-lib C library first, followed by ta-lib-python, results in no errors. However, on Windows, even after installing the ta-lib C library via MSI, the Python wrapper still struggles to locate the installed C library and header files, requiring local compilation of the ta-lib C library.

While waiting for the ta-lib C library update, ta-lib-python was not idle. It completed a transition from SWIG to Cython for binding the C library, reportedly delivering a 2–4x performance improvement. More excitingly, with Python 3.13 releasing its GIL-Free mode, the author is experimenting with this GIL-Free version. Once Cython 3.1 is officially released (which ta-lib-python depends on), ta-lib-python will likely support GIL-Free immediately.

Another important ecosystem component is polars-talib, which is also under active development, albeit currently at version 0.1.4. It is an extension for Polars. According to tests, its calculation speed is over 100 times faster than using talib (via ta-lib-python) in Pandas.

Additionally, a Rust implementation of ta-lib is also in development.

Beautiful things are happening, precisely as this New Year approaches.

Next Stop

ta-lib’s next chapter promises to be even more exciting. With build and automation hurdles cleared, ta-lib can release new features faster and with less effort. For a long time, ta-lib lacked several popular technical indicators, such as KDJ, PVT, and TMO. The community has proposed 14 indicators to be implemented, two of which—RMA and PVI—are already on the roadmap.

tip

If you are struggling to discover new factors, consider implementing RMA and PVI yourself. There are reasons these indicators are prioritized. I am also eagerly anticipating the implementation of Connors RSI and the Awesome Oscillator.
![](https://cdn.jsdelivr.net/gh/zillionare/images@main/images/2024/12/talib-new-functions.jpg)

Join Us!

If you enjoy Quantide’s articles and wish to research, develop, and share quantitative strategies with us, welcome to join Quantide! We welcome the crazy ones, the misfits, and the rebels!

What’s hiding behind the bushes? Lion City: The Rise 2