This may not require a new function from scratch. If the market impact of closing a short is the same as opening a long, then we may be able to piggyback on calc_targeted_long to tell us how much of a short we can close. This is currently the logic used in lpandarb.py, so I'm pretty sure it's the case, otherwise the LP and Arb bot wouldn't work.
This may not require a new function from scratch. If the market impact of closing a short is the same as opening a long, then we may be able to piggyback on calc_targeted_long to tell us how much of a short we can close. This is currently the logic used in lpandarb.py, so I'm pretty sure it's the case, otherwise the LP and Arb bot wouldn't work.