GOLD

Time Period - Nov 2004 to Nov 2014

In [13]:
#Import needed library
import numpy as np
from __future__ import print_function
import prettyplotlib as ppl
import matplotlib as mpl
import pandas as pd
from pandas import Series, DataFrame
from sklearn.metrics import mean_squared_error
from math import sqrt
from IPython.core.display import HTML
%matplotlib inline
import matplotlib.pyplot as plt
import datetime

In [14]:
#London Fix Gold Spot Price
fig, axes = plt.subplots(1, figsize=(24,11))
goldDataPath = 'Gold_Daily_200411_201410.csv'
dataGoldFix = pd.read_csv(goldDataPath)

n = len(dataGoldFix.index)
x = dataGoldFix['Date']
y1 = dataGoldFix['Gold_Value']


date=[]
for d in x:
    date.append(datetime.datetime.strptime(d,'%m/%d/%Y'))
    #date.append(datetime.datetime.strptime(d,'%Y-%m-%d'))
    
ppl.plot(axes, date, y1, label=str("Gold Price"), linewidth=3, c='blue')


axes.set_title("Gold Price in the past 10 years \nin US Dollars\n")
axes.set_ylabel('Price')
axes.set_xlabel('Date')


ppl.legend(axes, loc='upper left')
plt.savefig("Gold_10yr.jpg")



In [15]:
fig, axes = plt.subplots(1, figsize=(24,11))
oilDataPath = 'Oil_Daily_200411_201410.csv'
dataOilFix = pd.read_csv(oilDataPath)

x = dataOilFix['Date']
date=[]
for d in x:
    date.append(datetime.datetime.strptime(d,'%m/%d/%Y'))
    
y2 = dataOilFix['Oil_Value']
ppl.plot(axes, date, y2, label=str("Oil Price"), linewidth=3, c='green')
axes.set_title("Oil Price in the past 10 years \nUS Dollars\n")
axes.set_ylabel('Price')
axes.set_xlabel('Date')
ppl.legend(axes, loc='upper left')
plt.savefig("Oil_10yr.jpg")



In [16]:
fig, axes = plt.subplots(1, figsize=(24,11))
goldDataPath = 'Gold_Daily_201311_201410.csv'
dataGoldFix = pd.read_csv(goldDataPath)
x = dataGoldFix['Date']
y3 = dataGoldFix['Gold_Value']
date=[]
for d in x:
    date.append(datetime.datetime.strptime(d,'%m/%d/%Y'))

ppl.plot(axes, date, y3, label=str("Gold Price"), linewidth=3, c='blue')
axes.set_title("Gold Price in the past 12 months\nin US Dollars\n")
axes.set_ylabel('Price')
axes.set_xlabel('Date')

ppl.legend(axes, loc='upper left')
plt.savefig("Gold_1yr.jpg")



In [17]:
fig, axes = plt.subplots(1, figsize=(24,11))
oilDataPath = 'Oil_Daily_201311_201410.csv'
dataOilFix = pd.read_csv(oilDataPath)
x = dataOilFix['Date']
y4 = dataOilFix['Oil_Value']
date=[]
for d in x:
    date.append(datetime.datetime.strptime(d,'%m/%d/%Y'))

ppl.plot(axes, date, y4, label=str("Oil Price"), linewidth=3, c='green')
axes.set_title("Oil Price in the past 12 months \nUS Dollars\n")
axes.set_ylabel('Price')
axes.set_xlabel('Date')

ppl.legend(axes, loc='upper left')
plt.savefig("Oil_1yr.jpg")



In [20]:
fig, axes = plt.subplots(1, figsize=(24,11))
goldDataPath = 'Gold_Daily_201410.csv'
dataGoldFix = pd.read_csv(goldDataPath)
x = dataGoldFix['Date']
y5 = dataGoldFix['Value']
date=[]
for d in x:
    date.append(datetime.datetime.strptime(d,'%m/%d/%Y'))

ppl.plot(axes, date, y5, label=str("Gold Price"), linewidth=5, c='blue')
axes.set_title("Gold Price in October 2014 \nin US Dollars\n")
axes.set_ylabel('Price')
axes.set_xlabel('Date')


ppl.legend(axes, loc='upper left')
plt.savefig("Gold_1month.jpg")



In [21]:
fig, axes = plt.subplots(1, figsize=(24,11))
goldDataPath = 'Oil_Daily_201410.csv'
dataGoldFix = pd.read_csv(goldDataPath)
x = dataGoldFix['Date']
y6 = dataGoldFix['Value']
date=[]
for d in x:
    date.append(datetime.datetime.strptime(d,'%Y-%m-%d'))

ppl.plot(axes, date, y6, label=str("Gold Price"), linewidth=5, c='green')
axes.set_title("Oil Price in October 2014 \nin US Dollars\n")
axes.set_ylabel('Price')
axes.set_xlabel('Date')


ppl.legend(axes, loc='upper left')
plt.savefig("Oil_1month.jpg")



In [19]: