#Generate Alpha Vantage time series object Metadata associated with the time series. Time series data, including open, high, low, close, and datetime values. Ticker name that we want to pull.ĭata_interval: String. Pull intraday time series data by stock ticker name.Īlpha_vantage_api_key: Str.
#Python download stock data code
We use the following code to pull time series data for Google stock, with a data frequency of 15 minutes: from alpha_vantage.timeseries import TimeSeriesĪlpha_vantage_api_key = "YOUR API KEY HERE"ĭef pull_intraday_time_series_alpha_vantage(alpha_vantage_api_key, ticker_name, data_interval = '15min'): The first method we will cover is for intraday data, where we want to pull a time series with a data frequency of 1 hour or less. There are a couple of options for pulling time series data via Alpha Vantage’s API, depending on the level of data frequency that you want.
#Python download stock data install
Pip install alpha-vantage Intraday Time Series Data Go to the command prompt and enter the following to download Alpha Vantage’s API package: Downloading Required LibrariesĪlpha Vantage has a Python library specifically for its API. You can use this key to pull data directly into Python for analysis. Once you’re finished, Alpha Vantage will print an API key on its webpage for your own personal use. Go to this webpage, and fill out your contact information as directed: Fill out your contact details to claim your free API key Getting a free API key to access its data bank is simple.
Pulling Data Using the Alpha Vantage APIīoston, Massachusetts-based Alpha Vantage is a leading provider of free API’s for historical and real-time stock data, physical currency data, and crypto-currency data. In this tutorial, we will pull financial time series data into Python using the following free API options:īetween these two API’s, we should be able to gain access to a vast majority of financial data sets, including daily and intraday stock price data. Even better, many of these options are free. Fortunately, there are a slew of options available on the internet for pulling financial time series data directly into Python for analysis.
Getting access to financial time series data sets can be a hassle.