stock_treemap
Want to make a cool stock diagram, like those on finviz: https://finviz.com/map.ashx , but for your own portfolio?
This library generates tree maps for stock portfolios using Python, Yahoo Finance, and Plotly. This code is designed to be run within a Jupyter environment or can be used to create an html file of the resulting plot. More details of requirements are further below.
You will need to create a CSV file that has 2 columns: ticker and stocks. The ticker column should contain the stock ticker symbols for each stock you own. The shares column should contain the number of shares that you own. An example is shown below:
ticker,shares
aapl,20
amd,10
amzn,2
googl,1
ethe,30
gbtc,4
If this file is called 'example.csv', then you can create a tree map as follows:
from stock_treemap import stock_treemap, update_sectors
stock_treemap('example.csv')
An animated GIF showing an example of the output is below:
For more advanced options, see the function help (although it is still in progress with recent updates to provide saving to HTML.)
Requirements
Requires
- yfinance
- tqdm
- numpy
- pandas
- plotly
- Note that Plotly requires plug-ins to work properly in Jupyter environments. See https://plotly.com/python/getting-started/
Metadata
Release files for stock_treemap 1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stock_treemap-1.6.tar.gz | 1.5 MB | Without provenance | Details for stock_treemap-1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stock_treemap-1.6-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for stock_treemap-1.6-py2.py3-none-any.whl |
Total release size: 1.5 MB
Release files / stock_treemap-1.6.tar.gz
| Download URL | stock_treemap-1.6.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
234fc47a897c12a1ed0cd233ff7b5ac6f203b0d327da683473bffa43c6d390f4
|
|
BLAKE2b-256 checksum How to use checksums |
31990f8d667628fef7ba966c5ca829ba84a1b407b91b8fb3c73776824a91d5be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / stock_treemap-1.6-py2.py3-none-any.whl
| Download URL | stock_treemap-1.6-py2.py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
dcc3aee905ebbc0bdb199724a0785be4e58196bafb4232e622c78a659219196c
|
|
BLAKE2b-256 checksum How to use checksums |
3204dc6ef5192854df1b722c43151776c4da207e94de3335b072553d34fdc9d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Security for stock_treemap 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.