In this one we'll cover how we can plot two technical indicator series in the same plot using alpha vantage api, python, and matplotlib.
We'll work with a simple moving average and a relative strength index in this video.
#Python #StockMarket #tutorial
Here's a repo that has more alpha vantage examples to try out:
https://github.com/Derrick-Sherrill/alpha-vantage-examples
Thanks so much for the continued support! 4550+ Subscribers at the time of writing this. Beyond thankful for you all.
Join The Socials -- Picking Shoutouts Across YouTube, Insta, FB, and Twitter!
FB - https://www.facebook.com/CodeWithDerrick/
Insta - https://www.instagram.com/codewithderrick/
Twitter - https://twitter.com/codewithderrick
LinkedIn - https://www.linkedin.com/in/derricksherrill/
GitHub - https://github.com/Derrick-Sherrill
*****************************************************************
Full code from the video:
import pandas as pd
from alpha_vantage.techindicators import TechIndicators
import matplotlib.pyplot as plt
api_key = 'RNZPXZ6Q9FEFMEHM'
period = 60
ti = TechIndicators(key=api_key, output_format='pandas')
data_ti, meta_data_ti = ti.get_rsi(symbol='MSFT', interval='1min',
time_period=period, series_type='close')
data_sma, meta_data_sma = ti.get_sma(symbol='MSFT', interval='1min',
time_period=period, series_type='close')
df1 = data_sma.iloc[1::]
df2 = data_ti
df1.index = df2.index
fig, ax1 = plt.subplots()
ax1.plot(df1, 'b-')
ax2 = ax1.twinx()
ax2.plot(df2, 'r.')
plt.title("SMA & RSI graph")
plt.show()
https://github.com/Derrick-Sherrill/DerrickSherrill.com/blob/master/twotechindicators.py
Packages (& Versions) used in this video:
Python 3.7
pandas == 0.25.0
alpha vantage
matplotlib
*****************************************************************
Code from this tutorial and all my others can be found on my GitHub:
https://github.com/Derrick-Sherrill/DerrickSherrill.com
Check out my website:
https://www.derricksherrill.com/
If you liked the video - please hit the like button. It means more than you know. Thanks for watching and thank you for all your support!!
Always looking for suggestions on what video to make next -- leave me a comment with your project! Happy Coding!