Python for Finance, Plot 100MA, Volume & Adjusted Close

The following should be stored as a .py file and the packages: pip, matplotlib, pandas and pandas-datareader must be installed, and can be sourced from PYPI.ORG. After downloading, use terminal command "sudo pip install pandas", "sudo pip install matplotlib" etc... or navigate into the packages file directory in terminal and run command "sudo python setup.py install". The command "pip list" can be used to check that a package has been properly installed. The installation process can be arduous, so I recommend consulting stackoverflow when problems occur.

import datetime as dt 
import matplotlib.pyplot as plt 
from matplotlib import style
import pandas as pd 
import pandas_datareader.data as web


df = pd.read_csv('tsla.csv', parse_dates=True, index_col=0)

df['100ma'] = df['Adj Close'].rolling(window=100, min_periods=0).mean()

ax1 = plt.subplot2grid((6,1), (0,0), rowspan=5, colspan=1)
ax2 = plt.subplot2grid((6,1), (5,0), rowspan=5, colspan=1, sharex=ax1)

ax1.plot(df.index, df['Adj Close'])
ax1.plot(df.index, df['100ma'])
ax2.bar(df.index, df['Volume'])



How Write to a Atmel ATTINY10 Microcontroller


Quadratic Equation Solver HTML & Javascript

Interior Design for 2019