My Authors
Read all threads
While @ work

Decided to take a Intro to Portfolio Risk Management in Python @DataCamp

Gonna apply the lessons to #Bitcoin price from Nov 2014 onwards /thread
@DataCamp General Bitcoin data so far:

Daily average return - 0.2406%

Implied average annualized return - 140.4271%

Standard deviation (volatility measure) - 3.9660

Graph below shows the daily return % on the x-axis plotted against the number of its occurrences on the y-axis $BTC
@DataCamp Does #Bitcoin follow a normal distribution?

For that we will need to measure the tilt of the distribution (Skewness) and the probability of outliers (Kurtosis)

Skewness - 0.2085

Kurtosis - 6.5293

This suggests that the is a greater probability of outliers & +ve returns
@DataCamp than that which we would see in a normal distribution.

Ultimately we can apply the Shapiro(
?)-Wilk test to see if the data is normally distributed or not

If p<=0.05 then $BTC does not follow a normal distribution

Computing this gives p = 4.2434e-32
@DataCamp @benshapiro In short:

#Bitcoin does not follow a normal distribution, also yielding high risk to investors/hodlers - but who didn't know that

Now we've just quantified it
@DataCamp @benshapiro For the next chapter of Portfolio Investing we're gonna look at the top 10 coins by Market Capitalization as this chapter has to include more data points than just #Bitcoin

It will also be helpful to do this 'longer' part now as it will be useful to have it moving onwards
@DataCamp @benshapiro Really don't wanna do this as I'm not sure what positive insight could come out of this

Pending for action :)
@DataCamp @benshapiro Part of me really doesn't want to do this

Other part is like: Vlad, you have six more hours in here, use it productively and don't be a lil' bitch
@DataCamp @benshapiro Well, that's a start

Most of these have different dates on which the data is presented

Need to sort it by time first, I think I'll go from 1st Jan 2018 to 31st Dec 2018
@DataCamp @benshapiro Data cleaned ✅

In the end managed to get matching data for about 3/4 a year ranging from

09/11/2017 to 11/06/2018
@DataCamp @benshapiro Alright, finally can apply lesson 2: Portfolio Investing

Provided that it was pretty hard to find OHLC data without using an API, I've managed to gather data from #BTC #ETH #LTC #XRP #NEO #OMG #DOGE #EOS #XVG #ZEC #DASH #ETC & #XMR
@DataCamp @benshapiro Assuming an equal weighted portfolio distribution throughout the 13 of these #crypto assets

Gives a portfolio performance of 14.7% at the end of the sample after being up 234.0% on the 13-01-18 and starting underwater around -21.7% in Nov. 2017
@DataCamp @benshapiro The one that I was too lazy to do before : the correlation matrix

Arguably the most interesting graph shared in this thread

Strong correlation on OMG & ETH, DASH & XMR as well as LTC & ETH

No negative or 0 correlation to be seen: if you invest in #crypto we all sink or rise
@DataCamp @benshapiro The scary number comes when considering Portfolio standard deviation aka Portfolio volatility

Using the formula below and taking into account the 213 days of the dataset, the portfolio volatility is a monster 97.55% assuming an equally distributed portfolio
@DataCamp @benshapiro Lesson 3 (Factor Investing) is just way too theoretical & the the reason why there are so many people in Economics

Utter bs with little practical application and people still making a living off it smh

So we're going straight to Lesson 4 looking at $BTC Value at Risk :)
@DataCamp @benshapiro Alrighttt, this is looking good!

We're gonna start by looking at #Bitcoin Historical drawdown from Nov 2014

First we need to have the cumulative returns of the asset which closely resembles the price chart
@DataCamp @benshapiro To double check that our values are correct, let's look at max cum_return fixed decimal @ 49.993

Now we need to find our max & min $BTC price in the data

I've used both the min cumulative return and min value on the Low price column to find that min price is 152.4$
@DataCamp @benshapiro The previous thought was flowed: I was computing the max return between total max & min of data

I should rather find the value between the beginning of the dataset to the max of the data and find its return
@DataCamp @benshapiro Now it looks much better with a new graph

Max cum_return - 50.9933

Starting price - 376.42$ (Close on 29-11-2014)

Max price - 19187$ (Close on 16-12-2017)

Using these number we get 50.9723 which is not == but I'm happy that our cum_sum function is correct
@DataCamp @benshapiro Looking at Historical Drawdown, the maximum decrease in your portfolio have you had only invested in #Bitcoin would be


Still better off than 'investing' most altcoins tbh
@DataCamp @benshapiro Historical Value at Risk - presents the minimum loss that your portfolio or asset has sustained in the worst 5% of cases.

-6.31% (red line)

Historical Expected Shortfall - the expected loss of the worst case scenarios of returns, in this case, 5%

-9.40% (blue line)
@DataCamp @benshapiro Of course we can find these values for different quantiles as presented in the figure below
@DataCamp @benshapiro Given that there is an infinite amount of possibilities of what price can actually do, we can assume a probability distribution and to extract values from its quantiles and compute again their respective mean, standard deviation and so on -> again, not that practical
@DataCamp @benshapiro And last but not least, we've arrived at Monte Carlo simulations!

Here are my first 4 random walks, depicting 100 runs for each random walk.

This one is for you moon boys :)

What I did not do here is to aggregate the data to actually look at min and max Bitcoin price in these
@DataCamp @benshapiro Running it 10000 times, this chart gives us one $BTC could theoretically be worth 2 million on this day, taking into account it's past price action

More precisely:

Mean - 33776$

Max - 2.068e+07$

Min - 10.77$

This is just for 10000 samples, it could be millions/billions
@DataCamp @benshapiro Running it one more time, we can see that most of the runs end up in the first 500000 (for this one)

Analysing until 500000$ we see that we can zoom in further

This run has a mean of 14000$ which matches closer to our reality #Bitcoin
@DataCamp @benshapiro Well, that was all for now

This thread is mostly for documentation purposes as some of the skillset learned/improved in this course will certainly be helpful in the future

Thank you @DataCamp :)
Missing some Tweet in this thread? You can try to force a refresh.

Enjoying this thread?

Keep Current with Be_Independent_Tribe

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!