Source Code

/Stock Downloader/

Stock downloader

By: Maximilian Brandmaier


This python package compares the price development of multiple stocks from their initial public offering to the current date.


You can install this python package over pip by using the following command from this directory.

pip install .


To use this package in your python scripts, you have to import it with the following command.

import stockdownloader

After importing, you can call the stock downloader as shown in the code example below.

results = stockdownloader.downloadFromDict(<dictname>,apikey=<yourkey>)
results = stockdownloader.downloadFromCSV(<filename>,apikey=<yourkey>)

Neccessary Arguments

  • <dictname> / <filename>: A dict or CSV file that contains the stocks you want to download.

    • Dicts should be formatted like this: {"Stocksymbol":"Stockname","Stocksymbol":"Stockname"}

    • CSVs should be formatted like this: Stocksymbol,Stockname\nStocksymbol,Stockname

    • If you do not know the symbol of a stock, look it up here.

  • apikey: An alphavantage API key. You can generate your own key for free here.

Optional Arguments

  • startdate: All data points before this date will be filtered out. The date has to be passed in the ISO Format YYYY-MM-DD.

  • enddate: All data points after this date will be filtered out. The date has to be passed in the ISO Format YYYY-MM-DD.

  • surpressoutput: If this is set to True, the package will not print out the download progress.

  • premiumkey: If your key is a premium key, you can set this option to True for a faster download.

Full Example

The code below downloads the stock prices of all stocks in the file 'exampledepot.csv' from August 8, 2019 to the August 8, 2021. You can find the full example here.

results = stockdownloader.downloadFromCSV("exampledepot.csv", apikey="key",startdate="2019-08-08",enddate="2021-08-08")


The downloader will return a data frame that contains opening prices, closing prices, volumes and dividends of the selected stocks.