Skip to content

Commit

Permalink
format example
Browse files Browse the repository at this point in the history
  • Loading branch information
88d52bdba0366127fffca9dfa93895 committed May 3, 2023
1 parent fe3b1d2 commit 38d807e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions example/examples.py
@@ -1,4 +1,3 @@
import cvxpy as cp
import numpy as np
import pandas as pd

Expand All @@ -9,11 +8,9 @@
HRPOpt,
black_litterman,
expected_returns,
objective_functions,
plotting,
risk_models,
)
from pypfopt.discrete_allocation import DiscreteAllocation, get_latest_prices

# Reading in the data; preparing expected returns and a risk model
df = pd.read_csv("tests/resources/stock_prices.csv", parse_dates=True, index_col="date")
Expand All @@ -25,7 +22,7 @@
# Now try with a nonconvex objective from Kolm et al (2014)
def deviation_risk_parity(w, cov_matrix):
diff = w * np.dot(cov_matrix, w) - (w * np.dot(cov_matrix, w)).reshape(-1, 1)
return (diff ** 2).sum().sum()
return (diff**2).sum().sum()


ef = EfficientFrontier(mu, S)
Expand Down

0 comments on commit 38d807e

Please sign in to comment.