Skip to main content

Python package to plot stock trends with charts like renko, line break, pnf etc

Project description

A python package to calcuate trends in stock markets.

Latest PyPI version


To install stable version from pypi, run

pip install stocktrends

To install latest code from github, run

pip install git+


The following code from file shows how to construct dataframe from a csv file and then plot Renko, Line Break and PnF charts.
Sample data from tests/HDFCLIFE file.

Date,Symbol,Series,Prev Close,Open,High,Low,Last,Close,VWAP,Volume,Turnover,Trades,Deliverable Volume,%Deliverble

import pandas as pd

from stocktrends import indicators

df = pd.read_csv('tests/HDFCLIFE')
df.columns = [i.lower() for i in df.columns]
rows = 5

pnf = indicators.PnF(df)
pnf.box_size = 10
pnf.reversal_size = 3

print('\n\nPnF bar data - based on close column')
data = pnf.get_bar_ohlc_data(source='close')

print('\n\nPnF box data - based on close column')
pnf_data = pnf.get_ohlc_data(source='close')

print('\n\nPnF box data - based on high/low columns')
data = pnf.get_bar_ohlc_data(source='hl')

renko = indicators.Renko(df)

print('\n\nRenko box calcuation based on periodic close')
renko.brick_size = 2
renko.chart_type = indicators.Renko.PERIOD_CLOSE
data = renko.get_ohlc_data()

# print('\n\nRenko box calcuation based on price movement')
# renko.chart_type = indicators.Renko.PRICE_MOVEMENT
# data = renko.get_ohlc_data()
# print(data.tail(rows))

lb = indicators.LineBreak(df)

print('\n\nLine break chart')
lb.line_number = 3
data = lb.get_ohlc_data()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for stocktrends, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size stocktrends-0.1.4.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page