Giter Site home page Giter Site logo

vikrambansall / cryptocurrency-portfolio-optimization Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 15 KB

Utilized hierarchical clustering to identify the most similar cryptocurrency clusters and determine which currencies had the most significant impact on each other. Constructed a portfolio based on these findings.

R 100.00%
crypto cyptocurrency hierarchical-clustering patterns python unsupervised-learning dendogram r rprogramming

cryptocurrency-portfolio-optimization's Introduction

The R code examines cryptocurrency information by looking at past prices, grouping cryptocurrencies based on how their values change over time, building investment portfolios from these groups, and showing how well these portfolios perform. This analysis involves exploring the data visually, organizing cryptocurrencies into clusters using a specific method, and then comparing the returns of different portfolios. The goal is to gain insights into how cryptocurrencies behave and perform in the market. Loading Libraries:

The code begins by loading several R libraries, including data manipulation (tidyverse), cryptocurrency data retrieval (crypto2), date-time handling (lubridate), web scraping (rvest), statistical functions (stats), financial data analysis (quantmod, tidyquant, PortfolioAnalytics), and hierarchical clustering (dendextend). Getting Cryptocurrency List:

1.It retrieves a list of cryptocurrencies using the crypto_list() function. Fetching Historical Data for a Single Cryptocurrency:

2.The code fetches historical data for a single cryptocurrency using the crypto_history() function. Visualizing Historical Data:

3.It uses ggplot to visualize the historical data of the single cryptocurrency by plotting a line chart of closing prices over time. Selecting Top 100 Cryptocurrencies:

4.It selects the top 100 cryptocurrencies based on market capitalization. Calculating Daily Returns for Each Cryptocurrency:

5.It calculates daily returns for each cryptocurrency based on their closing prices. Hierarchical Clustering for Cryptocurrency Returns:

6.It performs hierarchical clustering on the daily returns of the top 100 cryptocurrencies. Visualizing Dendrogram:

7.It visualizes the resulting dendrogram from hierarchical clustering. Assigning Clusters to Cryptocurrencies:

8.It assigns clusters to cryptocurrencies based on the hierarchical clustering results. Retrieving Historical Prices for Selected Cluster:

9.It retrieves historical prices for the cryptocurrencies in a specific cluster. Visualizing and Comparing Cumulative Returns:

10,It visualizes and compares cumulative returns of the cryptocurrency portfolio using ggplot. Hierarchical Clustering of Cryptocurrencies Based on Returns:

11.It performs hierarchical clustering again, this time using the daily returns of the top 100 cryptocurrencies. Visualizing the Second Dendrogram:

12.It visualizes the resulting dendrogram from the second hierarchical clustering. Determining Clusters and Visualizing:

13.It determines clusters and visualizes them in a dendrogram. Cutting the Tree and Extracting a Specific Cluster:

14.It cuts the hierarchical tree to obtain clusters and extracts a specific cluster. Selecting Cryptos for Portfolios:

15.It selects cryptocurrencies for two different portfolios. Converting Data for Portfolio Returns Calculation:

16.It converts data to xts format for portfolio returns calculation using Return.portfolio. Visualizing and Comparing Cumulative Returns of Portfolios:

It visualizes and compares cumulative returns of two portfolios using ggplot.

cryptocurrency-portfolio-optimization's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.