'''
Created Oct 10-20, 2010

@author: alandavidson
@author: ola
@author: rcd
'''
import StockData
import matplotlib.pyplot as plt

# useful "constants" to make it easier to remember what each index represents
DATE = 0
PRICE = 1
VOLUME = 2


def getMaxPrice (stockData):
    """
    Given a list of (date, price, volume) tuples, 
    returns the highest price.
    """
    return max([ s[PRICE] for s in stockData ])


def getMaxPriceDate (stockData):
    """
    Given a list of (date, price, volume) tuples, 
    returns the date of the tuple that has the highest price.
    """
    # TODO: students fill this in
    pass


def getAveragePrice (stockData):
    """
    Given a list of (date, price, volume) tuples, 
    returns the average price.
    """
    # TODO: students fill this in.
    pass


def plotPrices (stockData):
    """
    Given a list of (date, price, volume) tuples, 
    Create a plot of the price of the stock over all the days in the list.
    The x-axis is the index in the list, and the y-axis is the price of the stock.
    """
    # TODO: students fill this in
    plt.show()


def plotPriceVsAverage (stockData):
    """
    Given a list of (date, price, volume) tuples, 
    Create a plot of how the current price of the stock compares
    to the average price of the past 10 days. 
    The x-axis is the index in the list, and the y-axis is the difference 
    between the current price and the 10-day average.
    """
    # TODO: students fill this in
    plt.show()


# test your program here
SYMBOL = "goog"
START = "2013-01-01"
END = "2014-01-01"

data = StockData.getFileData(SYMBOL, START, END)
#data = StockData.getWebData(SYMBOL, START, END)
print(data)
# if you want to test various functions, you can do it here.
