mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-13 10:58:06 +00:00
570 KiB
570 KiB
In [2]:
from load_data import load_files
import pandas as pd
from pandas.plotting import lag_plot
import seaborn as sns
import matplotlib.pyplot as plt
data = load_files('data', True)
data = data[[column for column in data.columns if not column.endswith('volume')]]
data = data[[column for column in data.columns if column.startswith('BTC')]]
data.info()<class 'pandas.core.frame.DataFrame'> Index: 1500 entries, 2017-10-03 to 2021-11-10 Data columns (total 9 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 BTC_returns 1500 non-null float64 1 BTC_vol_10 1500 non-null float64 2 BTC_vol_20 1500 non-null float64 3 BTC_vol_30 1500 non-null float64 4 BTC_mom_10 1500 non-null float64 5 BTC_mom_20 1500 non-null float64 6 BTC_mom_30 1500 non-null float64 7 BTC_mom_60 1500 non-null float64 8 BTC_mom_90 1500 non-null float64 dtypes: float64(9) memory usage: 117.2+ KB
In [3]:
data.head(5)Out [3]:
| BTC_returns | BTC_vol_10 | BTC_vol_20 | BTC_vol_30 | BTC_mom_10 | BTC_mom_20 | BTC_mom_30 | BTC_mom_60 | BTC_mom_90 | |
|---|---|---|---|---|---|---|---|---|---|
| 2017-10-03 | -0.019799 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2017-10-04 | -0.022141 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2017-10-05 | 0.024363 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2017-10-06 | 0.011686 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2017-10-07 | 0.014609 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
In [3]:
lag_plot(data['SPY_returns'])Out [3]:
<AxesSubplot:xlabel='y(t)', ylabel='y(t + 1)'>
In [4]:
lag_plot(data['BTC_returns'])Out [4]:
<AxesSubplot:xlabel='y(t)', ylabel='y(t + 1)'>
In [10]:
pd.plotting.scatter_matrix(data, figsize=(12, 12));In [6]:
fig, ax = plt.subplots(figsize=(20,20))
sns.heatmap(data.corr(), annot=True, ax=ax);Out [6]:
<AxesSubplot:>
In [ ]: