python中基于投资组合优化方法的金融库

2024-10-02 20:32:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在寻找python中的一个金融库,它提供一个类似于MATLAB的portalloc 的方法。它用于优化投资组合。


Tags: 方法金融matlabportalloc
3条回答

如果你知道线性代数,有一个简单的函数来解决优化问题,任何库都应该支持它。不幸的是,我已经很久没有研究过它了,我不能告诉你公式和支持它的库,但是稍微研究一下就会发现它。重点是任何线性代数库都应该这样做。在

更新:

这是我发现的一篇文章的引述。在

Some research says that "mean variance portfolio optimization" can give good results. I discussed this in a message

To implement this approach, a needed input is the covariance matrix of returns, which requires historical stock prices, which one can obtain using "Python quote grabber" http://www.openvest.org/Databases/ovpyq .

For expected returns -- hmmm. One of the papers I cited found that assuming equal expected returns of all stocks can give reasonable results.

Then one needs a "quadratic programming" solver, which appears to be handled by the CVXOPT Python package.

If someone implements the approach in Python, I'd be happy to hear about it.

There is a "backtest" package in R (open source stats package callable from Python) http://cran.r-project.org/web/packages/backtest/index.html "for exploring portfolio-based hypotheses about financial instruments (stocks, bonds, swaps, options, et cetera)."

如果你知道如何定义你的目标函数。{a1}你几乎可以用优化来解决任何问题。在

也许你可以用这个library(statlib)或者这个one(神秘主义者)来帮助你。在

相关问题 更多 >