So basically I want to simultaneously short two things and keep the dollar value of each of those two shorts as close as possible to $50k because they hedge each other. But I also want to minimize trading fees so I want it to only trade when the difference from the target exceeds 200 shares. I'm sure I could hack it up with the IB API in a day but I wonder if anyone has already written something like that, or if there is already some hidden feature in TWS to do that?
Don't you want to aim for a $ amount vs shares? I assume if you are short both, the margin is low like FAS/FAZ. However, you need to adjust to keep margin low. You could just adjust once a day at or near the close.
The target is based on dollar amount but the trade increment should be 200 shares because that's the most shares you can trade for the $1 minimum commission.