File tree Expand file tree Collapse file tree 1 file changed +1
-4
lines changed Expand file tree Collapse file tree 1 file changed +1
-4
lines changed Original file line number Diff line number Diff line change 1
- import cvxpy as cp
2
1
import numpy as np
3
2
import pandas as pd
4
3
9
8
HRPOpt ,
10
9
black_litterman ,
11
10
expected_returns ,
12
- objective_functions ,
13
11
plotting ,
14
12
risk_models ,
15
13
)
16
- from pypfopt .discrete_allocation import DiscreteAllocation , get_latest_prices
17
14
18
15
# Reading in the data; preparing expected returns and a risk model
19
16
df = pd .read_csv ("tests/resources/stock_prices.csv" , parse_dates = True , index_col = "date" )
25
22
# Now try with a nonconvex objective from Kolm et al (2014)
26
23
def deviation_risk_parity (w , cov_matrix ):
27
24
diff = w * np .dot (cov_matrix , w ) - (w * np .dot (cov_matrix , w )).reshape (- 1 , 1 )
28
- return (diff ** 2 ).sum ().sum ()
25
+ return (diff ** 2 ).sum ().sum ()
29
26
30
27
31
28
ef = EfficientFrontier (mu , S )
You can’t perform that action at this time.
0 commit comments