Posts

Showing posts from February, 2018

Monte Carlo Simulation and Risk Analysis of Bitcoin

Image
Note: This post does not represent any expert guidelines in finance or bitcoin. This article is a wrap-up of a class project regarded stock market risk analysis.  – Data Preparation from Stack Overflow: link – language: Python – Example code for Stock Market Project, Inspired by Jose Portilla’s Github Repo TL;DR The daily return chart shows that 25% of the time it's around 0%. The tail of the daily return is very long, as much as 400%. The Monte Carlo simulation shows that we will have between $5600 to $9000 range. The most interesting part is here. If we look 10% empirical quantile of the final price distribution to estimate the Value at Risk for the Bitcoin price, which looks to be $925.49 for every investment of $6837.31, which accounts for 13.5% of the investment.  This means that for every initial coin you purchase at 6837.31, $925 is at risk 90% of the time from Monte Carlo Simulation. 

Automatically download finance data via Google API

As Yahoo! Finance deprecated the API in late 2017 and Google changed their Finance URL, below is an alternative to download finance data. from pandas_datareader.google.daily import GoogleDailyReader @property def url(self): return 'http://finance.google.com/finance/historical' GoogleDailyReader.url = url # get data import pandas_datareader as pdr from datetime import datetime start = datetime(2014,1,1) end = datetime(2018,2,5) ret = pdr.get_data_google(['FB'], start, end) Reference Documentation about other alternative API for downloading finance data  here GitHub discussion about Google new Finance URL  here