All Projects → dppalomar → sparseIndexTracking

dppalomar / sparseIndexTracking

Licence: GPL-3.0 License
Design of Portfolio of Stocks to Track an Index

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to sparseIndexTracking

Mega-index-heroku
Mega nz heroku index, Serves mega.nz to http via heroku web. It Alters downloading speed and stability
Stars: ✭ 165 (+511.11%)
Mutual labels:  index
ember-deep-tracked
Deep auto-tracking for when you just don't care, and want things to work (at the cost of performance in some situtations)
Stars: ✭ 20 (-25.93%)
Mutual labels:  tracking
portfolio
🏠 My portfolio
Stars: ✭ 19 (-29.63%)
Mutual labels:  portfolio
codebadges
Code badges to display your progress on FreeCodeCamp, CodeSchool, Codecademy, CodeWars, GitHub etc.
Stars: ✭ 24 (-11.11%)
Mutual labels:  portfolio
mariusz.cc
Personal website, powered by Middleman
Stars: ✭ 40 (+48.15%)
Mutual labels:  portfolio
stringify.me
Quick and Easy Profiles (No Login Required)
Stars: ✭ 52 (+92.59%)
Mutual labels:  portfolio
gsurma.github.io
Greg's Portfolio 🌎.
Stars: ✭ 24 (-11.11%)
Mutual labels:  portfolio
norman-portfolio
Norman Nuthu's Portfolio
Stars: ✭ 16 (-40.74%)
Mutual labels:  portfolio
portfolio
A virtual investing portfolio app (aka Kytra)
Stars: ✭ 32 (+18.52%)
Mutual labels:  portfolio
startbootstrap-stylish-portfolio-jekyll
Jekyll theme based on Stylish Portfolio Bootstrap theme
Stars: ✭ 20 (-25.93%)
Mutual labels:  portfolio
hotpotato
Hotpotato is a space for chefs to display their creations. Follow your favorite chef. Like your favorite recipes. And find the latest gluten-free, vegetarian, and multi-culinary recipes.
Stars: ✭ 13 (-51.85%)
Mutual labels:  portfolio
alternative-front-ends
Overview of alternative open source front-ends for popular internet platforms (e.g. YouTube, Twitter, etc.)
Stars: ✭ 1,664 (+6062.96%)
Mutual labels:  tracking
openNPL
openNPL is an open source platform for the management of non-performing loans
Stars: ✭ 16 (-40.74%)
Mutual labels:  portfolio
cerbero
Track your users interactions
Stars: ✭ 56 (+107.41%)
Mutual labels:  tracking
website
🧬 Source code of my personal website. Everything is included. Written in NuxtJS, TypeScript and Windi CSS!
Stars: ✭ 135 (+400%)
Mutual labels:  portfolio
SiamFC-tf
A TensorFlow implementation of the SiamFC tracker, use with your own camera and video, or integrate to your own project 实时物体追踪,封装API,可整合到自己的项目中
Stars: ✭ 22 (-18.52%)
Mutual labels:  tracking
Developers-Portfolio
💼 This is a Social App for Developers to interact with other users through messages and sharing projects.
Stars: ✭ 101 (+274.07%)
Mutual labels:  portfolio
face-detectify
😅 Detect faces in images. Without native modules. It uses tracking.js.
Stars: ✭ 20 (-25.93%)
Mutual labels:  tracking
GithubFolio
Creator of simple portfolios through your github pages
Stars: ✭ 41 (+51.85%)
Mutual labels:  portfolio
hexo-generator-index2
Filtered index generator for Hexo
Stars: ✭ 40 (+48.15%)
Mutual labels:  index

sparseIndexTracking

CRAN_Status_Badge CRAN Downloads CRAN Downloads Total

Computation of sparse portfolios for financial index tracking, i.e., joint selection of a subset of the assets that compose the index and computation of their relative weights (capital allocation). The level of sparsity of the portfolios, i.e., the number of selected assets, is controlled through a regularization parameter. Different tracking measures are available, namely, the empirical tracking error (ETE), downside risk (DR), Huber empirical tracking error (HETE), and Huber downside risk (HDR). See vignette for a detailed documentation and comparison, with several illustrative examples.

The package is based on the paper:

K. Benidis, Y. Feng, and D. P. Palomar, “Sparse Portfolios for High-Dimensional Financial Index Tracking,” IEEE Trans. on Signal Processing, vol. 66, no. 1, pp. 155-170, Jan. 2018. (https://doi.org/10.1109/TSP.2017.2762286)

The latest stable version of sparseIndexTracking is available at https://CRAN.R-project.org/package=sparseIndexTracking.

The latest development version of sparseIndexTracking is available at https://github.com/dppalomar/sparseIndexTracking.

Installation

To install the latest stable version of sparseIndexTracking from CRAN, run the following commands in R:

install.packages("sparseIndexTracking")

To install the development version of sparseIndexTracking from GitHub, run the following commands in R:

install.packages("devtools")
devtools::install_github("dppalomar/sparseIndexTracking")

To get help:

library(sparseIndexTracking)
help(package = "sparseIndexTracking")
package?sparseIndexTracking
?spIndexTrack

Please cite sparseIndexTracking in publications:

citation("sparseIndexTracking")

Documentation

For more detailed information, please check the vignette: CRAN vignette and GitHub vignette.

Usage of spIndexTrack()

We start by loading the package and real data of the index S&P 500 and its underlying assets:

library(sparseIndexTracking)
library(xts)
data(INDEX_2010)

The data INDEX_2010 contains a list with two xts objects:

  1. X: A T × N xts with the daily linear returns of the N assets that were in the index during the year 2010 (total T trading days)
  2. SP500: A T × 1 xts with the daily linear returns of the index S&P 500 during the same period.

Note that we use xts objects just for illustration purposes. The function spIndexTracking() can also be invoked passing simple data arrays or dataframes.

Based on the above quantities we create a training window, which we will use to create our portfolios, and a testing window, which will be used to assess the performance of the designed portfolios. For simplicity, here we consider the first six (trading) months of the dataset (~126 days) as the training window, and the subsequent six months as the testing window:

X_train <- INDEX_2010$X[1:126]
X_test <- INDEX_2010$X[127:252]
r_train <- INDEX_2010$SP500[1:126]
r_test <- INDEX_2010$SP500[127:252]

Now, we use the four modes (four available tracking errors) of the spIndexTracking() algorithm to design our portfolios:

# ETE
w_ete <- spIndexTrack(X_train, r_train, lambda = 1e-7, u = 0.5, measure = 'ete')
cat('Number of assets used:', sum(w_ete > 1e-6))
#> Number of assets used: 45

# DR
w_dr <- spIndexTrack(X_train, r_train, lambda = 2e-8, u = 0.5, measure = 'dr')
cat('Number of assets used:', sum(w_dr > 1e-6))
#> Number of assets used: 42

# HETE
w_hete <- spIndexTrack(X_train, r_train, lambda = 8e-8, u = 0.5, measure = 'hete', hub = 0.05)
cat('Number of assets used:', sum(w_hete > 1e-6))
#> Number of assets used: 44

# HDR
w_hdr <- spIndexTrack(X_train, r_train, lambda = 2e-8, u = 0.5, measure = 'hdr', hub = 0.05)
cat('Number of assets used:', sum(w_hdr > 1e-6))
#> Number of assets used: 43

Finally, we plot the actual value of the index in the testing window in comparison with the values of the designed portfolios:

plot(cbind("PortfolioETE" = cumprod(1 + X_test %*% w_ete), cumprod(1 + r_test)), 
     legend.loc = "topleft", main = "Cumulative P&L")

plot(cbind("PortfolioDR" = cumprod(1 + X_test %*% w_dr), cumprod(1 + r_test)),
     legend.loc = "topleft", main = "Cumulative P&L")

plot(cbind("PortfolioHETE" = cumprod(1 + X_test %*% w_hete), cumprod(1 + r_test)),
     legend.loc = "topleft", main = "Cumulative P&L")

plot(cbind("PortfolioHDR" = cumprod(1 + X_test %*% w_hdr), cumprod(1 + r_test)),
     legend.loc = "topleft", main = "Cumulative P&L")

Links

Package: CRAN and GitHub.

README file: CRAN-readme and GitHub-readme.

Vignette: CRAN-html-vignette, CRAN-pdf-vignette, GitHub-html-vignette, and GitHub-pdf-vignette.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].