4

There are a lot of sites I can go to and get a chart of any stock such as finance.google.com, finance.yahoo.com, and others.

But I want to get a chart of how a portfolio consisting of multiple stocks would have performed. For instance, suppose I have a portfolio consisting of 100 shares of MSFT, 50 shares of GOOG, and short 100 shares of T. I would like to type in "100*MSFT + 50*GOOG - 100*T" in the stock ticker and have it show me the graph, but that doesn't work. Perhaps one of the existing services does have it and I just haven't figured out how to use it. For instance, some reading suggests that Google Finance will let me graph my portfolio, but I just don't see where, or if they are even really talking about what I want to do.

1 Answer 1

2

I would suggest the combination of python, ystockquote and one of the many python plotting libraries such as matplotlib pyplot, Plotly or Bokeh - the Bokeh site even has an example that looks very like what you would like to do.

You would probably be even better with Pandas which can integrate with several sites as can be seen here.

With pandas getting the data is ridiculously easy, filched from this dogfish blog:

from pandas.io.data import DataReader
import pandas as pd
from datetime import datetime
import numpy as np
company_information = pd.read_csv(‘mycompanylist.csv’)
mega_frame = [DataReader(company.strip(), "yahoo", datetime(2015,1,1), datetime.now().date()) for company in company_information[company_information.Sector == ‘Technology’][‘Symbol’]]
symbol_list = [symbol for symbol in company_information[company_information.Sector == ‘Technology’][‘Symbol’]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.