arbitrader
arbitrader copied to clipboard
Strongly encourage limit orders to close
Arbitrader can get into a mode where it's waiting for one or more limit orders to fill, either to open or close a pair of positions. If you have bad luck it can be a very long time before the orders fill, if they ever do. Currently there is no way to escape from this mode unless the orders fill. It would be nice to have a graceful way to exit this situation.
I propose a new condition like force-close
or exit-when-idle
named adjust-limit-orders
. When you create this file, Arbitrader will look at the order(s) it's waiting on. It will adjust the price on the open order(s) to match whatever the current ticker is in TickerService
so that the orders will probably close. The command would be repeatable in case it didn't work the first time.
Of course all profit estimations are thrown off by this but you wouldn't have to exit the program, manually kill the orders in the exchanges, erase the state file, and restart like you do now.
Let's wait until the rxJava stuff is merged to do this. Right now it's going to be too complicated because we just sleep()
while we wait for the orders to complete. After that we will have nonblocking code that will allow us to do stuff like check conditions and look at tickers.
I would prefer something more automatic, like a timeout. After X amount of time if both limit orders were not filled then we cancel them and start over. If one open order is not filled then we close/sell the filled one and cancel the open order.
This way we avoid more IO operations (check on the disk) and the bot can continue on it's own without needing human intervention.