A library to calculate Market Profile from a Pandas DataFrame.
Project description
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
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
Built Distributions
File details
Details for the file MarketProfile-0.2.0.tar.gz
.
File metadata
- Download URL: MarketProfile-0.2.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b41c6f6923b9ccbe7f71459fd6246399087e2eae03be84a773925a007b78e04a |
|
MD5 | 47222291c6a9a96131f32c1ea377e7be |
|
BLAKE2b-256 | 5759891ab715d40646f5bf091517146db165b035c1f6f58cf943716299006317 |
File details
Details for the file MarketProfile-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: MarketProfile-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 583982452350e2e99c07a1660e38518d3e6f0d825f1b812d5ea2b7452c1e8e00 |
|
MD5 | 6518ce3c9b3cc28b11399e59d03b2081 |
|
BLAKE2b-256 | 7f5eff25af1dbc01aec9d003e823836f2a67fc274e77e287f67452a0de07810b |
File details
Details for the file MarketProfile-0.2.0-py2-none-any.whl
.
File metadata
- Download URL: MarketProfile-0.2.0-py2-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6a881cc8e5c52a6184e5b88ec697fb836006ca5eb087ceada2a76bd329d2ead |
|
MD5 | b7cd0349ab81fec5f3e6d07290c0a2a3 |
|
BLAKE2b-256 | be46f27065c64155ddd355550698c849f30a07d0739943e5a0c3c53e63d0ce08 |