{"metadata":{"kernelspec":{"name":"ir","display_name":"R","language":"R"},"language_info":{"name":"R","codemirror_mode":"r","pygments_lexer":"r","mimetype":"text/x-r-source","file_extension":".r","version":"4.0.5"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Introduction\nNo matter you accept or not, our world has been greatly impacted by this new technology. 10 percent of global GDP will be stored on blockchain by 2027, this is quoted from World Economic Forum hold in 2015.<br><br>\nWhat does this 10% mean?<br>\n##### $80,934,771,028,340\nAbove is global nominal GDP in 2017, if we take this figure as example, then we have about 8 trillion USD that will be stored in the form of crypto asset.<br>\nNow please keep this figure in your mind, scroll down and play with below interactive chart to feel more about this figure<br>\nYes, not try to understand it, feel it.","metadata":{"_uuid":"051d70d956493feee0c6d64651c6a088724dca2a","_execution_state":"idle"}},{"cell_type":"markdown","source":"# GDP and Crypto asset\nBelow is 2017 GDP by country, you can type in 10% of 80 trillion to see how big this figure is.","metadata":{}},{"cell_type":"markdown","source":"<iframe id=\"example1\" src=\"https://medicihouse.shinyapps.io/crypto_history/\"\nstyle=\"border: non; width: 100%; height: 1000px\"\nframeborder=\"0\">\n</iframe>","metadata":{}},{"cell_type":"markdown","source":"If you input 8,000,000,000,000 in the chart, you would find this figure is bigger than 188 countries of GDP in 2017. Only two countries is bigger than this figure in 2017.<br>\nAstronomical figure indeed.","metadata":{}},{"cell_type":"markdown","source":"# Crypto asset development trend\nHere let us look at what is the development trend this dataset shows, because Bitcoin is the most successful application on the decentralized world, so let's take a look at it first.","metadata":{}},{"cell_type":"code","source":"library(dplyr)\nlibrary(ggplot2)\n\ntrend <- read.csv('/kaggle/input/g-research-crypto-forecasting/train.csv', nrows=900000)\ntrend_bit <- filter(trend,Asset_ID==1)","metadata":{"execution":{"iopub.status.busy":"2022-01-11T14:15:41.351815Z","iopub.execute_input":"2022-01-11T14:15:41.353709Z","iopub.status.idle":"2022-01-11T14:15:59.644956Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Date <- as.Date(as.POSIXct(trend_bit$timestamp, origin=\"1970-01-01 00:00:00.000\"))\ntrend_bit <- data.frame(Date, trend_bit)\nplot <- ggplot(trend_bit,aes(x=Date,y=Close))\nplot + geom_line() + theme_classic()","metadata":{"execution":{"iopub.status.busy":"2022-01-11T14:15:59.647473Z","iopub.execute_input":"2022-01-11T14:15:59.648909Z","iopub.status.idle":"2022-01-11T14:16:02.401961Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# How the money is distributed in the Cryptocurrency world\nAfter looking at the development trend of the Bitcoin, let's take a look at in cryptocurrency world, how is money is distributed.<br>\nIn order to express that, I need to get the latest timestamp for each of the currency and then calculate its market value, which is Volume * Close price.<br>\nI will seperate the whole process to below steps\n1. Map the asset name to the table\n2. Select only Asset Name and timestamp column, then calculate the maximum timestamp and group them by Asset Name\n3. Use the dataset calculated in step 2, inner join with the original dataset, then for each currency there would be only one row\n4. Calculate the market value\n5. Visulization","metadata":{}},{"cell_type":"code","source":"# Step1,\nasset_name <- read.csv('/kaggle/input/g-research-crypto-forecasting/asset_details.csv')\ncapital_name <- merge(trend, asset_name, by=c(\"Asset_ID\")) \nhead(capital_name)","metadata":{"execution":{"iopub.status.busy":"2022-01-11T14:16:02.404639Z","iopub.execute_input":"2022-01-11T14:16:02.406225Z","iopub.status.idle":"2022-01-11T14:16:04.973582Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Step2,\nasset_selected_filter1 <- select(capital_name,timestamp,Asset_Name)\nasset_selected_filter2 <- asset_selected_filter1 %>% group_by(Asset_Name) %>% summarise(timestamp = max(timestamp))\nhead(asset_selected_filter2)","metadata":{"execution":{"iopub.status.busy":"2022-01-11T14:16:04.975982Z","iopub.execute_input":"2022-01-11T14:16:04.977341Z","iopub.status.idle":"2022-01-11T14:16:05.357082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Step3,\ncapital_inner <- inner_join(capital_name,asset_selected_filter2,by=c(\"timestamp\",\"Asset_Name\"))\nhead(capital_inner)","metadata":{"execution":{"iopub.status.busy":"2022-01-11T14:16:05.360058Z","iopub.execute_input":"2022-01-11T14:16:05.361572Z","iopub.status.idle":"2022-01-11T14:16:05.461657Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Stemp4,\ncapital_inner$Value <- capital_inner$Volume * capital_inner$Close\nhead(capital_inner)","metadata":{"execution":{"iopub.status.busy":"2022-01-11T14:16:05.465064Z","iopub.execute_input":"2022-01-11T14:16:05.466588Z","iopub.status.idle":"2022-01-11T14:16:05.497474Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Word cloud chart visualization & Crypto currency market value","metadata":{}},{"cell_type":"code","source":"# Stemp5,\nlibrary(wordcloud)\nlibrary(wordcloud2)\nlibrary(RColorBrewer)\n\nwordcloud(words = capital_inner$Asset_Name,freq = capital_inner$Value, min.freq = 1,max.words=200,random.order=FALSE, rot.per=0.35,colors=brewer.pal(8, \"Dark2\"))","metadata":{"execution":{"iopub.status.busy":"2022-01-11T14:16:05.501337Z","iopub.execute_input":"2022-01-11T14:16:05.502970Z","iopub.status.idle":"2022-01-11T14:16:05.625351Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Yes","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}}]}