In [1]:
import pandas as pd
import datetime
import numpy as np
import scipy as sp
import os
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
matplotlib.rcParams['figure.figsize'] = (12.0, 6.0)
In [2]:
raw = pd.read_csv("./market.csv", header=False, names=['time', 'price', 'volume'], index_col='time', parse_dates=[0])
raw.head()
Out[2]:
In [3]:
data = raw['2015']
data.plot(secondary_y='volume', rot=0)
Out[3]:
try shifting volume to tomorrow's price
In [4]:
data['shifted_vol'] = data['volume'].shift(1)
data.head()
Out[4]:
In [6]:
data.iloc[:,[0,2]].plot(secondary_y='price', rot=0)
Out[6]:
check the percent change of two attribtues
In [7]:
pct_data = raw['2015'].pct_change()
pct_data.head()
Out[7]:
In [8]:
pct_data.corr()
Out[8]:
In [9]:
pct_data.ix[pct_data['volume'].argmax()] = 0
pct_data.plot(secondary_y='volume', rot=0)
Out[9]:
In [10]:
pct_data['shifted_volume'] = pct_data['volume'].shift(1)
pct_data.head()
Out[10]:
In [11]:
pct_data.corr()
Out[11]: