In [2]:
import config
from coin import Coin
import plot
In [3]:
fields = ['block_chain_work', 'block_num_tx', 'price']
coins = [Coin(ticker) for ticker in config.TICKERS]
frames = [coin.get_frame(*fields, normalize='z_score') for coin in coins]
In [7]:
corrs = {}
for (coin, df) in zip(coins, frames):
plot.plot_timeseries(coin.ticker, df, window=100)
corrs[coin.ticker] = df.corr()
print corrs[coin.ticker]
In [47]:
# Create histograms of correlation coefficient distribution
def plot_histogram(m1, m2, num_bins=10, color='red'):
data = [corrs[ticker][m1][m2] for ticker in corrs if ticker != 'nmc']
# the histogram of the data
plt.hist(data, num_bins, facecolor=color, alpha=0.75)
plt.xlabel('Correlation Coefficient')
plt.ylabel('Count')
plt.title(m1 + ' vs. ' + m2)
plt.grid(True)
plt.show()
plot_histogram('price', 'block_chain_work', num_bins=8)
plot_histogram('price', 'block_num_tx', num_bins=8, color='green')
plot_histogram('block_chain_work', 'block_num_tx', num_bins=8, color='blue')