Commit 42a6e725 authored by Dr.李's avatar Dr.李

update libs to new ipopt version

parent 99b252c3
......@@ -75,7 +75,8 @@ cdef extern from "tvoptimizer.hpp" namespace "pfopt":
int,
double*,
double*,
double*) except +
double*,
string) except +
vector[double] xValue()
double feval()
int status()
......@@ -98,7 +99,8 @@ cdef class CVOptimizer:
double target_vol=1.0,
cnp.ndarray[double, ndim=2] factor_cov_matrix=None,
cnp.ndarray[double, ndim=2] factor_loading_matrix=None,
double[:] idsync_risk=None):
double[:] idsync_risk=None,
str linear_solver="ma27"):
self.n = lbound.shape[0]
self.m = 0
......@@ -125,7 +127,8 @@ cdef class CVOptimizer:
self.f,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
&idsync_risk[0] if idsync_risk is not None else NULL)
&idsync_risk[0] if idsync_risk is not None else NULL,
bytes(linear_solver, encoding='utf8'))
else:
self.cobj = new TVOptimizer(self.n,
&expected_return[0],
......@@ -140,7 +143,8 @@ cdef class CVOptimizer:
self.f,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
&idsync_risk[0] if idsync_risk is not None else NULL)
&idsync_risk[0] if idsync_risk is not None else NULL,
bytes(linear_solver, encoding='utf8'))
def __dealloc__(self):
del self.cobj
......@@ -170,7 +174,8 @@ cdef extern from "mvoptimizer.hpp" namespace "pfopt":
int,
double*,
double*,
double*) except +
double*,
string) except +
vector[double] xValue()
double feval()
int status()
......@@ -209,7 +214,8 @@ cdef class QPOptimizer:
double risk_aversion=1.0,
cnp.ndarray[double, ndim=2] factor_cov_matrix=None,
cnp.ndarray[double, ndim=2] factor_loading_matrix=None,
double[:] idsync_risk=None):
double[:] idsync_risk=None,
str linear_solver='ma27'):
self.n = lbound.shape[0]
self.m = 0
......@@ -239,7 +245,8 @@ cdef class QPOptimizer:
self.f,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
&idsync_risk[0] if idsync_risk is not None else NULL)
&idsync_risk[0] if idsync_risk is not None else NULL,
bytes(linear_solver, encoding='utf8'))
else:
self.cobj = new MVOptimizer(self.n,
&expected_return[0],
......@@ -254,7 +261,8 @@ cdef class QPOptimizer:
self.f,
&factor_cov[0] if factor_cov is not None else NULL,
&factor_loading[0] if factor_loading is not None else NULL,
&idsync_risk[0] if idsync_risk is not None else NULL)
&idsync_risk[0] if idsync_risk is not None else NULL,
bytes(linear_solver, encoding='utf8'))
def __dealloc__(self):
del self.cobj
......
Subproject commit b78ad8a55855c448a866f91a3876a271a52d68a1
Subproject commit 148fd8eedca5aeff85d90e6374658d96316e7f66
......@@ -319,26 +319,10 @@ if __name__ == '__main__':
neutralized_risk = None
alpha_factors = {
'ep_q_cs': CSQuantiles(LAST('ep_q'), groups='sw1_adj'),
'roe_q_cs': CSQuantiles(LAST('roe_q'), groups='sw1_adj'),
'OperatingRevenueGrowRate_cs': CSQuantiles(LAST('OperatingRevenueGrowRate'), groups='sw1_adj'),
'GREV_cs': CSQuantiles(LAST('GREV'), groups='sw1_adj'),
'con_peg_rolling_cs': CSQuantiles(LAST('con_peg_rolling'), groups='sw1_adj'),
'con_pe_rolling_order_cs': CSQuantiles(LAST('con_pe_rolling_order'), groups='sw1_adj'),
'IVR_cs': CSQuantiles(LAST('IVR'), groups='sw1_adj'),
'ILLIQUIDITY_cs': CSQuantiles(LAST('ILLIQUIDITY') * LAST('NegMktValue'), groups='sw1_adj'),
'DividendPaidRatio_cs': CSQuantiles(LAST('DividendPaidRatio'), groups='sw1_adj'),
'ep_q_cs': CSQuantiles(LAST('ep_q'), groups='sw1_adj')
}
weights = dict(ep_q_cs=1.,
roe_q_cs=1.,
OperatingRevenueGrowRate_cs=1.,
GREV_cs=0.5,
con_peg_rolling_cs=-0.25,
con_pe_rolling_order_cs=-0.5,
IVR_cs=0.5,
ILLIQUIDITY_cs=0.5,
DividendPaidRatio_cs=0.5)
weights = dict(ep_q_cs=1.)
alpha_model = ConstLinearModel(features=alpha_factors, weights=weights)
......@@ -415,4 +399,4 @@ if __name__ == '__main__':
return ret_df
create_scenario(0.01, target_vol=0.02, method='tv')
\ No newline at end of file
create_scenario(0.01, target_vol=0.01, method='tv')
\ No newline at end of file
Subproject commit 5cd851ccef8cf0a0a71094d0d0e33a9d102f1f55
Subproject commit a187ed6c8f3aa40b47d5be80667cbbe6a6fd563d
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