TA Charting tool
Project description
TAcharts
By: Carter Carlson
This repository provides technical tools to analyze OHLCV data, along with several TA chart functionalities. These functions are optimized for speed and utilize numpy vectorization over built-in pandas methods when possible.
indicators
atr(high, low, close, n=2)
: average true range from candlestick databollinger(df=None, filename=None, interval=None, n=20, ndev=2)
: Bollinger bands for the close of an instrumentcmf(df, n=2)
: Chaikin Money Flow of an OHLCV datasetdouble_smooth(src, n_slow, n_fast)
: The smoothed value of two EMAsema(src, n=2)
: exponential moving average for a list ofsrc
acrossn
periodsichimoku(df=None, filename=None, interval=None)
: Ichimoku Cloudmacd(src, slow=25, fast=13)
: moving average convergence/divergence ofsrc
mmo(src, n=2)
: Murrey Math oscillator ofsrc
renko(df=None, filename=None, interval=None)
: Renko Chartroc(src, n=2)
: rate of change ofsrc
acrossn
periodsrolling(src, n=2, fn=None, axis=1)
: rollingsum
,max
,min
, ormean
ofsrc
acrossn
periodsrsi(src, n=2)
: relative strength index ofsrc
acrossn
periodssdev(src, n=2)
: standard deviation across n periodssma(src, n=2)
: simple moving average ofsrc
acrossn
periodstd_sequential(src, n=2)
: TD sequential ofsrc
acrossn
periodstsi(src, slow=25, fast=13)
: true strength indicator
utils
area_between(line1, line2)
: find the area between line1 and line2crossover(x1, x2)
: find all instances of intersections between two linesdemo_df
: provide BTC's hourly OHLCV data in case no data is provideddraw_candlesticks(ax, df)
: add candlestick visuals to a matplotlib chartfill_values(averages, interval, target_len)
: Fill missing values with evenly spaced samples.- Example: You're using 15-min candlestick data to find the 1-hour moving average and want a value at every 15-min mark, and not every 1-hour mark.
group_candles(df, interval=4)
: combine candles so instead of needing a different dataset for each time interval, you can form time intervals using more precise data.- Example: you have 15-min candlestick data but want to test a strategy based on 1-hour candlestick data (
interval=4
).
- Example: you have 15-min candlestick data but want to test a strategy based on 1-hour candlestick data (
intersection(a0, a1, b0, b1)
: find the intersection coordinates between vector A and vector B
wrappers
@args_to_dtype(dtype)
: Convert all function arguments to a specific data typefrom TAcharts.wrappers import args_to_dtype # Example: `src` is converted to a list @args_to_dtype(list) def rsi(src, n=2): pass
@pd_series_to_np_array
: Convert function arguments frompd.Series
tonp.array
from TAcharts.wrappers import pd_series_to_np_array # Example: `high`, `low`, and `close` are all converted into `np.array` data types @pd_series_to_np_array def atr(high, low, close, n=14): pass
How it works
Create your DataFrame variable
# NOTE: File should contain the columns 'date', 'open', 'high', 'low', and 'close'
import pandas as pd
df = pd.read_csv('../Daily.csv')
Bollinger Bands
from TAcharts.indicators.bollinger import bollinger
from TAcharts.plot import plot
b = Bollinger(df)
b.build(n=20)
b.plot()
Ichimoku
from TAcharts.indicators.ichimoku import Ichimoku
from TAcharts.plot import plot
i = Ichimoku(df)
i.build(20, 60, 120, 30)
i.plot()
Renko
from TAcharts.indicators.renko import Renko
from TAcharts.plot import plot
r = Renko(df)
r.set_brick_size(auto=True, atr_period=2)
r.build()
r.plot()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
TAcharts-0.0.4.tar.gz
(12.5 kB
view hashes)
Built Distribution
TAcharts-0.0.4-py3-none-any.whl
(34.6 kB
view hashes)