Commit 35e2da4c authored by Dr.李's avatar Dr.李

added self defined risk bound

parent f4e68e0e
...@@ -76,7 +76,6 @@ class FDataPack(object): ...@@ -76,7 +76,6 @@ class FDataPack(object):
self.raw_factors = raw_factors self.raw_factors = raw_factors
if d1returns is not None: if d1returns is not None:
self.d1returns = d1returns.flatten() self.d1returns = d1returns.flatten()
else: else:
...@@ -196,8 +195,12 @@ def factor_analysis(factors: pd.DataFrame, ...@@ -196,8 +195,12 @@ def factor_analysis(factors: pd.DataFrame,
if is_tradable is not None: if is_tradable is not None:
ubound[~is_tradable] = 0. ubound[~is_tradable] = 0.
risk_lbound = benchmark @ risk_exp if 'risk_bound' in kwargs:
risk_ubound = benchmark @ risk_exp risk_lbound = kwargs['risk_bound'][0]
risk_ubound = kwargs['risk_bound'][1]
else:
risk_lbound = benchmark @ risk_exp
risk_ubound = benchmark @ risk_exp
weights = build_portfolio(er, weights = build_portfolio(er,
builder='linear', builder='linear',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment