I'm trying to replicate some of the suggestions of this paper. On page 40-41, it's made the following suggestion when it comes to enforcing a minimum trade size:
In this context, z
is the trade vector. When it's time for the second pass, how do you constrain on z
being larger than a certain value? A minimal example below (I'm using u
instead of z
).
import cvxpy as cp
import numpy as np
x = np.random.normal(0., 1., size=(100, 1))
u = cp.Variable((100, 1))
S = np.random.rand(100, 100)
S = np.dot(S, S.T)
prob = cp.Problem(cp.Maximize(x.T @ u - 0.1 * cp.quad_form(u, S)),
[cp.sum(u) == 1.,
cp.abs(u) <= 0.1])
prob.solve()
# try again with non-zero
u_bar = u.value.copy()
min_trade = 0.05
prob = cp.Problem(cp.Maximize(x.T @ u - 0.1 * cp.quad_form(u, S)),
[cp.sum(u) == 1.,
cp.abs(u) <= 0.1,
u[u_bar > 0] >= 0.,
u[u_bar == 0] == 0.,
u[u_bar < 0] <= 0,
% how do you constrain u to be abs(u) >= min_trade?)
prob.solve()
[Edit] The reason why I'm asking is that let's say the smallest positive trade in the first pass is 0.01. If the minimum trade is 0.05, this value will most likely drop to 0 (and the average value of all the other positive entries slightly higher). So I can't use u[u_bar > 0] >= min_trade
.