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

Request: Automatic Compound and grid modifying #6

Open
Ferrox85 opened this issue Nov 12, 2021 · 5 comments
Open

Request: Automatic Compound and grid modifying #6

Ferrox85 opened this issue Nov 12, 2021 · 5 comments

Comments

@Ferrox85
Copy link

Ferrox85 commented Nov 12, 2021

Hi,

Great work on this! You've asked for idea's to do.

What I would like is automatic gridbot management. I do this by hand and consumes a lot of time monitoring this and modifying the grids if it gained and the price moved outside the grid.

I have 2 ideas:

  • Automatic compounding at a set interval to put the gains back in the grid
  • Follow the price (also at a set interval?) if it got outside the grid settings, but maintain the grid width (with a margin off course)

Thing to keep in mind:
Sometimes you need to stop the grid if modifying it, before accepting the new settings. Not sure this is a 3commas gui problem.

@cyberjunky
Copy link
Owner

Will have look, my gridbot experience is limited, but lets see...

@cyberjunky
Copy link
Owner

@Ferrox85 I quickly wrote the basic framework, whats missing is the logic.

What do we need, keep the middle of the grid on the price?
Or do we fetch more data like orders and work with those?

ron@laptop-ubuntu:~/3commas-cyber-bots(main)$ ./gridbot.py 
2021-11-12 20:16:49,276 - gridbot - INFO - 3Commas bot helper gridbot
2021-11-12 20:16:49,276 - gridbot - INFO - Started at Friday 20:16:49 12-11-2021
2021-11-12 20:16:49,277 - gridbot - INFO - Loaded configuration from '/home/ron/3commas-cyber-bots/gridbot.ini'
2021-11-12 20:16:49,277 - gridbot - INFO - Notifications are enabled
2021-11-12 20:16:49,278 - gridbot - INFO - Reloaded configuration from '/home/ron/3commas-cyber-bots/gridbot.ini'
2021-11-12 20:16:49,867 - gridbot - INFO - Current gridbot settings :
2021-11-12 20:16:49,868 - gridbot - INFO - Name: My Grid Bot TEST
2021-11-12 20:16:49,877 - gridbot - INFO - Pair: USDT_BTC
2021-11-12 20:16:49,877 - gridbot - INFO - Upper price: 69000.0
2021-11-12 20:16:49,878 - gridbot - INFO - Lower price: 58849.0
2021-11-12 20:16:49,878 - gridbot - INFO - Quantity per grid: 0.08925
2021-11-12 20:16:49,878 - gridbot - INFO - Grids quantity: 10
2021-11-12 20:16:50,019 - gridbot - INFO - Fetched 3Commas price for pair USDT_BTC 63758.93 OK
2021-11-12 20:16:50,019 - gridbot - INFO - Price for USDT_BTC is 63758.93
2021-11-12 20:16:50,020 - gridbot - INFO - Next update in 3600 Seconds at 21:16:50

@Ferrox85
Copy link
Author

Thank you for your work, when I have time I'll dive in to it!

I think we need the gains to, to calculate the amount we can put back in the grid.

I have time tomorrow to give look in to it.

@cyberjunky
Copy link
Owner

This is what is avaulabe from the bot itself, haven't looked yet what is available for gridbot deals
The grid line with status None shows up as waiting in my graph, strange...

{'id': 1009981, 'account_id': 30616081, 'account_name': 'Paper Account 12345', 'is_enabled': True, 'grids_quantity': '10', 'created_at': '2021-11-12T18:50:27.047Z', 'updated_at': '2021-11-12T20:34:04.513Z', 'strategy_type': 'manual', 'upper_stop_loss_enabled': False, 'lower_stop_loss_enabled': False, 'lower_price': '58899.0', 'lower_stop_loss_price': None, 'lower_stop_loss_action': 'stop_bot', 'upper_price': '70050.0', 'upper_stop_loss_price': None, 'upper_stop_loss_action': 'stop_bot', 'quantity_per_grid': '0.08925', 'leverage_type': 'not_specified', 'leverage_custom_value': None, 'name': 'My Grid Bot TEST', 'pair': 'USDT_BTC', 'start_price': '64076.56', 'grid_price_step': '1239.0', 'current_profit': '110.47016925', 'current_profit_usd': '110.47016925', 'total_profits_count': '1', 'bought_volume': '5704.75780875', 'sold_volume': '5803.8298605', 'profit_percentage': '0.2130801012239838867944017', 'current_price': '64256.55', 'investment_base_currency': '0.44625', 'investment_quote_currency': '21690.4275', 'grid_lines': [{'price': '65094.0', 'side': 'sell', 'order_placed': True}, {'price': '63855.0', 'side': None, 'order_placed': False}, {'price': '58899.0', 'side': 'buy', 'order_placed': True}, {'price': '60138.0', 'side': 'buy', 'order_placed': True}, {'price': '61377.0', 'side': 'buy', 'order_placed': True}, {'price': '62616.0', 'side': 'buy', 'order_placed': True}, {'price': '66333.0', 'side': 'sell', 'order_placed': True}, {'price': '67572.0', 'side': 'sell', 'order_placed': True}, {'price': '68811.0', 'side': 'sell', 'order_placed': True}, {'price': '70050.0', 'side': 'sell', 'order_placed': True}], 'editable': True}

@Ferrox85
Copy link
Author

Well, I think all the info is there, but it is hard to manage those gridbots, or compounding them manually.

What to keep in mind:

  • When the price is outside the grid, you are effectively losing coins (because it is not making trades anymore and you are all in with the losing side of the pair). 3Commas has a new stop-loss function, not sure how to set those right for effective handling of the grids. Because, when the price is right again (or moving sideways) you need te manually turn on the bot? It is new, so I've haven't used it.
  • It is not preferred to chase the upper or lower price to infinity. To compensate this you need a lot of trades again. But if it crosses your grid in one move, you do not gain anything and you lose a lot. (because you are selling lower then bought, or you buy higher that sold)
  • The gain is in the quoted asset. You buy, and sell higher in each grid line. This is fun when it is moving sideways a lot.
  • You need something more than 1% grid spacing for some gain. (otherwise the fee is possibly higher than the gain)
  • It is wise to choose the right coin pairs for grids..

Because the gain result is in the quoted asset, maybe it is an idea to add an extra grid line below the current last grid line. So when it is the most interesting you convert it. Or you need to increase the quantity per grid (which is preferable, but you need to buy more of the asset. And here comes the tricky part. This is not easily possible with 3commas. I usually buy manually of the asset needed to increase this quantity per grid. If you buy to many, you running short of quoted asset, and you are not able to change it anymore (or you need te sell manually again).

Well, it is complex to automate this. I think the main thing to do is:
-automatic chasing of the grid while maintaining the grid spacing in % and number of grid quantity
-Find a way of automatic compounding and add to the grid quantity (not sure if this is even possible while I am thinking about this because of the need of buying asset manually...?)

I've tried by gui to add a grid line below the current price to buy an extra line with the pofit I made.. But then it needs more of the quoted asset.

Maybe you have thoughts on this topic.. The more I think about it, the harder it gets...

cyberjunky pushed a commit that referenced this issue Jan 25, 2022
Merge DealCluster script into main
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

2 participants