{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 1500 entries, 2017-10-03 to 2021-11-10\n",
      "Data columns (total 9 columns):\n",
      " #   Column       Non-Null Count  Dtype  \n",
      "---  ------       --------------  -----  \n",
      " 0   BTC_returns  1500 non-null   float64\n",
      " 1   BTC_vol_10   1500 non-null   float64\n",
      " 2   BTC_vol_20   1500 non-null   float64\n",
      " 3   BTC_vol_30   1500 non-null   float64\n",
      " 4   BTC_mom_10   1500 non-null   float64\n",
      " 5   BTC_mom_20   1500 non-null   float64\n",
      " 6   BTC_mom_30   1500 non-null   float64\n",
      " 7   BTC_mom_60   1500 non-null   float64\n",
      " 8   BTC_mom_90   1500 non-null   float64\n",
      "dtypes: float64(9)\n",
      "memory usage: 117.2+ KB\n"
     ]
    }
   ],
   "source": [
    "from load_data import load_files\n",
    "import pandas as pd\n",
    "from pandas.plotting import lag_plot\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "data = load_files('data', True)\n",
    "data = data[[column for column in data.columns if not column.endswith('volume')]]\n",
    "data = data[[column for column in data.columns if column.startswith('BTC')]]\n",
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>BTC_returns</th>\n",
       "      <th>BTC_vol_10</th>\n",
       "      <th>BTC_vol_20</th>\n",
       "      <th>BTC_vol_30</th>\n",
       "      <th>BTC_mom_10</th>\n",
       "      <th>BTC_mom_20</th>\n",
       "      <th>BTC_mom_30</th>\n",
       "      <th>BTC_mom_60</th>\n",
       "      <th>BTC_mom_90</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-10-03</th>\n",
       "      <td>-0.019799</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-10-04</th>\n",
       "      <td>-0.022141</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-10-05</th>\n",
       "      <td>0.024363</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-10-06</th>\n",
       "      <td>0.011686</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-10-07</th>\n",
       "      <td>0.014609</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            BTC_returns  BTC_vol_10  BTC_vol_20  BTC_vol_30  BTC_mom_10  \\\n",
       "2017-10-03    -0.019799         0.0         0.0         0.0         0.0   \n",
       "2017-10-04    -0.022141         0.0         0.0         0.0         0.0   \n",
       "2017-10-05     0.024363         0.0         0.0         0.0         0.0   \n",
       "2017-10-06     0.011686         0.0         0.0         0.0         0.0   \n",
       "2017-10-07     0.014609         0.0         0.0         0.0         0.0   \n",
       "\n",
       "            BTC_mom_20  BTC_mom_30  BTC_mom_60  BTC_mom_90  \n",
       "2017-10-03         0.0         0.0         0.0         0.0  \n",
       "2017-10-04         0.0         0.0         0.0         0.0  \n",
       "2017-10-05         0.0         0.0         0.0         0.0  \n",
       "2017-10-06         0.0         0.0         0.0         0.0  \n",
       "2017-10-07         0.0         0.0         0.0         0.0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='y(t)', ylabel='y(t + 1)'>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 14644 characters]",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "lag_plot(data['SPY_returns'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='y(t)', ylabel='y(t + 1)'>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 13544 characters]",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "lag_plot(data['BTC_returns'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 469840 characters]",
      "text/plain": [
       "<Figure size 864x864 with 81 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "pd.plotting.scatter_matrix(data, figsize=(12, 12));"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 76868 characters]",
      "text/plain": [
       "<Figure size 1440x1440 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(figsize=(20,20))\n",
    "sns.heatmap(data.corr(), annot=True, ax=ax);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "51432b8e5767c06330d9b51dfad63f9db0ea39868e37d921b9c2e277373f8d11"
  },
  "kernelspec": {
   "display_name": "Python 3.9.2 64-bit ('deeplearning': conda)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
