Skip to content

Commit 38d807e

Browse files
author
88d52bdba0366127fffca9dfa93895
committed
format example
1 parent fe3b1d2 commit 38d807e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

example/examples.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import cvxpy as cp
21
import numpy as np
32
import pandas as pd
43

@@ -9,11 +8,9 @@
98
HRPOpt,
109
black_litterman,
1110
expected_returns,
12-
objective_functions,
1311
plotting,
1412
risk_models,
1513
)
16-
from pypfopt.discrete_allocation import DiscreteAllocation, get_latest_prices
1714

1815
# Reading in the data; preparing expected returns and a risk model
1916
df = pd.read_csv("tests/resources/stock_prices.csv", parse_dates=True, index_col="date")
@@ -25,7 +22,7 @@
2522
# Now try with a nonconvex objective from Kolm et al (2014)
2623
def deviation_risk_parity(w, cov_matrix):
2724
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()
2926

3027

3128
ef = EfficientFrontier(mu, S)

0 commit comments

Comments
 (0)