In [1]:
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import poloniex
import time
import talib as ta
import seaborn as sns
/Users/maedanaoki/.pyenv/versions/3.5.1/envs/test/lib/python3.5/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)
In [2]:
polo = poloniex.Poloniex()
polo.timeout = 2
In [3]:
btc_price = polo.marketChart('USDT_BTC', period=polo.DAY, start=time.time() - polo.DAY * 90 , end=time.time())
btc_close = [btc_price[i]['close'] for i in range(len(btc_price))]
In [4]:
eth_price = polo.marketChart('USDT_ETH', period=polo.DAY, start=time.time() - polo.DAY * 90 , end=time.time())
eth_close = [eth_price[i]['close'] for i in range(len(eth_price))]
In [5]:
xmr_price = polo.marketChart('USDT_XMR', period=polo.DAY, start=time.time() - polo.DAY * 90 , end=time.time())
xmr_close = [xmr_price[i]['close'] for i in range(len(xmr_price))]
In [6]:
etc_price = polo.marketChart('USDT_ETC', period=polo.DAY, start=time.time() - polo.DAY * 90 , end=time.time())
etc_close = [etc_price[i]['close'] for i in range(len(etc_price))]
In [7]:
xrp_price = polo.marketChart('USDT_XRP', period=polo.DAY, start=time.time() - polo.DAY * 90 , end=time.time())
xrp_close = [xrp_price[i]['close'] for i in range(len(xrp_price))]
In [8]:
df = pd.DataFrame({'BTC':btc_close,'ETH':eth_close,'XMR':xmr_close,'ETC':etc_close,'XRP':xrp_close})
In [9]:
change = df.pct_change()
In [10]:
change.describe()
/Users/maedanaoki/.pyenv/versions/3.5.1/envs/test/lib/python3.5/site-packages/numpy/lib/function_base.py:3834: RuntimeWarning: Invalid value encountered in percentile
  RuntimeWarning)
Out[10]:
BTC ETC ETH XMR XRP
count 89.000000 89.000000 89.000000 89.000000 89.000000
mean 0.002887 -0.010897 0.000404 0.016741 0.004851
std 0.014124 0.053486 0.028041 0.127651 0.065610
min -0.027844 -0.189386 -0.060153 -0.131021 -0.199798
25% NaN NaN NaN NaN NaN
50% NaN NaN NaN NaN NaN
75% NaN NaN NaN NaN NaN
max 0.059739 0.225876 0.094858 0.808490 0.485570
In [11]:
change.plot()
Out[11]:
<matplotlib.axes._subplots.AxesSubplot at 0x10e32c358>
In [12]:
sns.jointplot('BTC', 'ETH', change)
Out[12]:
<seaborn.axisgrid.JointGrid at 0x10e3c65f8>
In [13]:
sns.jointplot('BTC', 'XMR', change)
Out[13]:
<seaborn.axisgrid.JointGrid at 0x10e754b38>
In [14]:
sns.jointplot('BTC', 'ETC', change)
Out[14]:
<seaborn.axisgrid.JointGrid at 0x10ea4cc18>
In [15]:
sns.jointplot('BTC', 'XRP', change)
Out[15]:
<seaborn.axisgrid.JointGrid at 0x10ed4b198>
In [16]:
sns.jointplot('ETH', 'XRP', change)
Out[16]:
<seaborn.axisgrid.JointGrid at 0x10efc26d8>
In [ ]: