Portfolio와 관련한 Python과 Javascript 프로젝트

1.
몇 년전 로보어드바이저시대, 알고리즘을 소개하는 분들에서 소개하였던 해외서비스가 Quantocracy입니다. 투자전략을 다루는 블로그 글을 모아서 소개하는 곳입니다. 지금도 운용중입니다. 이와 유사하지만 발상을 달리한 서비스가 나왔습니다. Academic Quant News 인데 블로그 글이 아닌 논문을 소개합니다. 사이트에 아래와 같은 표현을 올릴 정도로 Quantocracy의 영향을 받았습니다.

Credit where credit’s due: this site was partly inspired by Quantocracy (known as The Whole Street a long time ago…).

트위터에서 이와 비슷한 역할을 하는 분이 Carl Carrie입니다. 전략과 기술의 홍수입니다. 투자자로 생명을 유지하려면 더 많은 공부를 해야 하는 시대입니다.

먼저 소개할 오픈소스 프로젝트는 Eiten – Algorithmic Investing Strategies for Everyone입니다. R이나 Python으로 만들어진 알고리즘트레이딩 플랫폼이 많습니다. Eiten도 비슷한 목표를 하지만 Portfolio 전략에 중점을 두고 있는 점이 다릅니다. Eiten이 현재 제공하는 전략입니다.

Portfolio Strategies;

Four different portfolio strategies are currently supported by the toolkit.

  1. Eigen Portfolios
    1. These portfolios are orthogonal and uncorrelated to the market in general thus yielding high reward and alpha. However, since they are uncorrelated to the market, they can also provide great risk. The first eigen portfolio is considered to be a market portfolio which is often ignored. The second one is uncorrelated to the others and provides the highest risk and reward. As we go down the numbering, the risk as well as the reward are reduced.
  2. Minimum Variance Portfolio (MVP)
    1. MVP tries to minimize the variance of the portfolio. These portfolios are lowest risk and reward.
  3. Maximum Sharpe Ratio Portfolio (MSR)
    1. MSR solves an optimization problem that tries to maximize the sharpe ratio of the portfolio. It uses past returns during the optimization process which means if past returns are not the same as future returns, the results can vary in future.
  4. Genetic Algorithm (GA) based Portfolio
    1. This is our own implementation of a GA based portfolio that again tries to maximize the sharpe ratio but in a slightly more robust way. This usually provides more robust portfolios than the others.

2.
다음은 Javascript로 개발하는 포트폴리오 프로젝트입니다.

Portfolio Analytics Javascrip Library
Portfolio Allocation Javascrip Library

프랑스 퀀트입니다.  Javascript를 개발언어로 선택한 이유는 Goole Sheet에서 사용하기 위함입니다. 그래서 제공하는 기능중 첫번째가 ‘구글쉬트에서 사용가능’입니다.  물론 다양한 운용환경이 가능합니다. node.js로 Backend Application을 개발할 수도 있습니다.  개인투자자들의 보유종목을 분석하는 웹앱서비스에 활용할 수도 있습니다.

  • Compatible with Google Sheets
  • Compatible with any browser supporting ECMAScript 5 (i.e., front-end development)
  • Compatible with Node.js (i.e., back-end development)
  • (Performances) Automatically uses JavaScript Typed Arrays
  • (Accuracy) Internally uses accurate numerical algorithms (e.g., corrected two pass algorithms for mean, variance, skewness and kurtosis, accurate algorithm for error function…)
  • Code continuously tested and integrated by Travis CI
  • Code heavily documented using JSDoc
  • Portfolio Allocation Javascrip Library이 구현한 최적화알고리즘들입니다. 참고하세요.

  • Equal weights (EW)
    Analyzed by Victor DeMiguel and al. in their research paper Optimal Versus Naive Diversification: How Inefficient is the 1/N Portfolio Strategy?.
  • Inverse volatility (IV)
    Described by Raul Leote de Carvalho and al. in the research paper Demystifying Equity Risk-Based Strategies: A Simple Alpha Plus Beta Description.
  • Equal risk contributions (ERC) and risk budgeting (RB)
    Extensively studied by Thierry Roncalli and al in misc. research papers (The properties of equally weighted risk contribution portfolios, Managing Risk Exposures Using the Risk Budgeting Approach, Constrained Risk Budgeting Portfolios…).
  • Equal risk bounding (ERB)
    Described in the research paper Equal Risk Bounding is better than Risk Parity for portfolio selection by Francesco Cesarone and Fabio Tardella, the ERB portfolio is an ERC portfolio possibly not containing all the assets in the considered universe.
  • Cluster risk parity (CRP)
    Discovered by David Varadi and Michael Kapler, the CRP portfolio combines the usage of a clustering algorithm (for instance, the Fast Threshold Clustering Algorithm – FTCA – of David Varadi) with the ERC portfolio.
  • Most diversified portfolio (MDP)
    Introduced in the research paper Toward Maximum Diversification by Yves Choueifaty and al., it maximizes what the authors call the diversification ratio, which is the weighted average of the assets volatilities divided by the portfolio total volatility.
  • Minimum correlation algorithm (MCA)
    Discovered by David Varadi, the MCA portfolio is meant to be an approximation of the MDP portfolio.
  • Mean-variance optimization (MVO)
    Based on the modern portfolio theory described by Harry M. Markowitz in numerous articles and books (Portfolio Selection: Efficient Diversification of Investments…), the portfolio obtained through mean-variance optimization is mean-variance efficient, that is, for a given level of return, it possesses the lowest attainable volatility and for a given level of volatility, it possesses the highest attainable return.
  • Global minimum variance (GMV)
    The leftmost portfolio on the mean-variance efficient frontier, the GMV portfolio possesses the smallest attainable volatility among all the mean-variance efficient portfolios.
  • Proportional minimum variance algorithm (MVA)
    Discovered by David Varadi, the MVA portfolio is meant to be an approximation of the GMV portfolio.
  • Minimax portfolio
    Introduced by Martin Young in the research paper A Minimax Portfolio Selection Rule with Linear Programming Solution, the minimax portfolio uses the minimum return as a measure of risk instead of the variance as in the Markowitz framework.
  • Random portfolio
    Random portfolios are generally used to benchmark the performances of portfolio allocation and optimization algorithms, as pioneered by Ronald J. Surz in the article Portfolio Opportunity Distributions and latter complemented by Patrick Burns in the article Random Portfolios for Performance Measurement.
  • Maximum Sharpe ratio (MSR), a.k.a. (Lintner) tangency portfolio
    Introduced by John Lintner in the research paper The Valuation of Risk Assets and the Selection of Risky Investments in Stock Portfolios and Capital Budgets, the MSR portfolio possesses the highest Sharpe ratio among all the mean-variance efficient portfolios.
  • Random subspace mean-variance optimization (RSO-MVO)
    Discovered by David Varadi and formally studied by Benjamin J. Gillen in the research paper Subset Optimization for Asset Allocation, the RSO-MVO portfolio combines the usage of a random subspace optimization method with a mean-variance optimization method.
  • Minimum tracking error portfolio, a.k.a. index tracking portfolio
    The index tracking portfolio aims at replicating the performances of a given stock market index, or more generally of a given benchmark, with a limited number of its constituents.
  • Best constantly rebalanced portfolio (BCRP)
    The BCRP portfolio is a portfolio determined in hindsight to benchmark the performances of online portfolio selection algorithms.
  • 이 외에도 아래도 가능합니다.

  • Post-processing of numerical portfolio weights
    The weights obtained through a portfolio optimization algorithm (e.g. w = 0.123456789) need in practice to be either rounded off (e.g. w = 0.12) or converted into an integer number of shares (e.g. q = 10 shares, or q = 2 lots of 100 shares).
  • Computation of the mean-variance efficient frontier
    The continuous set of all mean-variance efficient portfolios (the mean-variance efficient frontier) as well as its generating discrete set (the set of corner portfolios) can both be efficiently computed thanks to a specialized algorithm developed by Harry M. Markowitz: the critical line method.
  • Computation of the nearest portfolio on the mean-variance efficient frontier
    Thanks to the Markowitz’s critical line method, it is possible to compute the nearest mean-variance efficient portfolio of any given portfolio.
  • Generation of perturbed mean vectors
    As demonstrated in The effect of errors in means, variances, and covariances on optimal portfolio choice, the impact of estimation errors in expected returns on the output of a portfolio optimization algorithm can be significant, so that it is useful to have an algorithm to perturb mean vectors for portfolio weights sensitivity analysis.
  • Generic random subspace optimization
    A direct extension of the RSO-MVO method, allowing to use the random subspace optimization method with any portfolio optimization method.
  • Generic numerical optimization
    When no specialized algorithm exist to solve a particular portfolio optimization problem, it is always possible to use a generic numerical optimization algorithm (e.g., grid search on the simplex).
  • Random generation of mean vectors, variances and correlation matrices
    When implementing portfolio optimization algorithms, the capability to generate random mean vectors, random variances and random correlation matrices can be of great help.
  • Computation of shrinkage estimators for mean vectors and covariance matrices
    Shrinkage estimators for mean vectors can help to reduce the estimation errors in expected returns as observed in DeMiguel et al. Size Matters: Optimal Calibration of Shrinkage Estimators for Portfolio Selection, and shrinkage estimators for covariance matrices like Ledoit-Wolf’s A Well-Conditioned Estimator for Large-Dimensional Covariance Matrices provide an elegant solution to the problem of the ill-conditioning and non-invertibility of sample covariance matrices.
  • Leave a Comment

    이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

    이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.