An event-based backtester with a tree-hierarchy written in Crystal lang.

Build Status

Tree-Based Algorithmic Backtester

A modular, tree-based algorithmic backtester. The backtester is event-driven, has a historical stock price downloader via Tiingo's API and integrates with TA-Lib to integrate technical analysis into strategies.


Add algo-backtester to your shards.yml.


To use the TA-Lib integration, you need to have the TA-Lib already installed. You should probably follow their installation directions for your platform, but some suggestions are included below for reference.

Mac OS X
$ brew install ta-lib

Download and unzip to C:\ta-lib.

This is a 32-bit binary release. If you want to use 64-bit Python, you will need to build a 64-bit version of the library. Some unofficial (and unsupported) instructions for building on 64-bit Windows 10, here for reference:

  1. Download and Unzip
  2. Move the Unzipped Folder ta-lib to C:\
  3. Download and Install Visual Studio Community 2015
    • Remember to Select [Visual C++] Feature
  4. Build TA-Lib Library
    • From Windows Start Menu, Start [VS2015 x64 Native Tools Command Prompt]
    • Move to C:\ta-lib\c\make\cdr\win32\msvc
    • Build the Library nmake

You might also try these unofficial windows binaries for both 32-bit and 64-bit:


Download ta-lib-0.4.0-src.tar.gz and:

$ tar -xzf ta-lib-0.4.0-src.tar.gz
$ cd ta-lib/
$ ./configure --prefix=/usr
$ make
$ sudo make install

If you build TA-Lib using make -jX it will fail but that's OK! Simply rerun make -jX followed by [sudo] make install.


  • TA-Lib
  • Crystal dependencies (installed automatically via shards install):
    • VCR (for caching API requests)
    • halite (HTTP requests)
    • crystal_talib (TA-Lib C bindings)


See examples/ directory for various examples on how to use this library.



  • Improve documentation
  • Add algorithms for more TA-Lib functions (currently just shows SMA as a prototype)
  • Compute + print more statistics (currently only shows Sharpe, Sortino and Cumulative Return)


  1. Fork it (
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request


github statistic
  • 0
  • 0
  • 1
  • 0
  • over 1 year ago
  • October 25, 2019

MIT License

Synced at

Thu, 13 May 2021 15:58:16 GMT