Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 0xdevalias/00e23f50449e32a5f87dad06d01bfe23 to your computer and use it in GitHub Desktop.
Save 0xdevalias/00e23f50449e32a5f87dad06d01bfe23 to your computer and use it in GitHub Desktop.
Some notes, references, and resources on tools, libraries, frameworks, and concepts for building, testing, and running algo / quant / automated trading systems and strategies.

Algorithmic Trading / Quant Trading / Systematic Trading / Automated Trading / etc

Some notes, references, and resources on tools, libraries, frameworks, and concepts for building, testing, and running algo / quant / automated trading systems and strategies.

Table of Contents

Libraries

Hyperparameter Optimization

  • https://github.com/optuna/optuna
    • Optuna: A hyperparameter optimization framework

    • Optuna is an automatic hyperparameter optimization software framework, particularly designed for machine learning. It features an imperative, define-by-run style user API. Thanks to our define-by-run API, the code written with Optuna enjoys high modularity, and the user of Optuna can dynamically construct the search spaces for the hyperparameters.

    • https://optuna.org/
      • Optimize Your Optimization

      • An open source hyperparameter optimization framework to automate hyperparameter search

    • https://optuna.readthedocs.io/
      • Optuna: A hyperparameter optimization framework

      • Optuna is an automatic hyperparameter optimization software framework, particularly designed for machine learning. It features an imperative, define-by-run style user API. Thanks to our define-by-run API, the code written with Optuna enjoys high modularity, and the user of Optuna can dynamically construct the search spaces for the hyperparameters.

Numerical & Data Analysis

  • https://github.com/numpy/numpy
    • NumPy is the fundamental package for scientific computing with Python.

    • https://numpy.org/
        • Powerful N-dimensional arrays: Fast and versatile, the NumPy vectorization, indexing, and broadcasting concepts are the de-facto standards of array computing today.
        • Numerical computing tools: NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more.
        • Interoperable: NumPy supports a wide range of hardware and computing platforms, and plays well with distributed, GPU, and sparse array libraries.
        • Performant: The core of NumPy is well-optimized C code. Enjoy the flexibility of Python with the speed of compiled code.
        • Easy to use: NumPy’s high level syntax makes it accessible and productive for programmers from any background or experience level.
        • Open source: Distributed under a liberal BSD license, NumPy is developed and maintained publicly on GitHub by a vibrant, responsive, and diverse community.
  • https://github.com/scipy/scipy
    • SciPy (pronounced "Sigh Pie") is an open-source software for mathematics, science, and engineering. It includes modules for statistics, optimization, integration, linear algebra, Fourier transforms, signal and image processing, ODE solvers, and more.

    • https://scipy.org/
        • Fundamental algorithms: SciPy provides algorithms for optimization, integration, interpolation, eigenvalue problems, algebraic equations, differential equations, statistics and many other classes of problems.
        • Broadly applicable: The algorithms and data structures provided by SciPy are broadly applicable across domains.
        • Foundational: Extends NumPy providing additional tools for array computing and provides specialized data structures, such as sparse matrices and k-dimensional trees.
        • Performant: SciPy wraps highly-optimized implementations written in low-level languages like Fortran, C, and C++. Enjoy the flexibility of Python with the speed of compiled code.
        • Easy to use: SciPy’s high level syntax makes it accessible and productive for programmers from any background or experience level.
        • Open source: Distributed under a liberal BSD license, SciPy is developed and maintained publicly on GitHub by a vibrant, responsive, and diverse community.
  • https://github.com/statsmodels/statsmodels
    • Statsmodels: statistical modeling and econometrics in Python

    • statsmodels is a Python package that provides a complement to scipy for statistical computations including descriptive statistics and estimation and inference for statistical models.

    • https://www.statsmodels.org/
    • statsmodels is a Python module that provides classes and functions for the estimation of many different statistical models, as well as for conducting statistical tests, and statistical data exploration. An extensive list of result statistics are available for each estimator. The results are tested against existing statistical packages to ensure that they are correct. The package is released under the open source Modified BSD (3-clause) license.

  • https://github.com/numba/numba
    • Numba

    • NumPy aware dynamic Python compiler using LLVM

    • A Just-In-Time Compiler for Numerical Functions in Python

    • Numba is an open source, NumPy-aware optimizing compiler for Python sponsored by Anaconda, Inc. It uses the LLVM compiler project to generate machine code from Python syntax.

      Numba can compile a large subset of numerically-focused Python, including many NumPy functions. Additionally, Numba has support for automatic parallelization of loops, generation of GPU-accelerated code, and creation of ufuncs and C callbacks.

    • https://numba.pydata.org/
      • Numba is an open source JIT compiler that translates a subset of Python and NumPy code into fast machine code.

  • https://github.com/pandas-dev/pandas
    • pandas: A Powerful Python Data Analysis Toolkit

    • pandas is a Python package that provides fast, flexible, and expressive data structures designed to make working with "relational" or "labeled" data both easy and intuitive. It aims to be the fundamental high-level building block for doing practical, real world data analysis in Python. Additionally, it has the broader goal of becoming the most powerful and flexible open source data analysis / manipulation tool available in any language. It is already well on its way towards this goal.

    • https://pandas.pydata.org/
      • pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.

  • https://github.com/pola-rs/polars/
    • Polars: Blazingly fast DataFrames in Rust, Python, Node.js, R, and SQL

    • Dataframes powered by a multithreaded, vectorized query engine, written in Rust

    • Polars is a DataFrame interface on top of an OLAP Query Engine implemented in Rust using Apache Arrow Columnar Format as the memory model.

      • Lazy | eager execution
      • Multi-threaded
      • SIMD
      • Query optimization
      • Powerful expression API
      • Hybrid Streaming (larger-than-RAM datasets)
      • Rust | Python | NodeJS | R | ...
    • https://pola.rs/
      • Polars is an open-source library for data manipulation, known for being one of the fastest data processing solutions on a single machine. It features a well-structured, typed API that is both expressive and easy to use.

        • Fast: Polars is written from the ground up with performance in mind. Its multi-threaded query engine is written in Rust and designed for effective parallelism. Its vectorized and columnar processing enables cache-coherent algorithms and high performance on modern processors.
        • Easy to use: You will feel right at home with Polars if you are familiar with data wrangling. Its expressions are intuitive and empower you to write code which is readable and performant at the same time.
        • Open source: Polars is and always will be open source. Driven by an active community of developers, everyone is encouraged to add new features and contribute. Polars is free to use under the MIT license.
      • Built by developers for developers to achieve up to 50x performance

        • Polars was benchmarked in a derived version of the independent TPC-H benchmark against several other solutions. This benchmark aims to replicate data wrangling operations used in practice. Polars easily trumps other solutions due to its parallel execution engine, efficient algorithms and use of vectorization with SIMD (Single Instruction, Multiple Data). Compared to pandas, it can achieve more than 30x performance gains.

    • https://docs.pola.rs/
      • Polars User Guide

    • https://docs.pola.rs/api/reference/
      • Reference Guide

      • The API reference contains detailed descriptions of all public functions and objects. It's the best place to look if you need information on a specific function.

      • Python: The Python API reference is built using Sphinx. It's available in our docs.

      • Rust: The Rust API reference is built using Cargo. It's available on docs.rs.

        • Polars: DataFrames in Rust

        • Polars is a DataFrame library for Rust. It is based on Apache Arrow’s memory model. Apache Arrow provides very cache efficient columnar data structures and is becoming the defacto standard for columnar data.

    • https://docs.pola.rs/user-guide/gpu-support/
      • GPU Support [Open Beta]

      • Polars provides an in-memory, GPU-accelerated execution engine for Python users of the Lazy API on NVIDIA GPUs using RAPIDS cuDF. This functionality is available in Open Beta and is undergoing rapid development.

  • https://github.com/rapidsai/cudf
    • cuDF - GPU DataFrame Library

    • cuDF (pronounced "KOO-dee-eff") is a GPU DataFrame library for loading, joining, aggregating, filtering, and otherwise manipulating data. cuDF leverages libcudf, a blazing-fast C++/CUDA dataframe library and the Apache Arrow columnar format to provide a GPU-accelerated pandas API.

    • You can import cudf directly and use it like pandas

    • Or, you can use cuDF as a no-code-change accelerator for pandas, using cudf.pandas. cudf.pandas supports 100% of the pandas API, utilizing cuDF for supported operations and falling back to pandas when needed

    • https://docs.rapids.ai/api/cudf/stable/
      • cuDF documentation

      • cuDF (pronounced “KOO-dee-eff”) is a Python GPU DataFrame library (built on the Apache Arrow columnar memory format) for loading, joining, aggregating, filtering, and otherwise manipulating data. cuDF also provides a pandas-like API that will be familiar to data engineers & data scientists, so they can use it to easily accelerate their workflows without going into the details of CUDA programming.

      • https://docs.rapids.ai/api/cudf/stable/cudf_pandas/
        • cudf.pandas

        • cuDF pandas accelerator mode (cudf.pandas) is built on cuDF and accelerates pandas code on the GPU. It supports 100% of the Pandas API, using the GPU for supported operations, and automatically falling back to pandas for other operations.

        • https://docs.rapids.ai/api/cudf/stable/cudf_pandas/benchmarks/
          • Benchmarks

      • https://docs.rapids.ai/api/cudf/stable/cudf_polars/
        • Polars GPU engine

        • cuDF provides an in-memory, GPU-accelerated execution engine for Python users of the Polars Lazy API. The engine supports most of the core expressions and data types as well as a growing set of more advanced dataframe manipulations and data file formats. When using the GPU engine, Polars will convert expressions into an optimized query plan and determine whether the plan is supported on the GPU. If it is not, the execution will transparently fall back to the standard Polars engine and run on the CPU. This functionality is available in Open Beta, is undergoing rapid development, and is currently a single GPU implementation.

        • To learn more, visit the GPU Support page on the Polars website.

      • https://docs.rapids.ai/api/cudf/stable/user_guide/
        • cuDF User Guide

        • https://docs.rapids.ai/api/cudf/stable/user_guide/pandas-comparison/
          • Comparison of cuDF and Pandas

          • cuDF is a DataFrame library that closely matches the Pandas API, but when used directly is not a full drop-in replacement for Pandas. There are some differences between cuDF and Pandas, both in terms of API and behaviour. This page documents the similarities and differences between cuDF and Pandas.

          • Starting with the v23.10.01 release, cuDF also provides a pandas accelerator mode (cudf.pandas) that supports 100% of the pandas API and accelerates pandas code on the GPU without requiring any code change. See the cudf.pandas documentation.

        • https://docs.rapids.ai/api/cudf/stable/user_guide/10min/
          • 10 Minutes to cuDF and Dask cuDF

          • Modelled after 10 Minutes to Pandas, this is a short introduction to cuDF and Dask cuDF, geared mainly towards new users.

          • What are these Libraries?

            • cuDF is a Python GPU DataFrame library (built on the Apache Arrow columnar memory format) for loading, joining, aggregating, filtering, and otherwise manipulating tabular data using a DataFrame style API in the style of pandas.
            • Dask is a flexible library for parallel computing in Python that makes scaling out your workflow smooth and simple. On the CPU, Dask uses Pandas to execute operations in parallel on DataFrame partitions.
            • Dask cuDF extends Dask where necessary to allow its DataFrame partitions to be processed using cuDF GPU DataFrames instead of Pandas DataFrames. For instance, when you call dask_cudf.read_csv(...), your cluster’s GPUs do the work of parsing the CSV file(s) by calling cudf.read_csv().
          • When to use cuDF and Dask cuDF

            If your workflow is fast enough on a single GPU or your data comfortably fits in memory on a single GPU, you would want to use cuDF. If you want to distribute your workflow across multiple GPUs, have more data than you can fit in memory on a single GPU, or want to analyze data spread across many files at once, you would want to use Dask cuDF.

  • https://github.com/dask/dask
    • Dask

    • Parallel computing with task scheduling

    • Dask is a flexible parallel computing library for analytics.

    • https://www.dask.org/
      • Dask

      • Easy Parallel Python that does what you need

      • Dask DataFrames use pandas under the hood, so your current code likely just works. It’s faster than Spark and easier too.

Technical Analysis

  • https://ta-lib.org/
  • https://pypi.org/project/pandas-ta/
    • An easy to use Python 3 Pandas Extension with 130+ Technical Analysis Indicators. Can be called from a Pandas DataFrame or standalone like TA-Lib. Correlation tested with TA-Lib.

    • https://github.com/twopirllc/pandas-ta
      • Note: As of 2025-08-11, this repo is no longer public/available.
        • https://github.com/twopirllc
          • Pandas TA has moved!

            The current version is 0.4.25b with a pip release available after July 1st, 2025. Future releases after July 1st, 2025 will be subject to paid releases for businesses and organizations and subscription-based options for others.

            • https://www.pandas-ta.dev/
              • A popular and comprehensive Technical Analysis Library in Python 3 that leverages numba and numpy for accuracy and performance, and pandas for simplicity and bulk processing. The library contains more than 150 indicators and utilities as well as 60 Candlestick Patterns when TA Lib is installed.

              • IMPORTANT

                Thanks to all those that have sponsored and dontated to the library in the past! Your support has been greatly appreciated! 🙏

                Only Installation Bugs/Issues will addressed for releases between versions 0.4.25b and 0.4.66b. Releases beyond version 0.4.66b will only be released after significant donations, sponsorships or yearly subscriptions have been received via Buy Me a Coffee.

                Support Tiers coming soon!

        • https://www.pandas-ta.dev/api/
          • Documentation

      • https://www.reddit.com/r/algotrading/comments/1ldm0kb/what_happened_to_pandasta_python_package/
        • What happened to pandas-ta python package?

        • I was using pandas-ta, but today I noticed that the GitHub repo is gone - https://twopirllc.github.io/pandas-ta/

          Does anyone know what happened to it?

          Additionally, I came across this website, but there are no open-source aspects seen - https://www.pandas-ta.dev/

          Edit: After a couple of hours of wild goose chase, I was able to recover a version of the codebase from June 2024 and renamed the project as pandas-ta-classic for a separate OSS project: https://github.com/xgboosted/pandas-ta-classic

          • https://github.com/xgboosted/pandas-ta-classic
            • Pandas TA Classic - A Technical Analysis Library in Python 3

            • Technical Analysis Indicators - Pandas TA Classic is an easy to use Python 3 Pandas Extension with 150+ Indicators

            • Pandas Technical Analysis (Pandas TA Classic) is an easy to use library that leverages the Pandas package with more than 130 Indicators and Utility functions and more than 60 TA Lib Candlestick Patterns. Many commonly used indicators are included, such as: Candle Pattern(cdl_pattern), Simple Moving Average (sma) Moving Average Convergence Divergence (macd), Hull Exponential Moving Average (hma), Bollinger Bands (bbands), On-Balance Volume (obv), Aroon & Aroon Oscillator (aroon), Squeeze (squeeze) and many more.

            • This is the classic/community maintained version of the popular pandas-ta library.

  • https://github.com/peerchemist/finta
    • FinTA (Financial Technical Analysis)

    • Common financial technical indicators implemented in Pandas.

    • This repository was archived by the owner on Sep 3, 2022. It is now read-only.

  • https://github.com/mementum/bta-lib
    • bta-lib - A pandas based Technical Analysis Library

    • bta-lib is pandas based technical analysis library and part of the backtrader family.

    • Technical Analysis library in pandas for backtesting algotrading and quantitative analysis

Visualisation

Papers with Backtest

VeighNa (vnpy)

  • https://www.vnpy.com/
    • VeighNa Quantitative Community - Your open source community quantitative trading platform | vn.py | vnpy

    • Python-based open source quantitative trading platform development framework

    • By Traders, For Traders

    • Rich interfaces

      • Supports a large number of high-performance trading gateway interfaces, including futures, options, stocks, futures options, gold T+d, interbank fixed income, foreign markets, etc.

    • Ready to use out of the box

      • Built-in many mature quantitative trading strategy App modules, users can freely choose to manage through the GUI graphical interface mode, or use the CLI script command line mode to run

    • Free expansion

      • Combining the core architecture of the event-driven engine and the glue language features of Python, users can quickly connect to new trading interfaces or develop upper-level strategy applications according to their needs.

    • Open source platform

      • Following the open and flexible MIT open source agreement, you can obtain all project source code on Github and freely use it in your own open source projects or commercial projects, and it is permanently free.

    • https://www.vnpy.com/docs/
  • https://github.com/vnpy?tab=repositories
  • https://github.com/vnpy/vnpy
    • VeighNa - By Traders, For Traders, AI-Powered.

    • https://github.com/vnpy/vnpy/blob/master/README_ENG.md
      • VeighNa is a Python-based open source quantitative trading system development framework that has grown step by step into a fully-featured quantitative trading platform with continuous contributions from the open source community. It currently has many users from domestic and international financial institutions, including hedge funds, investment banks, futures brokers, university research institutions, proprietary trading companies, etc.

      • The VeighNa Elite Quantitative Terminal for professional traders has been officially released, providing comprehensive support for professional traders' needs in areas such as massive strategy concurrency, intelligent position rolling, algorithmic order execution, multi-account trading support, and more.

      • AI-Powered: On the tenth anniversary of VeighNa's release, version 4.0 officially introduces the vnpy.alpha module targeting AI quantitative strategies, providing professional quantitative traders with an all-in-one multi-factor machine learning (ML) strategy development, research, and live trading solution

    • https://github.com/vnpy/vnpy_algotrading
      • Algorithmic trading module of VeighNa framework

      • AlgoTrading is a functional module for algorithmic trading execution. It provides a variety of commonly used intelligent trading algorithms: TWAP, Sniper, Iceberg, BestLimit, etc. It supports multiple calling methods such as UI interface, CSV batch import, external module access, etc.

Unsorted

  • https://github.com/freqtrade/freqtrade
    • Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram or webUI. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning.

    • https://www.freqtrade.io/
  • https://github.com/polakowo/vectorbt
    • vectorbt allows you to easily backtest strategies with a couple of lines of Python code.

    • Find your trading edge, using the fastest engine for backtesting, algorithmic trading, and research.

    • https://vectorbt.dev/
      • vectorbt is a Python package for quantitative analysis that takes a novel approach to backtesting: it operates entirely on pandas and NumPy objects, and is accelerated by Numba to analyze any data at speed and scale. This allows for testing of many thousands of strategies in seconds.

        In contrast to other backtesters, vectorbt represents complex data as (structured) NumPy arrays. This enables superfast computation using vectorized operations with NumPy and non-vectorized but dynamically compiled operations with Numba. It also integrates Plotly and Jupyter Widgets to display complex charts and dashboards akin to Tableau right in the Jupyter notebook. Due to high performance, vectorbt can process large amounts of data even without GPU and parallelization and enables the user to interact with data-hungry widgets without significant delays.

      • https://vectorbt.dev/#example
  • https://github.com/pmorissette/bt
    • bt - flexible backtesting for Python

    • bt is a flexible backtesting framework for Python used to test quantitative trading strategies. Backtesting is the process of testing a strategy over a given data set. This framework allows you to easily create strategies that mix and match different Algos. It aims to foster the creation of easily testable, re-usable and flexible blocks of strategy logic to facilitate the rapid development of complex trading strategies.

      The goal: to save quants from re-inventing the wheel and let them focus on the important part of the job - strategy development.

    • https://pmorissette.github.io/bt/
    • bt is built atop ffn - a financial function library for Python.

      • https://github.com/pmorissette/ffn
        • ffn - Financial Functions for Python

        • ffn is a library that contains many useful functions for those who work in quantitative finance. It stands on the shoulders of giants (Pandas, Numpy, Scipy, etc.) and provides a vast array of utilities, from performance measurement and evaluation to graphing and common data transformations.

        • If you are looking for a full backtesting framework, please check out bt. bt is built atop ffn and makes it easy and fast to backtest quantitative strategies.

  • https://github.com/mementum/backtrader
    • backtrader

    • Python Backtesting library for trading strategies

    • Note: Last commit was from 2023-04-20
    • https://www.backtrader.com/
      • A feature-rich Python framework for backtesting and trading

      • backtrader allows you to focus on writing reusable trading strategies, indicators and analyzers instead of having to spend time building infrastructure.

  • https://github.com/quantopian/zipline
    • Zipline, a Pythonic Algorithmic Trading Library

    • Zipline is a Pythonic algorithmic trading library. It is an event-driven system for backtesting. Zipline is currently used in production as the backtesting and live-trading engine powering Quantopian -- a free, community-centered, hosted platform for building and executing trading strategies. Quantopian also offers a fully managed service for professionals that includes Zipline, Alphalens, Pyfolio, FactSet data, and more.

    • Note: Last commit was from 2020-10-15
  • https://github.com/ccxt/ccxt
    • CCXT – CryptoCurrency eXchange Trading Library

    • A JavaScript / Python / PHP / C# / Go library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs.

    • A JavaScript / TypeScript / Python / C# / PHP / Go cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges

    • The CCXT library is used to connect and trade with cryptocurrency exchanges and payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, and related software engineering.

      It is intended to be used by coders, developers, technically-skilled traders, data-scientists and financial analysts for building trading algorithms.

      Current feature list:

      • support for many cryptocurrency exchanges — more coming soon
      • fully implemented public and private APIs
      • optional normalized data for cross-exchange analytics and arbitrage
      • an out of the box unified API that is extremely easy to integrate
      • works in Node 10.4+, Python 3, PHP 8.1+, netstandard2.0/2.1, Go 1.20+ and web browsers
    • https://docs.ccxt.com/
      • The ccxt library is a collection of available crypto exchanges or exchange classes. Each class implements the public and private API for a particular crypto exchange. All exchanges are derived from the base Exchange class and share a set of common methods. To access a particular exchange from ccxt library you need to create an instance of corresponding exchange class. Supported exchanges are updated frequently and new exchanges are added regularly.

  • https://github.com/ranaroussi/yfinance
  • https://github.com/ranaroussi/quantstats
    • QuantStats: Portfolio analytics for quants

    • QuantStats Python library that performs portfolio profiling, allowing quants and portfolio managers to understand their performance better by providing them with in-depth analytics and risk metrics.

    • Portfolio analytics for quants, written in Python

See Also

My Other Related Deepdive Gist's and Projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment