Skip to main content

A python package to calculate trends in stock markets.

Latest PyPI version

Installation

To install stable version from pypi, run

pip install stocktrends

To install latest code from github, run

pip install git+https://github.com/chillaranand/stocktrends

Usage

The following code from demo.py 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
2017-11-17,HDFCLIFE,EQ,290.0,310.0,369.0,307.0,343.9,344.6,327.26,168836552,5525288229115000.0,1177530,82044782,0.48590000000000005
2017-11-20,HDFCLIFE,EQ,344.6,344.7,358.9,344.0,355.0,355.35,353.18,14650240,517410581605000.0,166263,6761287,0.4615
2017-11-21,HDFCLIFE,EQ,355.35,356.4,418.9,352.5,386.9,385.3,389.24,43078194,1676786001315000.0,450090,11584111,0.26890000000000003
2017-11-22,HDFCLIFE,EQ,385.3,388.0,408.0,386.9,394.0,395.2,397.38,15227642,605123098895000.0,166870,3475999,0.22829999999999998
"""

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(data.head(rows))


print('\n\nPnF BOX data - based on "close" column')
pnf_data = pnf.get_ohlc_data(source='close')
print(pnf_data.head(rows))


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


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(data.tail(rows))


# 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()
print(data.tail(rows))

Metadata

Release files for stocktrends 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stocktrends 0.1.6
File Size Uploaded Provenance
stocktrends-0.1.6.tar.gz 17.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for stocktrends 0.1.6
File Interpreter ABI Platform
stocktrends-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 34.9 kB

Release files / stocktrends-0.1.6.tar.gz

Download URL stocktrends-0.1.6.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fab5017aad6fe9f7705e5e0c9d3b85c787be7d366ead56b867f8bd06847d92ff
BLAKE2b-256 checksum
How to use checksums
2eb90cdb44ebf8ace3ae3fdedd2754116f6b74daa7ad0a149d081721a940b8dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release files / stocktrends-0.1.6-py3-none-any.whl

Download URL stocktrends-0.1.6-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b6ea71ec235ee5c195ab5be929a16da9e923025e2e92c5e55ec2e9cede7ff41
BLAKE2b-256 checksum
How to use checksums
c97e2d13827d8ecd3907a960b77212d3fff06a9d65cbd0040b9266a744f5c9da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Security for stocktrends 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page