portfolio-optimization | python application | Portfolio library
kandi X-RAY | portfolio-optimization Summary
kandi X-RAY | portfolio-optimization Summary
A simple python project where we use price data from the NASDAQ website to help optimize our portfolio of stocks using modern portfolio theory.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Builds a pandas dataframe
- Grab historical prices
- Builds the API URL
- Negative negative Sharpe ratio
- Calculate Sharpe Ratio Ratio
- Calculate Sharpe Ratio
portfolio-optimization Key Features
portfolio-optimization Examples and Code Snippets
Community Discussions
Trending Discussions on portfolio-optimization
QUESTION
I have the script below which pulls in historical stock prices just fine, but I can't seem to get a list of tickers, by date, with adjusted prices. I'm getting 25 stocks, and headers that look like this: $df.tickers, price.open, price.high, price.low, price.close, volume price.adjusted
One thing that I can't figure out is that when I type 'out' I get the data set, but when I type dim(out) I get a null. That's doesn't make any sense. Anyway, I'm trying to run the code from the link below.
http://programmingforfinance.com/2017/10/portfolio-optimization-with-r/
Here is the code that I'm working with.
...ANSWER
Answered 2018-Jun-05 at 03:33The tutorial is using data in the 'xts' time series format. To convert your data as such,
QUESTION
Scenario: I am trying to use the np.polyfit function in Python, to plot my MV-efficient frontier (portfolio optimization). I already have a np array with returns and standard deviations for all my portfolios.
Issue: I am using the following lines to try to achieve the result:
...ANSWER
Answered 2017-Sep-24 at 19:29This line:
QUESTION
I am performing portfolio optimization, and I would like to extend the discussion here with the following:
I have a vector of weights w_bench
that is used as a benchmark. I would like to optimize a portfolio weight vector w_pf
that satisfies
ANSWER
Answered 2017-Jun-30 at 14:19As you note, the tricky constraint is that sum(pmin(w_bench, w_pf)) > 0.7
(actually, it turns out to be very tough to have strict inequality, so I will be doing >=
instead of >
; you could of course re-solve with >= 0.7+epsilon
for some small epsilon). To approach this, we will create a new variable y_i
for each element i
in our portfolio, and we will add constraints y_i <= wpf_i
(aka wpf_i - y_i >= 0
) and y_i <= wbench_i
(aka -y_i >= -wbench_i
), where wpf_i
is the proportion of i
in our selected portfolio (a decision variable) and wbench_i
is the proportion of i
in the benchmark portfolio (input data). This constrains y_i
to be no larger than the minimum of these two values. Finally, we will add the constraint \sum_i y_i >= 0.7
, requiring that these minimum values sum to at least 0.7.
All that remains is to implement this in the quadprog
package. Setting up with your problem data:
QUESTION
I read some posts about portfolio optimization with quadprog and i learned many tricks from this platform. Now i am trying to optimize a portfolio of 03 stocks with quadprog under the constrains i.e.,.
- Weights must sum to 1
- No short selling
- portfolio return = 2%
- Each stock weight must not exceed 50% of the total weight
The covariancce matrix for my 3 stock is
...ANSWER
Answered 2017-May-01 at 22:46I am trying to understand your data:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install portfolio-optimization
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page