• Stars
    star
    322
  • Rank 129,650 (Top 3 %)
  • Language
    Python
  • License
    Other
  • Created almost 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A library to calculate Market Profile (aka Volume Profile) for financial data from a Pandas DataFrame.

Market Profile

Travis-CI Build Status Documentation Status

A library to calculate Market Profile (Volume Profile) from a Pandas DataFrame. This library expects the DataFrame to have an index of timestamp and columns for each of the OHLCV values.

  • Free software: BSD license

Installation

pip install marketprofile

Example

You can view a Jupyter notebook of an example with charts here: https://github.com/bfolkens/py-market-profile/blob/master/examples/example.ipynb

Pull in some data to play with:

>>> from market_profile import MarketProfile
>>> import pandas_datareader as data
>>> amzn = data.get_data_yahoo('AMZN', '2019-12-01', '2019-12-31')

Create the MarketProfile object from a Pandas DataFrame:

>>> mp = MarketProfile(amzn)
>>> mp_slice = mp[amzn.index.min():amzn.index.max()]

Once you've chosen a slice, you can return the profile series:

>>> mp_slice.profile
Close
1739.25    2514300
1740.50    2823800
1748.75    2097600
1749.55    2442800
1751.60    3117400
1760.35    3095900
1760.70    2670100
1760.95    2745700
1769.25    3145200
1770.00    3380900
1781.60    3925600
1784.05    3351400
1786.50    5150800
1789.25     881300
1790.70    3644400
1792.30    2652800
1793.00    2136400
1846.90    3674700
1847.85    2506500
1868.80    6005400
1869.85    6186600
Name: Volume, dtype: int64

Or you can also access individual attributes and properties:

>>> mp_slice.initial_balance()
(1762.680054, 1805.550049)
>>> mp_slice.open_range()
(1762.680054, 1805.550049)
>>> mp_slice.poc_price
1869.850000
>>> mp_slice.profile_range
(1739.25, 1869.85)
>>> mp_slice.value_area
(1760.95, 1869.85)
>>> mp_slice.balanced_target
2000.4499999999998
>>> mp_slice.low_value_nodes
Close
1748.75    2097600
1760.70    2670100
1784.05    3351400
1789.25     881300
1793.00    2136400
1847.85    2506500
Name: Volume, dtype: int64
>>> mp_slice.high_value_nodes
Close
1740.5    2823800
1751.6    3117400
1781.6    3925600
1786.5    5150800
1790.7    3644400
1846.9    3674700
Name: Volume, dtype: int64

Documentation

https://marketprofile.readthedocs.io/

What is Market Profile and How are these calculated?

A discussion on the difference between TPO (Time Price Opportunity) and VOL (Volume Profile) chart types: https://jimdaltontrading.com/tpo-vs-volume-profile

Development

To run the all tests run:

tox

Development sponsored in part by Cignals, LLC. - Bitcoin Order Flow and Footprint Charts.

More Repositories

1

nvidia-docker-bootstrap

For those times when nvidia-docker is not possible (like AWS ECS)
Shell
19
star
2

model-formatter

Allows you to easily handle fields in Rails / ActiveRecord that need to be formatted or stripped of formatting as they are set or retrieved from the database.
Ruby
13
star
3

pandas-datareader-gdax

GDAX data for Pandas in the style of DataReader
Python
11
star
4

rails-csv-fixtures

Ruby
11
star
5

wind

A minimal Elixir websocket client library based on Mint and Mint.Websocket.
Elixir
9
star
6

Membase-TAP-Ruby

An interface to Membase's TAP protocol in Ruby
Ruby
8
star
7

hashcash-js

Hashcash implementation in ES6 / Javascript
JavaScript
8
star
8

hostipfox-firefox-plugin

Displays IP Trace information when you hover over a link in Firefox.
JavaScript
6
star
9

gentoo-bfolkens-layman

An overlay of custom ebuilds I use all the time.
Shell
6
star
10

snapshot-ebs

Easy GFS (Grandfather-Father-Son) backups using Amazon's EBS snapshotting feature. Intended for LVM devices.
Ruby
5
star
11

inlinkads-rails-plugin

Integrate your blog or other Rails webapp with the text-link-ads.com InLinkAds service
Ruby
3
star
12

ruby-krippendorff-alpha

Krippendorff Alpha implementation for std-ruby Matrix library
Ruby
3
star
13

animals_or_food

Let's play a little game with CloudSight. Is it an animal or is it food?
Ruby
3
star
14

dotfiles

Lua
2
star
15

opennodex

OpenNode Elixir Client
Elixir
2
star
16

marshal_as_yaml

Very simple data marshaling library for ActiveRecord to take the pain (and repetition) out of writing for YAML
Ruby
2
star
17

validates-g-rated-content

A short and simple ActiveRecord validation for "bad language"
Ruby
2
star
18

docker-opencv

Dockerfile
1
star
19

bitcoin-client

Elixir client for Bitcoin RPC
Elixir
1
star
20

docker-nginx-rails

Makefile
1
star
21

ruby-animated-gif-detector

Animated GIF Detector written in pure ruby - designed for streams
Ruby
1
star
22

docker-torch-nv

Ubuntu / CUDA / CUDnn / NCCL Torch7
Makefile
1
star
23

report-template

A simple report template inspired by the Tufte-book styles.
PostScript
1
star
24

chef-torch

Ruby
1
star