Giter VIP home page Giter VIP logo

stocktrends's Introduction

stocktrends

A python package to calcuate 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

Check out demo.py file for detailed usage.

Create OHLC dataframe.

In [7]: import pandas as pd

In [8]: df = pd.read_csv('/home/chillaranand/stocks/HOOLI')

In [9]: df.head()
         date    open     high      low    close
0  2015-01-01  143.15  146.000  141.825  143.950
1  2015-01-02  144.05  148.025  142.150  142.775
2  2015-01-05  142.50  145.450  137.050  137.925
3  2015-01-06  135.00  136.500  116.000  118.050
4  2015-01-07  118.55  129.400  118.500  127.150

Renko chart calcuation

from stocktrends import Renko


renko = Renko(df)
renko.brick_size = 2
data = renko.get_ohlc_data()
print(data.tail())

# renko box calcuation based on periodic close
renko.chart_type = Renko.PERIOD_CLOSE
data = renko.get_ohlc_data()
print(data.tail())

# renko box calcuation based on price movement
renko.chart_type = Renko.PRICE_MOVEMENT
data = renko.get_ohlc_data()
print(data.tail())

LineBreak chart calcuation

from stocktrends import LineBreak


lb = LineBreak(df)
lb.line_number = 3
data = lb.get_ohlc_data()
print(data.tail())

PnF chart calcuation

from stocktrends import PnF


pnf = PnF(df)
pnf.box_size = 2
pnf.reversal_size = 3

# to get boxes information
data = pnf.get_ohlc_data()
print(data)

# to get OHLC for bars
data = pnf.get_bar_ohlc_data()
print(data)

# to get boxes information based on HIGH-LOW
data = pnf.get_ohlc_data(source='HL')
print(data)

# to get OHLC for bars
data = pnf.get_bar_ohlc_data(source='HL')
print(data)

stocktrends's People

Contributors

chillaranand avatar

Watchers

James Cloos avatar Neeraj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.