pareeohnos / ktrade

A simple UI for managing your trades
MIT License
7 stars 5 forks source link

When there is one share left, and you trim half to close the position, the stop loss of 1 share remains, causing you to go short 1 share #17

Closed Dolivent closed 3 years ago

Dolivent commented 3 years ago

Edit: original problem was that the stop didn't adjust quantities. This works and was probably a user error.

New problem is that when you trim to close the position, the stop loss doesn't match the shares remaining. The program should check the stop loss quantity against the positions quantity

pareeohnos commented 3 years ago

Ah what!? Guess that's another thing broken. It's coded in as well

Dolivent commented 3 years ago

Tried this again:

  1. Stop amount adjusts to the amount remaining (good)
  2. Stop then moved to breakeven (good)
  3. There was 1 scenario where I had 1 share left, then I trim half to close the position. It sells the last share, but then I'm still left with a stop loss of 1 share. The stop triggers and im short 1 share
Dolivent commented 3 years ago

Another Scenario:

  1. buy 14 shares
  2. sell 4 shares on the TWS. 10 shares remain, stop adjusted to 10 shares
  3. Trim 1/2 shares using ktrade, sells 7 shares, 3 shares remain. Stop is 7 shares

Both this and the issue in the title appear to come from the app not checking position size vs the stop size