Skip to main content

Module to create custom, interactive stock portfolio tree maps. Pulls data from Yahoo! Finance.

Project description

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: Example tree map created by stock_treemap()

For more advanced options, see the function help (although it is still in progress with recent updates to provide saving to HTML.)

Requirements

Requires

If you find this useful... Buy Me A Coffee

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

stock_treemap-1.6.tar.gz (1.5 MB view hashes)

Uploaded Source

Built Distribution

stock_treemap-1.6-py2.py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page