Skip to main content

Python package to plot stock, derivative(futures & options) 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.csv 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.csv')
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.

Source Distribution

stocktrends-0.1.5.tar.gz (4.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page