Closed zhangyx0417 closed 2 years ago
You could create a custom transaction cost objective that supports vector input. This is a quick modification I made by looking at the source code for transaction_cost
.
def transaction_cost(w, w_prev, k=0.001):
return w, k @ (w - w_prev)
Not sure if that'll work, but a simple modification of it probably should!
In a portfolio optimization problem, there are 3 assets in total, and I'd like to assign different transaction cost rates (e.g., 0.01, 0.02, 0.03) to the 3 assets. What should I do?
I've tried
ec.add_objective(objective_functions.transaction_cost, w_prev=initial_weights, k=0.1)
, but I can only pass one transaction cost rate.