cvxgrp / cvxportfolio

Portfolio optimization and back-testing.
https://www.cvxportfolio.com
GNU General Public License v3.0
990 stars 257 forks source link

MPO with monotonic trade direction #36

Open kch382001 opened 5 years ago

kch382001 commented 5 years ago

I have a question. If we use MPO in liquidation context with alpha estimation. Say if my initial position is: long symbol A and short symbol B, and I have some short-term alpha estimate. I want o liquidate this portfolio without buying extra A or selling B in the interim period. Basically I want the trade in A going monotonic --- keep selling A, and the trade in B going monotonic --- keeping buying B, in each of the interim period until I fully liquidate the portfolio.
How can I set up constraint?

kch382001 commented 5 years ago

Looks like cvx.multiply(z[:-1], np.sign(initial_position))<=0 will do the job. (assuming initial_position does not have Cash position)