brndnmtthws / thetagang

ThetaGang is an IBKR bot for collecting money
GNU Affero General Public License v3.0
1.9k stars 249 forks source link

When updating price, use halfway between midpoint #334

Closed brndnmtthws closed 7 months ago

brndnmtthws commented 7 months ago

Previous we'd pick the midpoint price for an order, then wait a few seconds, and then pick the midpoint again. This can lead to less-than-ideal fills on illiquid dogs hit stocks/ETFs. Instead, we'll take the halfway point between the previous and updated midpoint, which should give us slightly less bad fills.

Additionally, we never want to switch a credit to a debit or vice versa, so check that the signs match before proceeding.