import datetime
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
import numpy as np
import time


def results():

    df = pd.read_csv('performance_data_sp500ish.csv', index_col='time', parse_dates=True)

    #sort by date, since it's currently by stock.

    # now we want to perform an average..

    #df['mean'] = df['pc'].mean()
    df['x_mean'] = pd.expanding_mean(df['pc'], 0)
    #df['ma'] = pd.rolling_mean(df['pc'], 10)

    return df['x_mean']

x = results()
x.plot(label='Wholistic Performance')
plt.axhline(0, color='k', linewidth = 4)


The next tutorial:

  • Python and Pandas with Sentiment Analysis Database
  • Pandas Basics
  • Looking at our Data
  • Data Manipulation
  • Removing Outlier Plots
  • Basics for a Strategy
  • Dynamic Moving Averages
  • Strategy Function
  • Mapping function to dataframe
  • Beginning to back-test
  • More Analysis
  • Conclusion