Convert Figma logo to code with AI

peerchemist logofinta

Common financial technical indicators implemented in Pandas.

2,127
687
2,127
24

Top Related Projects

Python wrapper for TA-Lib (http://ta-lib.org/).

4,295

Technical Analysis Library using Pandas and Numpy

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

17,609

Zipline, a Pythonic Algorithmic Trading Library

Quick Overview

Finta is a Python library for calculating technical indicators in financial markets. It provides a comprehensive set of functions to compute various technical analysis indicators for stocks, cryptocurrencies, and other financial instruments. The library is designed to be easy to use and integrate with popular data analysis tools like pandas.

Pros

  • Extensive collection of technical indicators (over 80)
  • Compatible with pandas DataFrames for easy integration
  • Well-documented functions with clear parameter descriptions
  • Actively maintained and regularly updated

Cons

  • Limited to technical analysis indicators only
  • Requires basic knowledge of financial markets and technical analysis
  • May have performance limitations for large datasets
  • Some less common indicators might be missing

Code Examples

  1. Calculating Simple Moving Average (SMA):
from finta import TA
import pandas as pd

# Assuming 'df' is a pandas DataFrame with 'close' price column
sma = TA.SMA(df, period=14)
  1. Computing Relative Strength Index (RSI):
rsi = TA.RSI(df)
  1. Calculating Bollinger Bands:
bb = TA.BBANDS(df)
  1. Multiple indicators in one call:
indicators = TA.TA(df, ["SMA", "EMA", "RSI"], periods=[14, 20, 14])

Getting Started

To get started with Finta, follow these steps:

  1. Install the library using pip:

    pip install finta
    
  2. Import the library in your Python script:

    from finta import TA
    import pandas as pd
    
  3. Prepare your data in a pandas DataFrame with at least 'open', 'high', 'low', and 'close' columns.

  4. Calculate indicators using the TA class methods:

    df = pd.read_csv('your_data.csv')
    sma = TA.SMA(df, period=14)
    rsi = TA.RSI(df)
    macd = TA.MACD(df)
    
  5. Use the calculated indicators for further analysis or visualization.

Competitor Comparisons

Python wrapper for TA-Lib (http://ta-lib.org/).

Pros of ta-lib-python

  • Extensive library with over 150 technical indicators and chart patterns
  • Highly optimized C implementation for fast calculations
  • Well-established and widely used in the financial industry

Cons of ta-lib-python

  • Requires compilation of C extensions, which can be challenging on some systems
  • More complex installation process compared to pure Python libraries
  • Steeper learning curve due to its comprehensive nature

Code Comparison

ta-lib-python:

import talib
import numpy as np

close_prices = np.random.random(100)
sma = talib.SMA(close_prices, timeperiod=14)
rsi = talib.RSI(close_prices, timeperiod=14)

finta:

from finta import TA
import pandas as pd

ohlc = pd.DataFrame(...)  # OHLC data
sma = TA.SMA(ohlc, period=14)
rsi = TA.RSI(ohlc, period=14)

Key Differences

  • ta-lib-python works with NumPy arrays, while finta uses Pandas DataFrames
  • finta is a pure Python implementation, making it easier to install and modify
  • ta-lib-python offers more indicators and is generally faster for large datasets
  • finta has a simpler API and is more beginner-friendly

Both libraries serve similar purposes, but ta-lib-python is more comprehensive and performant, while finta is easier to use and integrate into existing Python projects.

4,295

Technical Analysis Library using Pandas and Numpy

Pros of ta

  • More comprehensive set of technical indicators and overlays
  • Better documentation and examples
  • Actively maintained with regular updates

Cons of ta

  • Slower performance for large datasets
  • More complex API, steeper learning curve
  • Heavier dependencies

Code Comparison

ta:

import pandas as pd
from ta import add_all_ta_features

df = pd.read_csv('your_data.csv')
df = add_all_ta_features(df, open="Open", high="High", low="Low", close="Close", volume="Volume")

finta:

from finta import TA
import pandas as pd

df = pd.read_csv('your_data.csv')
rsi = TA.RSI(df)
macd = TA.MACD(df)

Summary

ta offers a more extensive set of indicators and better documentation, making it suitable for complex analysis. However, it may be slower and more complex to use. finta is simpler and faster but has fewer features and less active maintenance. Choose based on your specific needs and performance requirements.

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

Pros of pandas-ta

  • More comprehensive set of technical indicators (130+)
  • Better integration with pandas DataFrame structure
  • More active development and community support

Cons of pandas-ta

  • Steeper learning curve due to more complex API
  • Potentially slower performance for simpler calculations

Code Comparison

finta:

from finta import TA

TA.SMA(df, 14)
TA.RSI(df, 14)

pandas-ta:

import pandas_ta as ta

df.ta.sma(length=14)
df.ta.rsi(length=14)

Key Differences

  • pandas-ta offers a more pandas-like syntax, allowing method chaining
  • finta uses a class-based approach, while pandas-ta extends pandas functionality
  • pandas-ta provides more customization options for indicators

Use Cases

  • finta: Simpler projects with basic technical analysis needs
  • pandas-ta: Advanced trading systems requiring a wide range of indicators and customization

Community and Support

  • pandas-ta has more frequent updates and a larger user base
  • finta is more lightweight and easier to get started with for beginners
17,609

Zipline, a Pythonic Algorithmic Trading Library

Pros of Zipline

  • Comprehensive backtesting engine for trading strategies
  • Integrates with Quantopian's research platform
  • Supports multiple asset classes and data sources

Cons of Zipline

  • Steeper learning curve due to complexity
  • Requires more setup and configuration
  • Less frequently updated (last commit over 2 years ago)

Code Comparison

Zipline example:

from zipline.api import order, record, symbol

def initialize(context):
    context.asset = symbol('AAPL')

def handle_data(context, data):
    order(context.asset, 10)
    record(AAPL=data.current(context.asset, 'price'))

Finta example:

from finta import TA
import pandas as pd

df = pd.read_csv('AAPL.csv')
sma = TA.SMA(df)
rsi = TA.RSI(df)

Summary

Zipline is a more comprehensive backtesting engine suitable for complex trading strategies, while Finta focuses on providing technical analysis indicators. Zipline offers a complete ecosystem for strategy development but requires more setup. Finta is simpler to use and integrate into existing projects, making it ideal for quick technical analysis tasks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

FinTA (Financial Technical Analysis)

License: LGPL v3 PyPI Downloads Code style: black Build Status Patrons Bitcoin Donate Peercoin Donate

Common financial technical indicators implemented in Pandas.

example

This is work in progress, bugs are expected and results of some indicators may not be accurate.

Supported indicators:

Finta supports over 80 trading indicators:

* Simple Moving Average 'SMA'
* Simple Moving Median 'SMM'
* Smoothed Simple Moving Average 'SSMA'
* Exponential Moving Average 'EMA'
* Double Exponential Moving Average 'DEMA'
* Triple Exponential Moving Average 'TEMA'
* Triangular Moving Average 'TRIMA'
* Triple Exponential Moving Average Oscillator 'TRIX'
* Volume Adjusted Moving Average 'VAMA'
* Kaufman Efficiency Indicator 'ER'
* Kaufman's Adaptive Moving Average 'KAMA'
* Zero Lag Exponential Moving Average 'ZLEMA'
* Weighted Moving Average 'WMA'
* Hull Moving Average 'HMA'
* Elastic Volume Moving Average 'EVWMA'
* Volume Weighted Average Price 'VWAP'
* Smoothed Moving Average 'SMMA'
* Fractal Adaptive Moving Average 'FRAMA'
* Moving Average Convergence Divergence 'MACD'
* Percentage Price Oscillator 'PPO'
* Volume-Weighted MACD 'VW_MACD'
* Elastic-Volume weighted MACD 'EV_MACD'
* Market Momentum 'MOM'
* Rate-of-Change 'ROC'
* Relative Strenght Index 'RSI'
* Inverse Fisher Transform RSI 'IFT_RSI'
* True Range 'TR'
* Average True Range 'ATR'
* Stop-and-Reverse 'SAR'
* Bollinger Bands 'BBANDS'
* Bollinger Bands Width 'BBWIDTH'
* Momentum Breakout Bands 'MOBO'
* Percent B 'PERCENT_B'
* Keltner Channels 'KC'
* Donchian Channel 'DO'
* Directional Movement Indicator 'DMI'
* Average Directional Index 'ADX'
* Pivot Points 'PIVOT'
* Fibonacci Pivot Points 'PIVOT_FIB'
* Stochastic Oscillator %K 'STOCH'
* Stochastic oscillator %D 'STOCHD'
* Stochastic RSI 'STOCHRSI'
* Williams %R 'WILLIAMS'
* Ultimate Oscillator 'UO'
* Awesome Oscillator 'AO'
* Mass Index 'MI'
* Vortex Indicator 'VORTEX'
* Know Sure Thing 'KST'
* True Strength Index 'TSI'
* Typical Price 'TP'
* Accumulation-Distribution Line 'ADL'
* Chaikin Oscillator 'CHAIKIN'
* Money Flow Index 'MFI'
* On Balance Volume 'OBV'
* Weighter OBV 'WOBV'
* Volume Zone Oscillator 'VZO'
* Price Zone Oscillator 'PZO'
* Elder's Force Index 'EFI'
* Cummulative Force Index 'CFI'
* Bull power and Bear Power 'EBBP'
* Ease of Movement 'EMV'
* Commodity Channel Index 'CCI'
* Coppock Curve 'COPP'
* Buy and Sell Pressure 'BASP'
* Normalized BASP 'BASPN'
* Chande Momentum Oscillator 'CMO'
* Chandelier Exit 'CHANDELIER'
* Qstick 'QSTICK'
* Twiggs Money Index 'TMF'
* Wave Trend Oscillator 'WTO'
* Fisher Transform 'FISH'
* Ichimoku Cloud 'ICHIMOKU'
* Adaptive Price Zone 'APZ'
* Squeeze Momentum Indicator 'SQZMI'
* Volume Price Trend 'VPT'
* Finite Volume Element 'FVE'
* Volume Flow Indicator 'VFI'
* Moving Standard deviation 'MSD'
* Schaff Trend Cycle 'STC'
* Mark Whistler's WAVE PM 'WAVEPM'

Dependencies:

  • python (3.6+)
  • pandas (1.0.0+)

TA class is very well documented and there should be no trouble exploring it and using with your data. Each class method expects proper ohlc DataFrame as input.

Install:

pip install finta

or latest development version:

pip install git+git://github.com/peerchemist/finta.git

Import

from finta import TA

Prepare data to use with finta:

finta expects properly formated ohlc DataFrame, with column names in lowercase: ["open", "high", "low", "close"] and ["volume"] for indicators that expect ohlcv input.

to resample by time period (you can choose different time period)

ohlc = resample(df, "24h")

You can also load a ohlc DataFrame from .csv file

data_file = ("data/bittrex:btc-usdt.csv")

ohlc = pd.read_csv(data_file, index_col="date", parse_dates=True)


Examples:

will return Pandas Series object with the Simple moving average for 42 periods

TA.SMA(ohlc, 42)

will return Pandas Series object with "Awesome oscillator" values

TA.AO(ohlc)

expects ["volume"] column as input

TA.OBV(ohlc)

will return Series with Bollinger Bands columns [BB_UPPER, BB_LOWER]

TA.BBANDS(ohlc)

will return Series with calculated BBANDS values but will use KAMA instead of MA for calculation, other types of Moving Averages are allowed as well.

TA.BBANDS(ohlc, MA=TA.KAMA(ohlc, 20))

For more examples see examples directory.


I welcome pull requests with new indicators or fixes for existing ones. Please submit only indicators that belong in public domain and are royalty free.

Contributing

  1. Fork it (https://github.com/peerchemist/finta/fork)
  2. Study how it's implemented.
  3. Create your feature branch (git checkout -b my-new-feature).
  4. Run black code formatter on the finta.py to ensure uniform code style.
  5. Commit your changes (git commit -am 'Add some feature').
  6. Push to the branch (git push origin my-new-feature).
  7. Create a new Pull Request.