项目作者: hy2632

项目描述 :
The analytical solution of efficient frontier.
高级语言: Jupyter Notebook
项目地址: git://github.com/hy2632/Efficient-Frontier.git
创建时间: 2021-01-28T11:19:26Z
项目社区:https://github.com/hy2632/Efficient-Frontier

开源协议:Apache License 2.0

下载


Efficient-Frontier

References

Brief

Analysis on the modern portfolio theory.

  • Efficient frontier with / without risk free asset
  • Optimal sharpe ratio / portfolio

Example of usage

  1. instance = EfficientFrontier(
  2. symbols=["AAPL", "XOM", "PFE", "F", "WMT", "BA", "TSLA", "AMD"],
  3. start_date="20200101",
  4. end_date="20210130",
  5. simulation_times=5000,
  6. solve_granularity=1000,
  7. analytical_solution=True,
  8. use_optimizer=True,
  9. tangency_line=True,
  10. )
  11. instance.plot((12,8))

Content

  • Monte Carlo simulation of portfolios consisting of assets in the designated pool.
  • Solve for the curve of the efficient frontier without risk-free asset analytically (a constrained optimization problem) using lagrange multiplier. This solution did not take into consideration the constraint that all weights are greater than 0, a.k.a. it allows short and leverage.
  • (2021/1/30 Update) optimizerSolver() to solve for the efficient frontier using scipy optimizer. Added the constraint of no short. Due to the limit of the optimizer, this solution performs bad for low mu part.

  • (2021/2/1 Update) tangencySolver() which solves for the “with risk-free asset” case. The solution can be proved to be the tangency line of the efficient frontier curve in the “no risk-free asset” setting.

  • Plotting the figure of all above.

2021/2/1: Frontier with risk-free asset —— the tangency line

See http://yaohuacn.com/2021/02/02/Modern-Portfolio-Theory-Mean-variance-analysis-Efficient-Frontier/