Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the balance command might break order combination. #51

Open
dscotese opened this issue Nov 22, 2024 · 0 comments
Open

Running the balance command might break order combination. #51

dscotese opened this issue Nov 22, 2024 · 0 comments

Comments

@dscotese
Copy link
Owner

dscotese commented Nov 22, 2024

This will make a good unit test even if it was a one-time occurrence:

  1. Have some open trades which create a grid.
  2. Test that the balance command will create two trades. Sometimes, it (correctly!) says we are too far out of balance.
  3. You can use the file cached.json and process.USECACHE='must' to prevent getting data from the exchange. Ensure that it returns a price which requires a trade to achieve balance according to your allocation.
  4. The bot places trades above and below the current price by adding or subtracting the tolerance. Since we aren't currently in balance, it then figures out how much to trade at the current price, creates an order for it with a conditional close, and sets the price for the conditional close to match whichever trade is on the same side. This will cause the order resulting from execution of the balancing trade to be combined with one of the two other orders. If the order is larger than the side it will be added to, note that the trade made on that side would require to be made with a negative amount. This is what "We're too far out of balance" means.
  5. Execute the balance command so that it deletes all existing trades and creates the three new trades.
  6. Wait until the trade at the current price is executed (and produces the conditional close) and then issue report (or just hit enter) to see if the bot combines the new order with one of the existing ones. That's what failed for me, but after restarting the bot, it combined the orders just fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant