Optimizing Crypto Investments - Implementation using Python

in #programming8 years ago

In this post, I will go into the details of a portfolio optimization that yielded 406% returns over a 180 days period, on paper, with a Sharpe ratio of 4.69. The first post in this series introduces you to the conceptual underpinnings and the context of what I am tried to demonstrate here.

Data Acquisition is the obvious first step - I’ve used Coincap.io API for data acquisition purposes. (I have tried CoinMarketCap and CryptoCompare previously, but I find Coincap’s API to be better for acquiring historical data.)

I’m focussed on cryptos with large market cap — greater than USD 5 Billion. In the second data acquisition step, I extract historical data (180 days) from another Coincap API, and hold the data in a master dataframe.

Once I have the historical data for the selected coins in a dataframe, the data needs to be cleaned & transformed. Returns and covariance are then calculated.

After the returns & covariance are calculated, I implement the core of MPT to optimize the portfolio.

Visualization of Efficient frontier :

The goal of this portfolio optimization technique was to find the portfolio that maximizes return and minimizes volatility, which is measured as Sharpe ratio. The weights of the coins, with highest sharpe ratio is below:

In summary, allocating investments in a manner below is the most optimized portfolio — 406% returns

Assumptions of MPT

• Asset returns are normally distributed random variables.
• Investors attempt to maximize economic market returns.
• Investors are rational and avoid risk when possible.
• Investors all have access to the same sources of information for investment decisions.
• Investors share similar views on expected returns.
• Taxes and brokerage commissions are not considered.
• Investors are not large enough players in the market to influence the price.
• Investors have unlimited access to borrow (and lend) money at the risk-free rate.

Crypto markets are extremely volatile. Please do your own research & invest at your own risk. All the views expressed in this post are my own and do not represent my current or past employers. The post should not be construed as financial advice.

Jupyter Notebook with Python Implementation

Sort:  

Congratulations @omkardash! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @omkardash! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.077
BTC 65395.07
ETH 1715.38
USDT 1.00
SBD 0.41