{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","papermill":{"duration":0.141066,"end_time":"2021-11-03T14:25:31.976727","exception":false,"start_time":"2021-11-03T14:25:31.835661","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:30:07.822214Z","iopub.execute_input":"2021-11-22T13:30:07.822773Z","iopub.status.idle":"2021-11-22T13:30:07.854473Z","shell.execute_reply.started":"2021-11-22T13:30:07.822685Z","shell.execute_reply":"2021-11-22T13:30:07.853676Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%matplotlib inline\nfrom IPython.core.display import display, HTML, Javascript\n\nhtml_contents =\"\"\"\n<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <link rel=\"stylesheet\" href=\"https://www.w3schools.com/w3css/4/w3.css\">\n        <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Raleway\">\n        <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Oswald\">\n        <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Open Sans\">\n        <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css\">\n        <style>\n        .title-section{\n            font-family: \"Roboto\", Verdana, sans-serif;\n            font-weight: bold;\n            color: \"#8B008B\";\n            letter-spacing: 8px;\n        }\n        hr { border: 1px solid #E58F65 !important;\n             color: #E58F65 !important;\n             background: #E58F65 !important;\n           }\n        body {\n            font-family: \"Open Sans\", sans-serif;\n            }        \n        </style>\n    </head>    \n</html>\n\"\"\"\n\nHTML(html_contents)","metadata":{"_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2021-11-22T13:30:07.856058Z","iopub.execute_input":"2021-11-22T13:30:07.856567Z","iopub.status.idle":"2021-11-22T13:30:07.869162Z","shell.execute_reply.started":"2021-11-22T13:30:07.856531Z","shell.execute_reply":"2021-11-22T13:30:07.868398Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> Cryto Currency - Brief Intro </span>\n![Crypto](https://masterthecrypto.com/wp-content/uploads/2019/12/top-20-cryptos.jpg)\n\n### <span class=\"title-section w3-large\" style=\"color:magenta\">A cryptocurrency is an encrypted data string that denotes a unit of currency. It is monitored and organized by a peer-to-peer network called a blockchain, which also serves as a secure ledger of transactions, e.g., buying, selling, and transferring. ... Bitcoin, Ether, Litecoin, and Monero are popular cryptocurrencies.</span>\n\n<h2>Top Crypto Currencies</h2>\n\n<table style=\"width:100%\">\n  <tr>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/bitcoin-logo.jpg\" height=100></td>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/ethereum.jpg\" height=100></td>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/maker.jpg\" height=100></td>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/bitcoin-cash.jpg\" height=100></td>\n  </tr>\n  <tr>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/binance.jpg\" height=100></td>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/cardano.jpg\" height=100></td>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/EOS.jpg\" height=100></td>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/litecoin.jpg\" height=100></td>\n  </tr>\n  <tr>\n    <td><img src=\"https://upload.wikimedia.org/wikipedia/commons/a/ad/Iota_logo.png\" height=100></td>\n    <td><img src=\"https://masterthecrypto.com/wp-content/uploads/2019/12/Stellar-xlm.jpg\" height=100></td>\n    <td><img src=\"https://upload.wikimedia.org/wikipedia/en/d/d0/Dogecoin_Logo.png\" height=100></td>\n    <td><img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Monero-Logo.svg/640px-Monero-Logo.svg.png\" height=100></td>\n  </tr>\n  <tr>\n    <td><img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/TRON-logo-EN-vertical.svg/240px-TRON-logo-EN-vertical.svg.png\" height=100></td>\n    <td><img src=\"https://en.bitcoinwiki.org/upload/en/images/thumb/3/36/Binance-coin-BNB.png/330px-Binance-coin-BNB.png\" height=100></td>\n  \n  </tr>\n  \n</table>\n\n### According to Jan Lansky, a cryptocurrency is a system that meets six conditions:\n* The system does not require a central authority; its state is maintained through distributed consensus.\n* The system keeps an overview of cryptocurrency units and their ownership.\n* The system defines whether new cryptocurrency units can be created. If new cryptocurrency units can be created, the system defines the circumstances of their origin and how to determine the ownership of these new units.\n* Ownership of cryptocurrency units can be proved exclusively cryptographically.\n* The system allows transactions to be performed in which ownership of the cryptographic units is changed. A transaction statement can only be issued by an entity proving the current ownership of these units.\n* If two different instructions for changing the ownership of the same cryptographic units are simultaneously entered, the system performs at most one of them.\n* In March 2018, the word cryptocurrency was added to the Merriam-Webster Dictionary.\n\n#### *Source: Wikipedia*\n","metadata":{}},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 1. Import Libraries</span>","metadata":{"papermill":{"duration":0.037651,"end_time":"2021-11-03T14:25:32.052839","exception":false,"start_time":"2021-11-03T14:25:32.015188","status":"completed"},"tags":[]}},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\n\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nsns.set_style('whitegrid')\nplt.style.use(\"fivethirtyeight\")\n%matplotlib inline\n\n# For reading stock data from yahoo\nfrom pandas_datareader.data import DataReader\n   \n# For time stamps\nfrom datetime import datetime\nfrom math import sqrt\nfrom math import sqrt\nfrom sklearn.metrics import mean_squared_error\nfrom sklearn.preprocessing import MinMaxScaler\n\n#ignore the warnings\nimport warnings\nwarnings.filterwarnings('ignore')","metadata":{"papermill":{"duration":0.917958,"end_time":"2021-11-03T14:25:33.007834","exception":false,"start_time":"2021-11-03T14:25:32.089876","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:30:07.870624Z","iopub.execute_input":"2021-11-22T13:30:07.870933Z","iopub.status.idle":"2021-11-22T13:30:08.739324Z","shell.execute_reply.started":"2021-11-22T13:30:07.870901Z","shell.execute_reply":"2021-11-22T13:30:08.738611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 2. Load Dataset</span>","metadata":{"papermill":{"duration":0.066303,"end_time":"2021-11-03T14:25:33.118409","exception":false,"start_time":"2021-11-03T14:25:33.052106","status":"completed"},"tags":[]}},{"cell_type":"code","source":"data_folder = \"../input/g-research-crypto-forecasting/\"\ncrypto_df = pd.read_csv(data_folder + 'train.csv')\n\ncrypto_df.head(10)\n","metadata":{"papermill":{"duration":56.798531,"end_time":"2021-11-03T14:26:29.957431","exception":false,"start_time":"2021-11-03T14:25:33.1589","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:30:08.741611Z","iopub.execute_input":"2021-11-22T13:30:08.741929Z","iopub.status.idle":"2021-11-22T13:31:02.593766Z","shell.execute_reply.started":"2021-11-22T13:30:08.741886Z","shell.execute_reply":"2021-11-22T13:31:02.593018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xlarge\" style=\"color:#FF0080\"> Data features</span>\n\n####  <span class=\"title-section w3-large\" style=\"color:#FF0080\"> Features</span>\n* timestamp: All timestamps are returned as second Unix timestamps (the number of seconds elapsed since 1970-01-01 00:00:00.000 UTC). Timestamps in this dataset are multiple of 60, indicating minute-by-minute data.\n* Asset_ID: The asset ID corresponding to one of the crytocurrencies (e.g. Asset_ID = 1 for Bitcoin). The mapping from Asset_ID to crypto asset is contained in asset_details.csv.\n* Count: Total number of trades in the time interval (last minute).\n* Open: Opening price of the time interval (in USD).\n* High: Highest price reached during time interval (in USD).\n* Low: Lowest price reached during time interval (in USD).\n* Close: Closing price of the time interval (in USD).\n* Volume: Quantity of asset bought or sold, displayed in base currency USD.\n* VWAP: The average price of the asset over the time interval, weighted by volume. VWAP is an aggregated form of trade data.\n* Target: Residual log-returns for the asset over a 15 minute horizon.\n\n","metadata":{"papermill":{"duration":0.040829,"end_time":"2021-11-03T14:26:30.03819","exception":false,"start_time":"2021-11-03T14:26:29.997361","status":"completed"},"tags":[]}},{"cell_type":"code","source":"import seaborn as sns\n#cm = sns.light_palette(\"viridis\", as_cmap=True)\n\nasset_details = pd.read_csv(data_folder + 'asset_details.csv')\n#asset_details.style.bar()\nasset_details.style.background_gradient(cmap='gist_rainbow_r')","metadata":{"papermill":{"duration":0.185333,"end_time":"2021-11-03T14:26:30.291374","exception":false,"start_time":"2021-11-03T14:26:30.106041","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:02.595179Z","iopub.execute_input":"2021-11-22T13:31:02.596108Z","iopub.status.idle":"2021-11-22T13:31:02.678605Z","shell.execute_reply.started":"2021-11-22T13:31:02.596064Z","shell.execute_reply":"2021-11-22T13:31:02.677929Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 3. Basic EDA</span>","metadata":{"papermill":{"duration":0.066745,"end_time":"2021-11-03T14:26:30.433199","exception":false,"start_time":"2021-11-03T14:26:30.366454","status":"completed"},"tags":[]}},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"crypto_df['timestamp'] = pd.to_datetime(crypto_df['timestamp'], unit='s')\ncrypto_df.rename({'timestamp': 'Date'}, axis=1, inplace=True)","metadata":{"papermill":{"duration":1.484333,"end_time":"2021-11-03T14:26:31.981712","exception":false,"start_time":"2021-11-03T14:26:30.497379","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:02.679758Z","iopub.execute_input":"2021-11-22T13:31:02.680005Z","iopub.status.idle":"2021-11-22T13:31:04.058119Z","shell.execute_reply.started":"2021-11-22T13:31:02.679962Z","shell.execute_reply":"2021-11-22T13:31:04.057395Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def crypto_df_subset(asset_id ,data):\n    df = data[data[\"Asset_ID\"]==asset_id] #.set_index(\"Date\")\n    return df","metadata":{"papermill":{"duration":0.04407,"end_time":"2021-11-03T14:26:32.065165","exception":false,"start_time":"2021-11-03T14:26:32.021095","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:04.059218Z","iopub.execute_input":"2021-11-22T13:31:04.059455Z","iopub.status.idle":"2021-11-22T13:31:04.063319Z","shell.execute_reply.started":"2021-11-22T13:31:04.059424Z","shell.execute_reply":"2021-11-22T13:31:04.062658Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import random \n\ndef plot_close_val(data_frame, column, stock):\n    sns.set_style('whitegrid')\n    plt.style.use(\"fivethirtyeight\")\n    plt.figure(figsize=(16,6))\n    plt.title(column + ' Price History for ' + stock )\n    plt.plot(data_frame[column],color=\"#\"+''.join([random.choice('ABCDEF0123456789') for i in range(6)]))\n    plt.xlabel('Date')#, fontsize=18)\n    plt.ylabel(column + ' for ' + stock )#, fontsize=18)\n    plt.show()","metadata":{"papermill":{"duration":0.045851,"end_time":"2021-11-03T14:26:32.149338","exception":false,"start_time":"2021-11-03T14:26:32.103487","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:04.064407Z","iopub.execute_input":"2021-11-22T13:31:04.064704Z","iopub.status.idle":"2021-11-22T13:31:04.081184Z","shell.execute_reply.started":"2021-11-22T13:31:04.064669Z","shell.execute_reply":"2021-11-22T13:31:04.08052Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"try:\n    import mplfinance as mpf\nexcept:\n    !pip -q install mplfinance\n    import mplfinance as mpf","metadata":{"papermill":{"duration":7.946318,"end_time":"2021-11-03T14:26:40.133418","exception":false,"start_time":"2021-11-03T14:26:32.1871","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:04.0854Z","iopub.execute_input":"2021-11-22T13:31:04.085715Z","iopub.status.idle":"2021-11-22T13:31:13.241538Z","shell.execute_reply.started":"2021-11-22T13:31:04.08567Z","shell.execute_reply":"2021-11-22T13:31:13.240691Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def mplplot(data_frame, stock):\n    titletext =  stock + 'MPL Finance OHLC Plot'\n    mpf.plot(data_frame,type='candle',volume=True, mav=(7,14,28),figratio=(5,2), style='charles',title= titletext)\n    ","metadata":{"papermill":{"duration":0.045668,"end_time":"2021-11-03T14:26:40.21826","exception":false,"start_time":"2021-11-03T14:26:40.172592","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:13.244549Z","iopub.execute_input":"2021-11-22T13:31:13.245231Z","iopub.status.idle":"2021-11-22T13:31:13.251419Z","shell.execute_reply.started":"2021-11-22T13:31:13.24517Z","shell.execute_reply":"2021-11-22T13:31:13.250374Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\ncrypto_df['Date'] = pd.to_datetime(crypto_df.Date, utc=False)","metadata":{"papermill":{"duration":1.894781,"end_time":"2021-11-03T14:26:42.151003","exception":false,"start_time":"2021-11-03T14:26:40.256222","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:13.252871Z","iopub.execute_input":"2021-11-22T13:31:13.25315Z","iopub.status.idle":"2021-11-22T13:31:14.544711Z","shell.execute_reply.started":"2021-11-22T13:31:13.25311Z","shell.execute_reply":"2021-11-22T13:31:14.54397Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"crypto_df.head()\ndef time_series_features(df, dt_col='Date', label=None):\n    \"\"\"\n    Creates time series features from datetime index.\n    \"\"\"\n    df = df.copy()\n    df['hour'] = df[dt_col].dt.hour\n    df['dayofweek'] = df[dt_col].dt.dayofweek\n    df['quarter'] = df[dt_col].dt.quarter\n    df['month'] = df[dt_col].dt.month\n    df['year'] = df[dt_col].dt.year\n    df['dayofyear'] = df[dt_col].dt.dayofyear\n    df['dayofmonth'] = df[dt_col].dt.day\n    df['weekofyear'] = df[dt_col].dt.isocalendar().week\n    return df\n\ncrypto_df = time_series_features(crypto_df)","metadata":{"papermill":{"duration":17.20118,"end_time":"2021-11-03T14:26:59.391279","exception":false,"start_time":"2021-11-03T14:26:42.190099","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:14.545855Z","iopub.execute_input":"2021-11-22T13:31:14.546101Z","iopub.status.idle":"2021-11-22T13:31:39.373924Z","shell.execute_reply.started":"2021-11-22T13:31:14.54607Z","shell.execute_reply":"2021-11-22T13:31:39.373068Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def sn_pairplot(subsett):\n    ax = sns.pairplot(subsett,\n                      hue='year',\n                      vars=['Volume',\n                            'Count',\n                            'VWAP',\n                            'Target',\n                           ])","metadata":{"papermill":{"duration":0.045001,"end_time":"2021-11-03T14:26:59.476789","exception":false,"start_time":"2021-11-03T14:26:59.431788","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:39.378511Z","iopub.execute_input":"2021-11-22T13:31:39.380751Z","iopub.status.idle":"2021-11-22T13:31:39.387089Z","shell.execute_reply.started":"2021-11-22T13:31:39.380711Z","shell.execute_reply":"2021-11-22T13:31:39.386493Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Let us try a simple Plotly OHLC plot for the assets","metadata":{}},{"cell_type":"code","source":"# code inspired by from @yamqwe\nimport gc\npd.set_option(\"display.max_columns\", None)\nfrom datetime import datetime\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nplt.rcParams.update({'font.size': 14})\ndata_folder = \"../input/g-research-crypto-forecasting/\"\nasst_det = pd.read_csv(data_folder + 'asset_details.csv', low_memory=False)\n#train = pd.read_csv(data_folder + 'train.csv', low_memory=False)\nrename_dict = {}\nfor a in asst_det['Asset_ID']: rename_dict[a] = asst_det[asst_det.Asset_ID == a].Asset_Name.values[0]\ncrypto_df['Date'] = crypto_df['Date'].astype('datetime64[s]')\ntrain_daily = pd.DataFrame()","metadata":{"execution":{"iopub.status.busy":"2021-11-22T14:07:56.349246Z","iopub.execute_input":"2021-11-22T14:07:56.349831Z","iopub.status.idle":"2021-11-22T14:07:58.400482Z","shell.execute_reply.started":"2021-11-22T14:07:56.349794Z","shell.execute_reply":"2021-11-22T14:07:58.39968Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# code inspired by from @yamqwe\n\nfor asset_id in asst_det.Asset_ID:\n    train_single = crypto_df[crypto_df.Asset_ID == asset_id].copy()\n    train_single_new = train_single[['Date','Count']].resample('D', on='Date').sum()\n    train_single_new['Open'] = train_single[['Date','Open']].resample('D', on='Date').first()['Open']\n    train_single_new['High'] = train_single[['Date','High']].resample('D', on='Date').max()['High']\n    train_single_new['Low'] = train_single[['Date','Low']].resample('D', on='Date').min()['Low']\n    train_single_new['Close'] = train_single[['Date','Close']].resample('D', on='Date').last()['Close']\n    train_single_new['Volume'] = train_single[['Date','Volume']].resample('D', on='Date').sum()['Volume']\n    train_single_new['Asset_ID'] = asset_id\n    train_daily = train_daily.append(train_single_new.reset_index(drop=False))\ntrain_daily = train_daily.sort_values(by = ['Date', 'Asset_ID']).reset_index(drop=True)\ntrain_daily = train_daily.pivot(index='Date', columns='Asset_ID')[['Count', 'Open', 'High', 'Low', 'Close', 'Volume']]\ntrain_daily = train_daily.reset_index(drop=False)\ntrain_daily['year'] = pd.DatetimeIndex(train_daily['Date']).year\nfig = make_subplots( rows=len(asst_det.Asset_ID), cols=1, subplot_titles=(asst_det.Asset_Name) )\nfor i, asset_id in enumerate(asst_det.Asset_ID):\n    fig.append_trace(go.Candlestick(x=train_daily.Date, \n                                    name=asst_det.Asset_Name[i], \n                                    open=train_daily[('Open', asset_id)], \n                                    high=train_daily[('High', asset_id)], \n                                    low=train_daily[('Low', asset_id)], \n                                    close=train_daily[('Close', asset_id)]),\n                     row=i+1, col=1)\n    fig.update_xaxes(range=[train_daily.Date.iloc[0], train_daily.Date.iloc[-1]], row=i+1, col=1)\n    fig.update_traces(increasing_fill_color='#fa0388', selector=dict(type='ohlc'))\n    fig.update_traces(increasing_line_color='#fc0388', selector=dict(type='ohlc'))\n    fig.update_traces(decreasing_fill_color='#fae703', selector=dict(type='ohlc'))\n    fig.update_traces(decreasing_line_color='#fce703', selector=dict(type='ohlc'))\n    #fig.show()\n\nfig.update_layout(xaxis_rangeslider_visible = False, \n                  xaxis2_rangeslider_visible = False, \n                  xaxis3_rangeslider_visible = False,\n                  xaxis4_rangeslider_visible = False,\n                  xaxis5_rangeslider_visible = False,\n                  xaxis6_rangeslider_visible = False,\n                  xaxis7_rangeslider_visible = False,\n                  xaxis8_rangeslider_visible = False,\n                  xaxis9_rangeslider_visible = False,\n                  xaxis10_rangeslider_visible = False,\n                  xaxis11_rangeslider_visible = False,\n                  xaxis12_rangeslider_visible = False,\n                  xaxis13_rangeslider_visible = False,\n                  xaxis14_rangeslider_visible = False,\n                  height=6000, width=1200, \n                  title_text=\"Plotly OHLC Plots for all G-Research Crypto Assets\",\n                  #legendgrouptitle_font_color='purple',\n                  #legendgrouptitle_font_size=30,\n                  #legendgrouptitle_font_family='Raleway',\n                  #legendgrouptitle=\"Plotly OHLC Plots for all G-Research Crypto Assets\",\n                      margin = dict(\n                          l = 5,\n                          r = 5,\n                          b = 5,\n                          t = 30,\n                          pad = 5)\n                 )    \nfig.update_traces(increasing_fill_color='#fa0388', selector=dict(type='ohlc'))\nfig.update_traces(increasing_line_color='#fc0388', selector=dict(type='ohlc'))\nfig.update_traces(decreasing_fill_color='#fae703', selector=dict(type='ohlc'))\nfig.update_traces(decreasing_line_color='#fce703', selector=dict(type='ohlc'))\nfig.update_traces(legendgrouptitle_font_size=30, selector=dict(type='ohlc'))\nfig.update_traces(legendgrouptitle_font_family='Raleway', selector=dict(type='ohlc'))\nfig.update_traces(legendgrouptitle=\"Plotly OHLC Plots for all G-Research Crypto Assets\", selector=dict(type='ohlc'))\nfig.update_traces(legendgrouptitle_font_color='purple', selector=dict(type='ohlc'))\nfig.show()\n\ndel train_daily,train_single, asst_det\ngc.collect()\nplt.close()","metadata":{"execution":{"iopub.status.busy":"2021-11-22T14:08:13.672068Z","iopub.execute_input":"2021-11-22T14:08:13.672342Z","iopub.status.idle":"2021-11-22T14:08:25.843029Z","shell.execute_reply.started":"2021-11-22T14:08:13.672312Z","shell.execute_reply":"2021-11-22T14:08:25.842271Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from matplotlib import gridspec, ticker\nasset_names = asset_details.Asset_Name.unique()\nfor i in range(0,14):\n    subsett = crypto_df_subset(i, crypto_df)\n    subsett['Date'] = pd.to_datetime(subsett.Date, utc=False)\n    subsett.index = pd.DatetimeIndex(subsett['Date'])\n    plot_close_val(subsett, 'Close',asset_names[i])\n    plot_close_val(subsett, 'Open',asset_names[i])\n    plot_close_val(subsett, 'Volume',asset_names[i])\n    # Try an MPLPlot for the 4000-5000 Data point range\n#    mplplot(subsett[4000:5000], asset_names[i])\n    subsett=subsett.sample(1_000, random_state=529)\n    sn_pairplot(subsett)      \n    plt.tight_layout()\n    plt.show()\n    del subsett","metadata":{"papermill":{"duration":147.675652,"end_time":"2021-11-03T14:29:27.191421","exception":false,"start_time":"2021-11-03T14:26:59.515769","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T13:31:55.930281Z","iopub.status.idle":"2021-11-22T13:31:55.930845Z","shell.execute_reply.started":"2021-11-22T13:31:55.930609Z","shell.execute_reply":"2021-11-22T13:31:55.930635Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 4. Basic Asset Info </span>","metadata":{"papermill":{"duration":0.274487,"end_time":"2021-11-03T14:29:27.747428","exception":false,"start_time":"2021-11-03T14:29:27.472941","status":"completed"},"tags":[]}},{"cell_type":"code","source":"asset_count= []\nfor i in range(14):\n    count = (crypto_df[\"Asset_ID\"]==i).sum()\n    asset_count.append(count)\n","metadata":{"papermill":{"duration":0.878294,"end_time":"2021-11-03T14:29:28.908636","exception":false,"start_time":"2021-11-03T14:29:28.030342","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-22T07:35:59.6716Z","iopub.status.idle":"2021-11-22T07:35:59.673255Z","shell.execute_reply.started":"2021-11-22T07:35:59.672992Z","shell.execute_reply":"2021-11-22T07:35:59.673021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"asset_map = asset_details.set_index('Asset_ID')['Asset_Name'].to_dict()\ncrypto_df['Asset_Name'] = crypto_df['Asset_ID'].map(asset_map)\ncrypto_df.head()\nprint(asset_details)\nprint(asset_map)","metadata":{"papermill":{"duration":1.280477,"end_time":"2021-11-03T14:29:30.471654","exception":false,"start_time":"2021-11-03T14:29:29.191177","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-17T10:11:38.286408Z","iopub.execute_input":"2021-11-17T10:11:38.286647Z","iopub.status.idle":"2021-11-17T10:11:38.880709Z","shell.execute_reply.started":"2021-11-17T10:11:38.286615Z","shell.execute_reply":"2021-11-17T10:11:38.879834Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import plotly.express as px\nimport plotly.graph_objects as go\n\nfig = px.bar(y = asset_details.sort_values(\"Asset_ID\")[\"Asset_Name\"],\n             x = asset_count , \n             color = asset_count ,\n             color_continuous_scale=\"Spectral\") \nfig.update_yaxes(title=\"Assets\")\nfig.update_xaxes(title = \"Number of Entries\")\nfig.update_layout(showlegend = True,\n    title = {\n        'text': 'Asset Data Distribution ',\n        'y':0.95,\n        'x':0.5,\n        'xanchor': 'center',\n        'yanchor': 'top'})\nfig.show()","metadata":{"papermill":{"duration":3.548998,"end_time":"2021-11-03T14:29:34.311397","exception":false,"start_time":"2021-11-03T14:29:30.762399","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-17T10:11:38.881902Z","iopub.execute_input":"2021-11-17T10:11:38.883255Z","iopub.status.idle":"2021-11-17T10:11:42.081628Z","shell.execute_reply.started":"2021-11-17T10:11:38.883211Z","shell.execute_reply":"2021-11-17T10:11:42.080944Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"asset_details[\"Weight_Percentage\"] = (asset_details[\"Weight\"] / asset_details[\"Weight\"].sum()) * 100\nasset_details.sort_values(\"Weight\", ascending=False).style.background_gradient(cmap='gist_rainbow_r')","metadata":{"papermill":{"duration":0.303413,"end_time":"2021-11-03T14:29:34.906047","exception":false,"start_time":"2021-11-03T14:29:34.602634","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-17T10:11:42.085501Z","iopub.execute_input":"2021-11-17T10:11:42.087734Z","iopub.status.idle":"2021-11-17T10:11:42.116362Z","shell.execute_reply.started":"2021-11-17T10:11:42.087692Z","shell.execute_reply":"2021-11-17T10:11:42.115679Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nfig = px.pie(asset_details, values='Weight_Percentage', names='Asset_Name', title='Cryptocurrency Asset Weightage')\nfig.show()","metadata":{"papermill":{"duration":0.339398,"end_time":"2021-11-03T14:29:35.526369","exception":false,"start_time":"2021-11-03T14:29:35.186971","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-17T10:11:42.120657Z","iopub.execute_input":"2021-11-17T10:11:42.123171Z","iopub.status.idle":"2021-11-17T10:11:42.198671Z","shell.execute_reply.started":"2021-11-17T10:11:42.123125Z","shell.execute_reply":"2021-11-17T10:11:42.198066Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.sunburst(data_frame=asset_details,\n                  path=['Asset_Name','Weight_Percentage', 'Weight'],\n                  color='Asset_Name',\n                  color_discrete_sequence=px.colors.qualitative.Alphabet,\n                  title='Asset_ID'\n                 )\n\nfig.update_traces(textinfo='label')\nfig.update_layout(margin=dict(t=40, l=0, r=0, b=0))\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2021-11-17T10:33:58.878184Z","iopub.execute_input":"2021-11-17T10:33:58.878851Z","iopub.status.idle":"2021-11-17T10:33:58.980082Z","shell.execute_reply.started":"2021-11-17T10:33:58.878812Z","shell.execute_reply":"2021-11-17T10:33:58.979125Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"btc = crypto_df_subset(0, crypto_df)\n#subset last 10000 rows\nbtc=btc[-10000:]\nbtc.shape\nbtc['Date']=btc['Date'].astype('datetime64[s]')","metadata":{"papermill":{"duration":0.746416,"end_time":"2021-11-03T14:29:36.551002","exception":false,"start_time":"2021-11-03T14:29:35.804586","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:30:51.674127Z","iopub.execute_input":"2021-11-12T09:30:51.674791Z","iopub.status.idle":"2021-11-12T09:30:52.248833Z","shell.execute_reply.started":"2021-11-12T09:30:51.674711Z","shell.execute_reply":"2021-11-12T09:30:52.247702Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> Some VWAP Violin Chart for Crypto Assets</span>","metadata":{"papermill":{"duration":0.287052,"end_time":"2021-11-03T14:29:37.900578","exception":false,"start_time":"2021-11-03T14:29:37.613526","status":"completed"},"tags":[]}},{"cell_type":"code","source":"\n#VWAP Plot 2019\nfig, axs = plt.subplots(7, 2,\n                        figsize=(15, 45), sharex=True)\naxs = axs.flatten()\ni = 0\nfor asn, d in crypto_df.query('year == 2019').sample(1_000_00, random_state=529).groupby('Asset_Name'):\n    sns.boxplot(data=d, x='month', y='VWAP', ax=axs[i])\n    axs[i].set_title(asn + 'in Year 2019')\n    i += 1\nplt.tight_layout()\nplt.show()\n\n#VWAP Plot 2020\nfig, axs = plt.subplots(7, 2,\n                        figsize=(15, 45), sharex=True)\naxs = axs.flatten()\ni = 0\nfor asn, d in crypto_df.query('year == 2020').sample(1_000_00, random_state=529).groupby('Asset_Name'):\n    sns.boxplot(data=d, x='month', y='VWAP', ax=axs[i])\n    axs[i].set_title(asn + 'in Year 2020')\n    i += 1\nplt.tight_layout()\nplt.show()\n\n#VWAP Plot 2020\nfig, axs = plt.subplots(7, 2,\n                        figsize=(15, 45), sharex=True)\naxs = axs.flatten()\ni = 0\nfor asn, d in crypto_df.query('year == 2021').sample(1_000_00, random_state=529).groupby('Asset_Name'):\n    sns.boxplot(data=d, x='month', y='VWAP', ax=axs[i])\n    axs[i].set_title(asn + 'in Year 2021')\n    i += 1\nplt.tight_layout()\nplt.show()","metadata":{"papermill":{"duration":11.763977,"end_time":"2021-11-03T14:29:49.950918","exception":false,"start_time":"2021-11-03T14:29:38.186941","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:30:52.2509Z","iopub.execute_input":"2021-11-12T09:30:52.251266Z","iopub.status.idle":"2021-11-12T09:31:15.612667Z","shell.execute_reply.started":"2021-11-12T09:30:52.251221Z","shell.execute_reply":"2021-11-12T09:31:15.611664Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 5. Basic Rolling Averages  (for Bit Coin)</span>","metadata":{"papermill":{"duration":0.29798,"end_time":"2021-11-03T14:29:50.553681","exception":false,"start_time":"2021-11-03T14:29:50.255701","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xlarge\" style=\"color:#FF0080\"> 5.1 Basic Rolling Averages</span>","metadata":{"papermill":{"duration":0.302629,"end_time":"2021-11-03T14:29:51.160606","exception":false,"start_time":"2021-11-03T14:29:50.857977","status":"completed"},"tags":[]}},{"cell_type":"code","source":"# Isolate the adjusted closing prices \nadj_close_px = btc['Close']\n\n# Calculate the moving average\nmoving_avg = adj_close_px.rolling(window=40).mean()\n\n# Inspect the result\nmoving_avg[-10:]","metadata":{"papermill":{"duration":0.318232,"end_time":"2021-11-03T14:29:51.782","exception":false,"start_time":"2021-11-03T14:29:51.463768","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:15.614163Z","iopub.execute_input":"2021-11-12T09:31:15.614642Z","iopub.status.idle":"2021-11-12T09:31:15.628569Z","shell.execute_reply.started":"2021-11-12T09:31:15.614597Z","shell.execute_reply":"2021-11-12T09:31:15.627294Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Short moving window rolling mean\nbtc['42'] = adj_close_px.rolling(window=40).mean()\n\n# Long moving window rolling mean\nbtc['252'] = adj_close_px.rolling(window=252).mean()\n\n# Plot the adjusted closing price, the short and long windows of rolling means\nbtc[['Close', '42', '252']].plot()\n\nplt.show()","metadata":{"papermill":{"duration":0.617505,"end_time":"2021-11-03T14:29:52.7037","exception":false,"start_time":"2021-11-03T14:29:52.086195","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:15.630641Z","iopub.execute_input":"2021-11-12T09:31:15.631354Z","iopub.status.idle":"2021-11-12T09:31:15.993397Z","shell.execute_reply.started":"2021-11-12T09:31:15.631313Z","shell.execute_reply":"2021-11-12T09:31:15.992433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"daily_close_px = btc[['Close']]\n# Calculate the daily percentage change for `daily_close_px`\ndaily_pct_change = daily_close_px.pct_change()\n\n# Plot the distributions\ndaily_pct_change.hist(bins=50, sharex=True, figsize=(12,8))\n\n# Show the resulting plot\nplt.show()","metadata":{"papermill":{"duration":0.642738,"end_time":"2021-11-03T14:29:53.656847","exception":false,"start_time":"2021-11-03T14:29:53.014109","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:15.994929Z","iopub.execute_input":"2021-11-12T09:31:15.99584Z","iopub.status.idle":"2021-11-12T09:31:16.412075Z","shell.execute_reply.started":"2021-11-12T09:31:15.995792Z","shell.execute_reply":"2021-11-12T09:31:16.411061Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Define the minumum of periods to consider \nmin_periods = 75 \n\n# Calculate the volatility\nvol = daily_pct_change.rolling(min_periods).std() * np.sqrt(min_periods) \n\n# Plot the volatility\nvol.plot(figsize=(10, 8))\n\n# Show the plot\nplt.show()","metadata":{"papermill":{"duration":0.569986,"end_time":"2021-11-03T14:29:54.545648","exception":false,"start_time":"2021-11-03T14:29:53.975662","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:16.413591Z","iopub.execute_input":"2021-11-12T09:31:16.414631Z","iopub.status.idle":"2021-11-12T09:31:16.747535Z","shell.execute_reply.started":"2021-11-12T09:31:16.414584Z","shell.execute_reply":"2021-11-12T09:31:16.746576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Plot a scatter matrix with the `daily_pct_change` data \npd.plotting.scatter_matrix(daily_pct_change, diagonal='kde', alpha=0.1,figsize=(12,12))\n\n# Show the plot\nplt.show()","metadata":{"papermill":{"duration":1.088645,"end_time":"2021-11-03T14:29:55.938201","exception":false,"start_time":"2021-11-03T14:29:54.849556","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:16.749274Z","iopub.execute_input":"2021-11-12T09:31:16.75234Z","iopub.status.idle":"2021-11-12T09:31:17.408008Z","shell.execute_reply.started":"2021-11-12T09:31:16.752294Z","shell.execute_reply":"2021-11-12T09:31:17.406759Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 6 Basic MACD  (for Bit Coin)</span>","metadata":{"papermill":{"duration":0.311569,"end_time":"2021-11-03T14:29:56.735957","exception":false,"start_time":"2021-11-03T14:29:56.424388","status":"completed"},"tags":[]}},{"cell_type":"code","source":"import plotly.graph_objects as go\n\nbtc=btc.reset_index()\n\nfig = go.Figure(data=go.Ohlc(x=btc['Date'],\n        open=btc['Open'],\n        high=btc['High'],\n        low=btc['Low'],\n        close=btc['Close']))\nfig.show()","metadata":{"papermill":{"duration":0.635433,"end_time":"2021-11-03T14:29:57.681504","exception":false,"start_time":"2021-11-03T14:29:57.046071","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:17.410852Z","iopub.execute_input":"2021-11-12T09:31:17.4123Z","iopub.status.idle":"2021-11-12T09:31:18.241888Z","shell.execute_reply.started":"2021-11-12T09:31:17.412248Z","shell.execute_reply":"2021-11-12T09:31:18.240733Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"btc=btc.reset_index()\n\nbtc['SMA5'] = btc.Close.rolling(5).mean()\nbtc['SMA20'] = btc.Close.rolling(20).mean()\nbtc['SMA50'] = btc.Close.rolling(50).mean()\nbtc['SMA200'] = btc.Close.rolling(200).mean()\nbtc['SMA500'] = btc.Close.rolling(500).mean()\n\nfig = go.Figure(data=[go.Ohlc(x=btc['Date'],open=btc['Open'],high=btc['High'],low=btc['Low'],close=btc['Close'], name = \"OHLC\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA5, line=dict(color='orange', width=1), name=\"SMA5\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA20, line=dict(color='green', width=1), name=\"SMA20\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA50, line=dict(color='blue', width=1), name=\"SMA50\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA200, line=dict(color='violet', width=1), name=\"SMA200\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA500, line=dict(color='purple', width=1), name=\"SMA500\")])\nfig.show()","metadata":{"papermill":{"duration":2.367434,"end_time":"2021-11-03T14:30:00.369878","exception":false,"start_time":"2021-11-03T14:29:58.002444","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:18.243716Z","iopub.execute_input":"2021-11-12T09:31:18.24419Z","iopub.status.idle":"2021-11-12T09:31:20.094457Z","shell.execute_reply.started":"2021-11-12T09:31:18.244149Z","shell.execute_reply":"2021-11-12T09:31:20.092725Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"btc['EMA5'] = btc.Close.ewm(span=5, adjust=False).mean()\nbtc['EMA20'] = btc.Close.ewm(span=20, adjust=False).mean()\nbtc['EMA50'] = btc.Close.ewm(span=50, adjust=False).mean()\nbtc['EMA200'] = btc.Close.ewm(span=200, adjust=False).mean()\nbtc['EMA500'] = btc.Close.ewm(span=500, adjust=False).mean()\n\nfig = go.Figure(data=[go.Ohlc(x=btc['Date'],\n                              open=btc['Open'],\n                              high=btc['High'],\n                              low=btc['Low'],\n                              close=btc['Close'], name = \"OHLC\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA5, line=dict(color='orange', width=1), name=\"EMA5\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA20, line=dict(color='green', width=1), name=\"EMA20\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA50, line=dict(color='blue', width=1), name=\"EMA50\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA200, line=dict(color='violet', width=1), name=\"EMA200\"),\n                      go.Scatter(x=btc.Date, y=btc.SMA500, line=dict(color='purple', width=1), name=\"EMA500\")])\nfig.show()","metadata":{"papermill":{"duration":2.150813,"end_time":"2021-11-03T14:30:02.919923","exception":false,"start_time":"2021-11-03T14:30:00.76911","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:20.096509Z","iopub.execute_input":"2021-11-12T09:31:20.096945Z","iopub.status.idle":"2021-11-12T09:31:21.979106Z","shell.execute_reply.started":"2021-11-12T09:31:20.096897Z","shell.execute_reply":"2021-11-12T09:31:21.977781Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 7 FINTA Tech Analysis Ratios  (for Bit Coin)</span>","metadata":{"papermill":{"duration":0.397484,"end_time":"2021-11-03T14:30:03.725566","exception":false,"start_time":"2021-11-03T14:30:03.328082","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xlarge\" style=\"color:#FF0080\"> Let us do a financial ratios calculation using FINTA library</span>\n* Simple Moving Average 'SMA'\n* Simple Moving Median 'SMM'\n* Smoothed Simple Moving Average 'SSMA'\n* Exponential Moving Average 'EMA'\n* Double Exponential Moving Average 'DEMA'\n* Triple Exponential Moving Average 'TEMA'\n* Triangular Moving Average 'TRIMA'\n* Triple Exponential Moving Average Oscillator 'TRIX'\n* Volume Adjusted Moving Average 'VAMA'\n* Kaufman Efficiency Indicator 'ER'\n* Kaufman's Adaptive Moving Average 'KAMA'\n* Zero Lag Exponential Moving Average 'ZLEMA'\n* Weighted Moving Average 'WMA'\n* Hull Moving Average 'HMA'\n* Elastic Volume Moving Average 'EVWMA'\n* Volume Weighted Average Price 'VWAP'\n* Smoothed Moving Average 'SMMA'\n* Fractal Adaptive Moving Average 'FRAMA'\n* Moving Average Convergence Divergence 'MACD'\n* Percentage Price Oscillator 'PPO'\n* Volume-Weighted MACD 'VW_MACD'\n* Elastic-Volume weighted MACD 'EV_MACD'\n* Market Momentum 'MOM'\n* Rate-of-Change 'ROC'\n* Relative Strenght Index 'RSI'\n* Inverse Fisher Transform RSI 'IFT_RSI'\n* True Range 'TR'\n* Average True Range 'ATR'\n* Stop-and-Reverse 'SAR'\n* Bollinger Bands 'BBANDS'\n* Bollinger Bands Width 'BBWIDTH'\n* Momentum Breakout Bands 'MOBO'\n* Percent B 'PERCENT_B'\n* Keltner Channels 'KC'\n* Donchian Channel 'DO'\n* Directional Movement Indicator 'DMI'\n* Average Directional Index 'ADX'\n* Pivot Points 'PIVOT'\n* Fibonacci Pivot Points 'PIVOT_FIB'\n* Stochastic Oscillator %K 'STOCH'\n* Stochastic oscillator %D 'STOCHD'\n* Stochastic RSI 'STOCHRSI'\n* Williams %R 'WILLIAMS'\n* Ultimate Oscillator 'UO'\n* Awesome Oscillator 'AO'\n* Mass Index 'MI'\n* Vortex Indicator 'VORTEX'\n* Know Sure Thing 'KST'\n* True Strength Index 'TSI'\n* Typical Price 'TP'\n* Accumulation-Distribution Line 'ADL'\n* Chaikin Oscillator 'CHAIKIN'\n* Money Flow Index 'MFI'\n* On Balance Volume 'OBV'\n* Weighter OBV 'WOBV'\n* Volume Zone Oscillator 'VZO'\n* Price Zone Oscillator 'PZO'\n* Elder's Force Index 'EFI'\n* Cummulative Force Index 'CFI'\n* Bull power and Bear Power 'EBBP'\n* Ease of Movement 'EMV'\n* Commodity Channel Index 'CCI'\n* Coppock Curve 'COPP'\n* Buy and Sell Pressure 'BASP'\n* Normalized BASP 'BASPN'\n* Chande Momentum Oscillator 'CMO'\n* Chandelier Exit 'CHANDELIER'\n* Qstick 'QSTICK'\n* Twiggs Money Index 'TMF'\n* Wave Trend Oscillator 'WTO'\n* Fisher Transform 'FISH'\n* Ichimoku Cloud 'ICHIMOKU'\n* Adaptive Price Zone 'APZ'\n* Squeeze Momentum Indicator 'SQZMI'\n* Volume Price Trend 'VPT'\n* Finite Volume Element 'FVE'\n* Volume Flow Indicator 'VFI'\n* Moving Standard deviation 'MSD'\n* Schaff Trend Cycle 'STC'","metadata":{"papermill":{"duration":0.416876,"end_time":"2021-11-03T14:30:04.548354","exception":false,"start_time":"2021-11-03T14:30:04.131478","status":"completed"},"tags":[]}},{"cell_type":"code","source":"try:\n    from finta import TA\n    from backtesting import Backtest, Strategy\n    from backtesting.lib import crossover\nexcept:\n    !pip install finta backtesting\n    from finta import TA\n    from backtesting import Backtest, Strategy\n    from backtesting.lib import crossover","metadata":{"_kg_hide-input":true,"_kg_hide-output":true,"papermill":{"duration":11.684066,"end_time":"2021-11-03T14:30:16.643098","exception":false,"start_time":"2021-11-03T14:30:04.959032","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:21.981388Z","iopub.execute_input":"2021-11-12T09:31:21.981768Z","iopub.status.idle":"2021-11-12T09:31:38.840536Z","shell.execute_reply.started":"2021-11-12T09:31:21.98171Z","shell.execute_reply":"2021-11-12T09:31:38.839467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ohlc=btc\nprint(TA.SMA(ohlc, 42))","metadata":{"papermill":{"duration":0.439421,"end_time":"2021-11-03T14:30:17.517767","exception":false,"start_time":"2021-11-03T14:30:17.078346","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:31:38.842573Z","iopub.execute_input":"2021-11-12T09:31:38.843367Z","iopub.status.idle":"2021-11-12T09:31:38.861778Z","shell.execute_reply.started":"2021-11-12T09:31:38.843314Z","shell.execute_reply":"2021-11-12T09:31:38.86073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"function_dict = {' Simple Moving Average ' : 'SMA',\n                 ' Simple Moving Median ' : 'SMM',\n                 ' Smoothed Simple Moving Average ' : 'SSMA',\n                 ' Exponential Moving Average ' : 'EMA',\n                 ' Double Exponential Moving Average ' : 'DEMA',\n                 ' Triple Exponential Moving Average ' : 'TEMA',\n                 ' Triangular Moving Average ' : 'TRIMA',\n                 ' Triple Exponential Moving Average Oscillator ' : 'TRIX',\n                 ' Volume Adjusted Moving Average ' : 'VAMA',\n                 ' Kaufman Efficiency Indicator ' : 'ER',\n                 ' Kaufmans Adaptive Moving Average ' : 'KAMA',\n                 ' Zero Lag Exponential Moving Average ' : 'ZLEMA',\n                 ' Weighted Moving Average ' : 'WMA',\n                 ' Hull Moving Average ' : 'HMA',\n                 ' Elastic Volume Moving Average ' : 'EVWMA',\n                 ' Volume Weighted Average Price ' : 'VWAP',\n                 ' Smoothed Moving Average ' : 'SMMA',\n                 ' Fractal Adaptive Moving Average ' : 'FRAMA',\n                 ' Moving Average Convergence Divergence ' : 'MACD',\n                 ' Percentage Price Oscillator ' : 'PPO',\n                 ' Volume-Weighted MACD ' : 'VW_MACD',\n                 ' Elastic-Volume weighted MACD ' : 'EV_MACD',\n                 ' Market Momentum ' : 'MOM',\n                 ' Rate-of-Change ' : 'ROC',\n                 ' Relative Strength Index ' : 'RSI',\n                 ' Inverse Fisher Transform RSI ' : 'IFT_RSI',\n                 ' True Range ' : 'TR',\n                 ' Average True Range ' : 'ATR',\n                 ' Stop-and-Reverse ' : 'SAR',\n                 ' Bollinger Bands ' : 'BBANDS',\n                 ' Bollinger Bands Width ' : 'BBWIDTH',\n                 ' Momentum Breakout Bands ' : 'MOBO',\n                 ' Percent B ' : 'PERCENT_B',\n                 ' Keltner Channels ' : 'KC',\n                 ' Donchian Channel ' : 'DO',\n                 ' Directional Movement Indicator ' : 'DMI',\n                 ' Average Directional Index ' : 'ADX',\n                 ' Pivot Points ' : 'PIVOT',\n                 ' Fibonacci Pivot Points ' : 'PIVOT_FIB',\n                 ' Stochastic Oscillator Percent K ' : 'STOCH',\n                 ' Stochastic oscillator Percent D ' : 'STOCHD',\n                 ' Stochastic RSI ' : 'STOCHRSI',\n                 ' Williams Percent R ' : 'WILLIAMS',\n                 ' Ultimate Oscillator ' : 'UO',\n                 ' Awesome Oscillator ' : 'AO',\n                 ' Mass Index ' : 'MI',\n                 ' Vortex Indicator ' : 'VORTEX',\n                 ' Know Sure Thing ' : 'KST',\n                 ' True Strength Index ' : 'TSI',\n                 ' Typical Price ' : 'TP',\n                 ' Accumulation-Distribution Line ' : 'ADL',\n                 ' Chaikin Oscillator ' : 'CHAIKIN',\n                 ' Money Flow Index ' : 'MFI',\n                 ' On Balance Volume ' : 'OBV',\n                 ' Weighter OBV ' : 'WOBV',\n                 ' Volume Zone Oscillator ' : 'VZO',\n                 ' Price Zone Oscillator ' : 'PZO',\n                 ' Elders Force Index ' : 'EFI',\n                 ' Cummulative Force Index ' : 'CFI',\n                 ' Bull power and Bear Power ' : 'EBBP',\n                 ' Ease of Movement ' : 'EMV',\n                 ' Commodity Channel Index ' : 'CCI',\n                 ' Coppock Curve ' : 'COPP',\n                 ' Buy and Sell Pressure ' : 'BASP',\n                 ' Normalized BASP ' : 'BASPN',\n                 ' Chande Momentum Oscillator ' : 'CMO',\n                 ' Chandelier Exit ' : 'CHANDELIER',\n                 ' Qstick ' : 'QSTICK',\n                 #' Twiggs Money Index ' : 'TMF',\n                 ' Wave Trend Oscillator ' : 'WTO',\n                 ' Fisher Transform ' : 'FISH',\n                 ' Ichimoku Cloud ' : 'ICHIMOKU',\n                 ' Adaptive Price Zone ' : 'APZ',\n                 #' Squeeze Momentum Indicator ' : 'SQZMI',\n                 ' Volume Price Trend ' : 'VPT',\n                 ' Finite Volume Element ' : 'FVE',\n                 ' Volume Flow Indicator ' : 'VFI',\n                 ' Moving Standard deviation ' : 'MSD',\n                 ' Schaff Trend Cycle ' : 'STC'}\n\n\nfor i in range(0,14):\n    subsett = crypto_df_subset(i, crypto_df)\n    subsett['Date'] = pd.to_datetime(subsett.Date, utc=False)\n    subsett.index = pd.DatetimeIndex(subsett['Date'])\n    ohlc=subsett[-10000:]\n    for key, value in function_dict .items():\n        function_name = \"TA.\" + value + \"(ohlc).plot(title='\" + key + \" for\" + asset_names[i]+ \"')\"\n        result = eval(function_name)","metadata":{"papermill":{"duration":12.361839,"end_time":"2021-11-03T14:30:30.287644","exception":false,"start_time":"2021-11-03T14:30:17.925805","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T09:55:57.073469Z","iopub.execute_input":"2021-11-12T09:55:57.074101Z","iopub.status.idle":"2021-11-12T10:01:29.341205Z","shell.execute_reply.started":"2021-11-12T09:55:57.074052Z","shell.execute_reply":"2021-11-12T10:01:29.339766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ohlc=btc","metadata":{"execution":{"iopub.status.busy":"2021-11-12T10:01:29.343821Z","iopub.execute_input":"2021-11-12T10:01:29.344441Z","iopub.status.idle":"2021-11-12T10:01:29.350685Z","shell.execute_reply.started":"2021-11-12T10:01:29.344361Z","shell.execute_reply":"2021-11-12T10:01:29.349522Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 8 BackTesting Trading Strategy  (for Bit coin) </span>","metadata":{"papermill":{"duration":0.475236,"end_time":"2021-11-03T14:30:31.23618","exception":false,"start_time":"2021-11-03T14:30:30.760944","status":"completed"},"tags":[]}},{"cell_type":"code","source":"# Defining DEMA cross strategy\nclass DemaCross(Strategy):\n\n    def init(self):\n\n        self.ma1 = self.I(TA.DEMA, ohlc, 10)\n        self.ma2 = self.I(TA.DEMA, ohlc, 20)\n\n    def next(self):\n        if crossover(self.ma1, self.ma2):\n            self.buy()\n        elif crossover(self.ma2, self.ma1):\n            self.sell()","metadata":{"papermill":{"duration":0.572513,"end_time":"2021-11-03T14:30:32.282035","exception":false,"start_time":"2021-11-03T14:30:31.709522","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:18:37.689295Z","iopub.execute_input":"2021-11-12T06:18:37.689932Z","iopub.status.idle":"2021-11-12T06:18:37.698639Z","shell.execute_reply.started":"2021-11-12T06:18:37.689883Z","shell.execute_reply":"2021-11-12T06:18:37.697481Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> Let us do a bit of backtesting with a value of $100000  (for Bit Coin) </span>","metadata":{"papermill":{"duration":0.485587,"end_time":"2021-11-03T14:30:33.39041","exception":false,"start_time":"2021-11-03T14:30:32.904823","status":"completed"},"tags":[]}},{"cell_type":"code","source":"ohlc = btc\nbt = Backtest(ohlc, DemaCross,\n              cash=100000, commission=0.015, exclusive_orders=True)","metadata":{"papermill":{"duration":0.494442,"end_time":"2021-11-03T14:30:34.363453","exception":false,"start_time":"2021-11-03T14:30:33.869011","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:18:37.70068Z","iopub.execute_input":"2021-11-12T06:18:37.701239Z","iopub.status.idle":"2021-11-12T06:18:37.72129Z","shell.execute_reply.started":"2021-11-12T06:18:37.701148Z","shell.execute_reply":"2021-11-12T06:18:37.720207Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xlarge\" style=\"color:#FF0080\"> Back Testing Summary  (for Bit Coin) </span>","metadata":{"papermill":{"duration":0.473464,"end_time":"2021-11-03T14:30:35.33398","exception":false,"start_time":"2021-11-03T14:30:34.860516","status":"completed"},"tags":[]}},{"cell_type":"code","source":"bt.run()","metadata":{"papermill":{"duration":0.811893,"end_time":"2021-11-03T14:30:36.622732","exception":false,"start_time":"2021-11-03T14:30:35.810839","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:18:37.726713Z","iopub.execute_input":"2021-11-12T06:18:37.726958Z","iopub.status.idle":"2021-11-12T06:18:38.104988Z","shell.execute_reply.started":"2021-11-12T06:18:37.726927Z","shell.execute_reply":"2021-11-12T06:18:38.104005Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xlarge\" style=\"color:#FF0080\"> Use Zoom to see the performance of the stock  (for Bit Coin)</span>","metadata":{"papermill":{"duration":0.475677,"end_time":"2021-11-03T14:30:38.516346","exception":false,"start_time":"2021-11-03T14:30:38.040669","status":"completed"},"tags":[]}},{"cell_type":"code","source":"bt.plot()","metadata":{"papermill":{"duration":1.371749,"end_time":"2021-11-03T14:30:40.369857","exception":false,"start_time":"2021-11-03T14:30:38.998108","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:18:38.107023Z","iopub.execute_input":"2021-11-12T06:18:38.107402Z","iopub.status.idle":"2021-11-12T06:18:38.919432Z","shell.execute_reply.started":"2021-11-12T06:18:38.107354Z","shell.execute_reply":"2021-11-12T06:18:38.918473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 8.1 BackTesting Trading Strategy Using KNN  (for Bit Coin)</span>","metadata":{"papermill":{"duration":0.514176,"end_time":"2021-11-03T14:30:41.433979","exception":false,"start_time":"2021-11-03T14:30:40.919803","status":"completed"},"tags":[]}},{"cell_type":"code","source":"from backtesting import Strategy\nfrom backtesting.lib import crossover\nfrom backtesting.test import SMA\nfrom backtesting.lib import plot_heatmaps\n\ndef BBANDS(data, n_lookback, n_std):\n    \"\"\"Bollinger bands indicator\"\"\"\n    hlc3 = (data.High + data.Low + data.Close) / 3\n    mean, std = hlc3.rolling(n_lookback).mean(), hlc3.rolling(n_lookback).std()\n    upper = mean + n_std*std\n    lower = mean - n_std*std\n    return upper, lower\n\n\n\nclass Sma4Cross(Strategy):\n    n1 = 50\n    n2 = 100\n    n_enter = 20\n    n_exit = 10\n    \n    def init(self):\n        self.sma1 = self.I(SMA, self.data.Close, self.n1)\n        self.sma2 = self.I(SMA, self.data.Close, self.n2)\n        self.sma_enter = self.I(SMA, self.data.Close, self.n_enter)\n        self.sma_exit = self.I(SMA, self.data.Close, self.n_exit)\n        \n    def next(self):\n        \n        if not self.position:\n            \n            # On upwards trend, if price closes above\n            # \"entry\" MA, go long\n            \n            # Here, even though the operands are arrays, this\n            # works by implicitly comparing the two last values\n            if self.sma1 > self.sma2:\n                if crossover(self.data.Close, self.sma_enter):\n                    self.buy()\n                    \n            # On downwards trend, if price closes below\n            # \"entry\" MA, go short\n            \n            else:\n                if crossover(self.sma_enter, self.data.Close):\n                    self.sell()\n        \n        # But if we already hold a position and the price\n        # closes back below (above) \"exit\" MA, close the position\n        \n        else:\n            if (self.position.is_long and\n                crossover(self.sma_exit, self.data.Close)\n                or\n                self.position.is_short and\n                crossover(self.data.Close, self.sma_exit)):\n                \n                self.position.close()","metadata":{"papermill":{"duration":0.553484,"end_time":"2021-11-03T14:30:42.506288","exception":false,"start_time":"2021-11-03T14:30:41.952804","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:18:38.92119Z","iopub.execute_input":"2021-11-12T06:18:38.921922Z","iopub.status.idle":"2021-11-12T06:18:38.967309Z","shell.execute_reply.started":"2021-11-12T06:18:38.921878Z","shell.execute_reply":"2021-11-12T06:18:38.966348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> 8.2 BackTesting Trading Strategy Heatmaps  (for Bit Coin)</span>","metadata":{"papermill":{"duration":0.747818,"end_time":"2021-11-03T14:30:43.760006","exception":false,"start_time":"2021-11-03T14:30:43.012188","status":"completed"},"tags":[]}},{"cell_type":"code","source":"%%time \n\nfrom backtesting import Backtest\nfrom backtesting.test import GOOG\nfrom backtesting.lib import plot_heatmaps\n\n\nbacktest = Backtest(ohlc, Sma4Cross, commission=.002)\n\nstats, heatmap = backtest.optimize(\n    n1=range(10, 110, 10),\n    n2=range(20, 210, 20),\n    n_enter=range(15, 35, 5),\n    n_exit=range(10, 25, 5),\n    constraint=lambda p: p.n_exit < p.n_enter < p.n1 < p.n2,\n    maximize='Equity Final [$]',\n    max_tries=200,\n    random_state=0,\n    return_heatmap=True)","metadata":{"papermill":{"duration":63.456386,"end_time":"2021-11-03T14:31:47.727073","exception":false,"start_time":"2021-11-03T14:30:44.270687","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:18:38.9687Z","iopub.execute_input":"2021-11-12T06:18:38.969599Z","iopub.status.idle":"2021-11-12T06:20:09.422232Z","shell.execute_reply.started":"2021-11-12T06:18:38.969544Z","shell.execute_reply":"2021-11-12T06:20:09.42105Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"heatmap","metadata":{"papermill":{"duration":0.529312,"end_time":"2021-11-03T14:31:48.79522","exception":false,"start_time":"2021-11-03T14:31:48.265908","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:20:09.424637Z","iopub.execute_input":"2021-11-12T06:20:09.425027Z","iopub.status.idle":"2021-11-12T06:20:09.44315Z","shell.execute_reply.started":"2021-11-12T06:20:09.424962Z","shell.execute_reply":"2021-11-12T06:20:09.441862Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"hm = heatmap.groupby(['n1', 'n2']).mean().unstack()\nhm","metadata":{"papermill":{"duration":0.616739,"end_time":"2021-11-03T14:31:50.078932","exception":false,"start_time":"2021-11-03T14:31:49.462193","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:20:09.445365Z","iopub.execute_input":"2021-11-12T06:20:09.445714Z","iopub.status.idle":"2021-11-12T06:20:09.47244Z","shell.execute_reply.started":"2021-11-12T06:20:09.445671Z","shell.execute_reply":"2021-11-12T06:20:09.471292Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from backtesting.lib import plot_heatmaps\n\n\nplot_heatmaps(heatmap, agg='mean')","metadata":{"papermill":{"duration":0.736036,"end_time":"2021-11-03T14:31:51.327944","exception":false,"start_time":"2021-11-03T14:31:50.591908","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:20:09.474762Z","iopub.execute_input":"2021-11-12T06:20:09.475682Z","iopub.status.idle":"2021-11-12T06:20:09.949299Z","shell.execute_reply.started":"2021-11-12T06:20:09.475631Z","shell.execute_reply":"2021-11-12T06:20:09.948346Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%capture\n\n!pip install scikit-optimize  # This is a run-time dependency","metadata":{"papermill":{"duration":7.047377,"end_time":"2021-11-03T14:31:58.908017","exception":false,"start_time":"2021-11-03T14:31:51.86064","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:20:09.950882Z","iopub.execute_input":"2021-11-12T06:20:09.951788Z","iopub.status.idle":"2021-11-12T06:20:19.288958Z","shell.execute_reply.started":"2021-11-12T06:20:09.951739Z","shell.execute_reply":"2021-11-12T06:20:19.287532Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n\nstats_skopt, heatmap, optimize_result = backtest.optimize(\n    n1=[10, 100],      # Note: For method=\"skopt\", we\n    n2=[20, 200],      # only need interval end-points\n    n_enter=[10, 40],\n    n_exit=[10, 30],\n    constraint=lambda p: p.n_exit < p.n_enter < p.n1 < p.n2,\n    maximize='Equity Final [$]',\n    method='skopt',\n    max_tries=200,\n    random_state=0,\n    return_heatmap=True,\n    return_optimization=True)","metadata":{"papermill":{"duration":49.391156,"end_time":"2021-11-03T14:32:48.820897","exception":false,"start_time":"2021-11-03T14:31:59.429741","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:20:19.292212Z","iopub.execute_input":"2021-11-12T06:20:19.292971Z","iopub.status.idle":"2021-11-12T06:21:21.072541Z","shell.execute_reply.started":"2021-11-12T06:20:19.292918Z","shell.execute_reply":"2021-11-12T06:21:21.071324Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from skopt.plots import plot_objective\n\n_ = plot_objective(optimize_result, n_points=10)","metadata":{"papermill":{"duration":4.11147,"end_time":"2021-11-03T14:32:53.451183","exception":false,"start_time":"2021-11-03T14:32:49.339713","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:21:21.076647Z","iopub.execute_input":"2021-11-12T06:21:21.077034Z","iopub.status.idle":"2021-11-12T06:21:25.89522Z","shell.execute_reply.started":"2021-11-12T06:21:21.077Z","shell.execute_reply":"2021-11-12T06:21:25.89408Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from skopt.plots import plot_evaluations\n\n_ = plot_evaluations(optimize_result, bins=10)","metadata":{"papermill":{"duration":2.762423,"end_time":"2021-11-03T14:32:56.764239","exception":false,"start_time":"2021-11-03T14:32:54.001816","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-11-12T06:21:25.897012Z","iopub.execute_input":"2021-11-12T06:21:25.897703Z","iopub.status.idle":"2021-11-12T06:21:28.513113Z","shell.execute_reply.started":"2021-11-12T06:21:25.897658Z","shell.execute_reply":"2021-11-12T06:21:28.5121Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  <span class=\"title-section w3-xxlarge\" style=\"color:#FF0080\"> Credits </span>\n\n###  <span class=\"title-section w3-large\" style=\"color:#FF0080\"> Multiple inputs and inspirations by many kagglers. Fully curated list is getting updated</span>","metadata":{}},{"cell_type":"markdown","source":"##  <span class=\"title-section w3-xlarge\" style=\"color:#FF0080\"> Work In Progress</span>","metadata":{"papermill":{"duration":0.528231,"end_time":"2021-11-03T14:32:57.823622","exception":false,"start_time":"2021-11-03T14:32:57.295391","status":"completed"},"tags":[]}}]}