{"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":"import os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-02-05T07:38:40.587666Z","iopub.execute_input":"2022-02-05T07:38:40.587969Z","iopub.status.idle":"2022-02-05T07:38:40.599238Z","shell.execute_reply.started":"2022-02-05T07:38:40.587931Z","shell.execute_reply":"2022-02-05T07:38:40.598424Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport plotly.express as px\nimport plotly.graph_objects as go","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:38:40.904452Z","iopub.execute_input":"2022-02-05T07:38:40.905246Z","iopub.status.idle":"2022-02-05T07:38:40.908900Z","shell.execute_reply.started":"2022-02-05T07:38:40.905190Z","shell.execute_reply":"2022-02-05T07:38:40.908327Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df = pd.read_csv(\"../input/g-research-crypto-forecasting/train.csv\")\nasset_details = pd.read_csv(\"../input/g-research-crypto-forecasting/asset_details.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:38:41.143524Z","iopub.execute_input":"2022-02-05T07:38:41.144144Z","iopub.status.idle":"2022-02-05T07:39:22.483741Z","shell.execute_reply.started":"2022-02-05T07:38:41.144111Z","shell.execute_reply":"2022-02-05T07:39:22.482995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.info()","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:39:22.485201Z","iopub.execute_input":"2022-02-05T07:39:22.485477Z","iopub.status.idle":"2022-02-05T07:39:22.496300Z","shell.execute_reply.started":"2022-02-05T07:39:22.485448Z","shell.execute_reply":"2022-02-05T07:39:22.495438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.describe()","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:39:22.497644Z","iopub.execute_input":"2022-02-05T07:39:22.498049Z","iopub.status.idle":"2022-02-05T07:39:32.588786Z","shell.execute_reply.started":"2022-02-05T07:39:22.498008Z","shell.execute_reply":"2022-02-05T07:39:32.585612Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:39:32.592626Z","iopub.execute_input":"2022-02-05T07:39:32.592849Z","iopub.status.idle":"2022-02-05T07:39:32.611189Z","shell.execute_reply.started":"2022-02-05T07:39:32.592822Z","shell.execute_reply":"2022-02-05T07:39:32.610357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:39:32.612115Z","iopub.execute_input":"2022-02-05T07:39:32.612313Z","iopub.status.idle":"2022-02-05T07:39:33.080586Z","shell.execute_reply.started":"2022-02-05T07:39:32.612289Z","shell.execute_reply":"2022-02-05T07:39:33.079736Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Null Target Rows\nprint(train_df['Target'].isnull().sum())\n#percentage of Null in train_df\ntrain_df[\"Target\"].isnull().sum()*100 / train_df.shape[0]","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:39:33.081986Z","iopub.execute_input":"2022-02-05T07:39:33.082386Z","iopub.status.idle":"2022-02-05T07:39:33.184199Z","shell.execute_reply.started":"2022-02-05T07:39:33.082341Z","shell.execute_reply":"2022-02-05T07:39:33.183329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"asset_count = []\nfor i in range(14):\n    count = (train_df[\"Asset_ID\"]==i).sum()\n    asset_count.append(count)\nfig = px.bar(x = asset_details.sort_values(\"Asset_ID\")[\"Asset_Name\"],\n            y = asset_count,\n            color = asset_count,\n            color_continuous_scale =\"Emrld\")\n\nfig.update_xaxes(title=\"Assets\")\nfig.update_yaxes(title = \"Number of Rows\")\nfig.show()\n    ","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:39:33.185145Z","iopub.execute_input":"2022-02-05T07:39:33.185354Z","iopub.status.idle":"2022-02-05T07:39:34.877155Z","shell.execute_reply.started":"2022-02-05T07:39:33.185324Z","shell.execute_reply":"2022-02-05T07:39:34.876218Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def Crypto_df(asset_id, train_df=train_df):\n    df= train_df[train_df[\"Asset_ID\"] == asset_id].reset_index(drop=True)\n    df[\"timestamp\"] = pd.to_datetime(df['timestamp'], unit='s')\n    df = df.set_index(\"timestamp\")\n    return df\nbtc = Crypto_df(asset_id=1)\neth = Crypto_df(asset_id = 6)\nlth = Crypto_df(asset_id =9)\n","metadata":{"execution":{"iopub.status.busy":"2022-02-05T07:46:30.912483Z","iopub.execute_input":"2022-02-05T07:46:30.913365Z","iopub.status.idle":"2022-02-05T07:46:32.454631Z","shell.execute_reply.started":"2022-02-05T07:46:30.913321Z","shell.execute_reply":"2022-02-05T07:46:32.453827Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def candle_plot(train_df, title):\n    candle = go.Figure(data = [go.Candlestick(x =train_df.index, \n                                               open = train_df[('Open')], \n                                               high = train_df[('High')], \n                                               low = train_df[('Low')], \n                                               close = train_df[('Close')])])\n    candle.update_xaxes(title_text = 'Time',\n                        rangeslider_visible = True)\n    candle.update_yaxes(title_text = 'Price in USD',\n                        ticksuffix = '$')\n    return candle\n    ","metadata":{"execution":{"iopub.status.busy":"2022-02-05T08:19:18.482984Z","iopub.execute_input":"2022-02-05T08:19:18.483295Z","iopub.status.idle":"2022-02-05T08:19:18.489556Z","shell.execute_reply.started":"2022-02-05T08:19:18.483261Z","shell.execute_reply":"2022-02-05T08:19:18.488763Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"btc_plot = candle_plot(btc[-100:], title=\"Bitcoin(BTC)\")\nbtc_plot.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-05T08:19:19.188175Z","iopub.execute_input":"2022-02-05T08:19:19.188465Z","iopub.status.idle":"2022-02-05T08:19:19.214465Z","shell.execute_reply.started":"2022-02-05T08:19:19.188429Z","shell.execute_reply":"2022-02-05T08:19:19.213888Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ltc_plot = candle_plot(lth[-250:],title = \"Litecoin(LTC)\")\nltc_plot.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-05T08:21:07.856443Z","iopub.execute_input":"2022-02-05T08:21:07.856790Z","iopub.status.idle":"2022-02-05T08:21:07.876808Z","shell.execute_reply.started":"2022-02-05T08:21:07.856753Z","shell.execute_reply":"2022-02-05T08:21:07.876017Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"eth_plot = candle_plot(eth[-250:],title = \"Etherium(ETH)\")\neth_plot.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-05T08:22:04.998412Z","iopub.execute_input":"2022-02-05T08:22:04.998726Z","iopub.status.idle":"2022-02-05T08:22:05.022844Z","shell.execute_reply.started":"2022-02-05T08:22:04.998694Z","shell.execute_reply":"2022-02-05T08:22:05.022012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}