Downloading the technical indicators
We have already mentioned in Chapter 1 that some data vendors not only provide historical stock prices but also offer a selection of the most popular technical indicators. In this recipe, we will show how to download the RSI indicator for IBM’s stock, which can be directly compared to the one we calculated in the previous recipe using the TA-Lib
library.
How to do it…
Execute the following steps to download the RSI calculated for IBM from Alpha Vantage:
- Import the libraries:
from alpha_vantage.techindicators import TechIndicators
- Instantiate the
TechIndicators
class and authenticate:
ta_api = TechIndicators(key="YOUR_KEY_HERE",
output_format="pandas")
- Download the RSI for IBM's stock:
rsi_df, rsi_meta = ta_api.get_rsi(symbol="IBM",
time_period=14)
- Plot the downloaded RSI:
fig, ax = plt.subplots()
rsi_df.plot(ax=ax,
...