A high performance python technical analysis library written in Rust and the Numpy C API.

Overview

Rust

Panther

A efficient, high-performance python technical analysis library written in Rust using PyO3 and rust-numpy.

Indicators

  • ATR
  • CMF
  • SMA
  • EMA
  • RSI
  • MACD
  • ROC

How to build (Windows)

  • Run cargo build --release from the main directory.
  • Get the generated dll from the target/release directory.
  • Rename extension from .dll to .pyd.
  • Place .pyd file in the same folder as script.
  • Put from panther import * in python script.

Speed

On average, I found the Panther calculations of these indicators to be about 9x or 900% faster than the industry standard way of calculating these indicators using Pandas. Don't believe me? Install the library and run the tests in the speed_tests directory to see it for yourself :)

License

MIT License

Copyright (c) 2022 Greg James

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • How to rename the compiled code released on MAC with M1 chip?

    How to rename the compiled code released on MAC with M1 chip?

    Hi,

    I run the cargo build --release script from the main directory, and libpanther.d and libpanther.dylib are created in the release folder along with many *.d and *.dylib files in the build and deps folder. How do I rename those files such that they can work with my python script?

    Any suggestions?

    opened by jeffrey82221 6
  • Technical analysis is cringe and a scam

    Technical analysis is cringe and a scam

    Firstly, this is a really cool library and some of it (SMA and EMA) is useful for things that aren't technical analysis.

    Secondly, you're clearly a smart guy and I can see you're interested in other quant trading and quant finance stuff. I would encourage you to focus on those things instead, because they are actually useful and won't be embarrassing like TA is. And also because the existence of a high-performance TA library like this serves to legitimize TA.

    opened by kevinheavey 6
  • Build and publish wheels on GitHub Actions using maturin-action

    Build and publish wheels on GitHub Actions using maturin-action

    Unfortunately the panther package name is already taken on PyPI: https://pypi.org/project/panther/ , so you need to rename the Python package.

    Fixes #3

    opened by messense 2
  • Weird initial values from ema function

    Weird initial values from ema function

    Something seems to be wrong in the init of the ema function. Just compare these two calculations from the speed_tests examples:

    # first 20 values of the panther ema function
    ema(data['Close'], 4)[:20]
    
    # first 20 values of the pandas implementation
    data['Close'].ewm(span=4, adjust=False).mean().head(20)
    

    Later on the values seems to be closer, but still not the same...

    bug 
    opened by Franky1 0
  • Process Pandas Dataframe instead of list?

    Process Pandas Dataframe instead of list?

    Usually Pandas Dataframes are used in all Python financial frameworks/workflows.

    Is it possible to rewrite the Rust functions so that they can directly process a Pandas dataframe? Currently everything has to be converted: DataFrame > List > Panther > List > DataFrame

    In addition, the speed_tests are not fully meaningful in this context, because the conversions to and from lists have to be counted.

    Add: I tried this out briefly. If you want to get it back into a pandas dataframe, all speed advantages are gone. Can you show a real workflow example with a pandas dataframe?

    enhancement 
    opened by Franky1 4
  • I get the error

    I get the error "linking with `cc` failed"

    warning: function is never used: sma_helper --> src/lib.rs:6:4 | 6 | fn sma_helper(price_ndarray: &Array1, period: usize) -> Array1{ | ^^^^^^^^^^ | = note: #[warn(dead_code)] on by default

    error: linking with cc failed: exit status: 1

    opened by cryp2one 3
Owner
Greg
Computer Science Major with a passion for FinTech, Blockchain, and Social media analysis.
Greg
Python+Rust implementation of the Probabilistic Principal Component Analysis model

Probabilistic Principal Component Analysis (PPCA) model This project implements a PPCA model implemented in Rust for Python using pyO3 and maturin. In

FindHotel 11 Dec 16, 2022
RustFFT is a high-performance FFT library written in pure Rust.

RustFFT is a high-performance FFT library written in pure Rust. It can compute FFTs of any size, including prime-number sizes, in O(nlogn) time.

Elliott Mahler 411 Jan 9, 2023
A Machine Learning Framework for High Performance written in Rust

polarlight polarlight is a machine learning framework for high performance written in Rust. Key Features TBA Quick Start TBA How To Contribute Contrib

Chris Ohk 25 Aug 23, 2022
A Python CLI tool that finds all third-party packages imported into your Python project

python-third-party-imports This is a Python CLI tool built with Rust that finds all third-party packages imported into your Python project. Install Yo

Maksudul Haque 24 Feb 1, 2023
High-performance runtime for data analytics applications

Weld Documentation Weld is a language and runtime for improving the performance of data-intensive applications. It optimizes across libraries and func

Weld 2.9k Jan 7, 2023
High-performance automatic differentiation of LLVM.

The Enzyme High-Performance Automatic Differentiator of LLVM Enzyme is a plugin that performs automatic differentiation (AD) of statically analyzable

William Moses 870 Jan 2, 2023
High performance distributed framework for training deep learning recommendation models based on PyTorch.

PERSIA (Parallel rEcommendation tRaining System with hybrId Acceleration) is developed by AI platform@Kuaishou Technology, collaborating with ETH. It

null 340 Dec 30, 2022
Damavand is a quantum circuit simulator. It can run on laptops or High Performance Computing architectures, such CPU distributed architectures or multi GPU distributed architectures.

Damavand is a code that simulates quantum circuits. In order to learn more about damavand, refer to the documentation. Development status Core feature

prevision.io 6 Mar 29, 2022
Your one stop CLI for ONNX model analysis.

Your one stop CLI for ONNX model analysis. Featuring graph visualization, FLOP counts, memory metrics and more! ⚡️ Quick start First, download and ins

Christopher Fleetwood 20 Dec 30, 2022
Robust and Fast tokenizations alignment library for Rust and Python

Robust and Fast tokenizations alignment library for Rust and Python

Yohei Tamura 14 Dec 10, 2022
Rust numeric library with R, MATLAB & Python syntax

Peroxide Rust numeric library contains linear algebra, numerical analysis, statistics and machine learning tools with R, MATLAB, Python like macros. W

Tae Geun Kim 351 Dec 29, 2022
Rust crate to create Anki decks. Based on the python library genanki

genanki-rs: A Rust Crate for Generating Anki Decks With genanki-rs you can easily generate decks for the popular open source flashcard platform Anki.

Yannick Funk 63 Dec 23, 2022
Network-agnostic, high-level game networking library for client-side prediction and server reconciliation.

WARNING: This crate currently depends on nightly rust unstable and incomplete features. crystalorb Network-agnostic, high-level game networking librar

Ernest Wong 175 Dec 31, 2022
A Rust library for interacting with OpenAI's ChatGPT API, providing an easy-to-use interface and strongly typed structures.

ChatGPT Rust Library A Rust library for interacting with OpenAI's ChatGPT API. This library simplifies the process of making requests to the ChatGPT A

Arend-Jan 6 Mar 23, 2023
Locality Sensitive Hashing in Rust with Python bindings

lsh-rs (Locality Sensitive Hashing) Locality sensitive hashing can help retrieving Approximate Nearest Neighbors in sub-linear time. For more informat

Ritchie Vink 65 Jan 2, 2023
Python package to compute levensthein distance in rust

Contents Introduction Installation Usage License Introduction Rust implementation of levensthein distance (https://en.wikipedia.org/wiki/Levenshtein_d

Thibault Blanc 2 Feb 21, 2022
Pyxirr - Rust-powered collection of financial functions for Python.

PyXIRR Rust-powered collection of financial functions. PyXIRR stands for "Python XIRR" (for historical reasons), but contains many other financial fun

Alexander Volkovsky 82 Jan 2, 2023
Rust-port of spotify/annoy as a wrapper for Approximate Nearest Neighbors in C++/Python optimized for memory usage.

Rust-port of spotify/annoy as a wrapper for Approximate Nearest Neighbors in C++/Python optimized for memory usage.

Arthur·Thomas 13 Mar 10, 2022
Rust-port of spotify/annoy as a wrapper for Approximate Nearest Neighbors in C++/Python optimized for memory usage.

Fareast This library is a rust port of spotify/annoy , currently only index serving is supported. It also provides FFI bindings for jvm, dotnet and da

Arthur·Thomas 13 Mar 10, 2022