cyberjunky / 3commas-cyber-bots

3Commas bot helpers, AltRank, GalaxyScore, Watchlists, Auto-Compound, TrailingStopLoss, TakeProfitIncrement
MIT License
210 stars 68 forks source link

Dynamic Max Active Deals modification when updating coin pairs + GalaxyScore threshold #79

Closed MassimoCarpita closed 1 year ago

MassimoCarpita commented 2 years ago

Is your feature request related to a problem? Please describe. Here's one problematic situation: suppose you want to update your coin pairs with AltRank, but you only want to get top20 pairs (because you might get from experience that below that threshold you really don't get good performances). Suppose that due to some restrictions (available pairs on your exchange + blacklisted coins) you end up cutting off the top20 AltRank list down to a number of coins which is below your bot's "Max active deals" number. In this case the script will fail telling you that your "Max active deals" number must be below or equal to your suitable pairs list's length. No update is then performed.

Describe the solution you'd like In my opinion, a possible solution would be the following. Set an if condition and when the "restricted-suitable-pairs" list is shorter than expected from "Max active deals" original setting, just set "Max active deals" equal to its length (or any similar solution to always impose "Max active deals" matching "restricted-suitable-pairs" length, but only if this length is lower than the original - this is a conservative approach -). I believe this is pretty straightforward to do with a little modification in routine _set_threecommas_botpairs inside helpers/threecommas.py.

Describe alternatives you've considered If this was done, then it would be more viable to build a GalaxyScore threshold parameter (for example: update list of coins with just coins from GalaxyScore >= 70). There might be bad market days in which GalaxyScore is low for any coin and even if one coin is the top 1 in GalaxyScore we still don't want to use it as its absolute metric is bad. This would be a strong update to GalaxyScore helper which can't be done instead with AltRank helper as AltRank is just a relative metric and not an absolute one.

Additional context Screenshot from error related to the case described in the first section: image

dangalv commented 2 years ago

I agree with this request, not only for altrank but also for other bots such as "3C-tools Bot-Assist" that, for example, in the coins "winner_24h_uptrend" that in a bearish period the list of these coins is scarce or null, necessarily for this problem it's necessary to dynamically adjust the number of "maximum active deals" (as in the thread request) according to the coins that are in the list. As well as in the case that there is no currency to trade, the bot stops automatically.

Another good idea that seems to me but it would be too much to ask is to combine 2 bots helper in a single configuration for example: one from 3c-tools plus another from lunarcrush. Like combine 3c-tools "24 hour winners" and "top altrank" coins in one setup

I know that putting these ideas into reality must be very difficult but I think they could improve the performance of the bot even more, I hope they consider it at some point. Thanks

amargedon commented 2 years ago

For Altrank, GalaxyScore and BotAssist this has been implemented using the 'originalmaxdeals' and 'allowmaxdealchange' options in the configuration. All these scripts also support filtering based on the 'min 24h volume' as configured in the bot on 3C.

@cyberjunky I think this request is finished, as combining these scripts is not within the scope (yet)?

dangalv commented 2 years ago

Good news, although I think it would be a very good idea that if there is no coins available to trade that the bot can be turned off automatically, since the bot does not accept a value of "0" in "Max active deals". " to save the bot settings. Although I don't know if it's possible to turn off the bot through API or it's only possible through tradingview alerts

MassimoCarpita commented 2 years ago

For Altrank, GalaxyScore and BotAssist this has been implemented using the 'originalmaxdeals' and 'allowmaxdealchange' options in the configuration. All these scripts also support filtering based on the 'min 24h volume' as configured in the bot on 3C.

@cyberjunky I think this request is finished, as combining these scripts is not within the scope (yet)?

Thanks for your answer @amargedon. Cool update. Nonetheless it's not clear in the description what happens when # of suitable pairs is 0 (since you can't set max active deals = 0 in 3commas). I've built my own version of this and in my case I turn off the bot (@dangalv yes you can do it with API, I restart the bot at next update if new suitable pairs are then available or otherwise I keep it shut off). This is extremely helpful as I've also added a threshold for GalaxyScore value when sorting pairs.

cyberjunky commented 2 years ago

Sure you can turn off bots using the API, that's not the issue, the issue is we have a too little time do do all things we (and others) want. Mind sharing it? Or are you just a taker?

MassimoCarpita commented 2 years ago

This was not a critique, I was just answering the previous question from the other user. I guess anyone here agrees that you all are doing an amazing job and we just want to share our views. I'd love to share, just let me know how (because what I did was taking your code and modifying a few routines, so I can't just push it).

cyberjunky commented 2 years ago

I understand.

MassimoCarpita commented 2 years ago

If you want me to, I can build a public github folder and you can check it from my profile. Let me know if it can be useful. I'm available.

dangalv commented 2 years ago

Great! It can be very useful, thanks for the contribution @MassimoCarpita, hopefully when @cyberjunky has time he can check and index it to his git code.

MassimoCarpita commented 2 years ago

You can now find a public repository on my profile with that. Cheers

amargedon commented 2 years ago

@MassimoCarpita thanks for sharing the code in the repository. I've started to integrate your changes, and will also extend it to altrank.py (only stop and start of bots) and botassistexplorer.py. Will post an update when done.

amargedon commented 2 years ago

@MassimoCarpita thanks for sharing the code in the repository. I've started to integrate your changes, and will also extend it to altrank.py (only stop and start of bots) and botassistexplorer.py. Will post an update when done.

@MassimoCarpita the changes have been merged. Although the changes are also in botassistexplorer.py which I have tested, I do not have a GalaxyScore configuration running. Would you be able to update to the latest version, run it and provide any feedback? Thanks!

dangalv commented 2 years ago

@amargedon Hello friend thanks for helping to improve the code!
Sorry to bother you but could you explain to me if it's not too much trouble how to place the top 1 coin without the bot turning off? there is a problem that the bot cannot start if I activate " allowbotstopstart ". As much as the coin is in the first place on the lunarcrush and I set these parameters like: "altrankscore = 1", "numberofpairs: 1" and "originalmaxdeals = 1" the bot cannot turn on. I also tried with set fetchlimit to "1" and it seemed the bot turn on sometimes, but now the bot just turns off. I'm not understanding how to let the bot work with only one coin. 😥

amargedon commented 2 years ago

@amargedon Hello friend thanks for helping to improve the code! Sorry to bother you but could you explain to me if it's not too much trouble how to place the top 1 coin without the bot turning off? there is a problem that the bot cannot start if I activate " allowbotstopstart ". As much as the coin is in the first place on the lunarcrush and I set these parameters like: "altrankscore = 1", "numberofpairs: 1" and "originalmaxdeals = 1" the bot cannot turn on. I also tried with set fetchlimit to "1" and it seemed the bot turn on sometimes, but now the bot just turns off. I'm not understanding how to let the bot work with only one coin. 😥

Will reply in the issue you have created, to keep this thread clean for testing by @MassimoCarpita

MassimoCarpita commented 2 years ago

I'm sorry guys I've been off to work and it has been a super busy period. Idk whether I'll be able to test the update in next days / week but you'll be the first to hear any new feedback in case. Thanks again for your amazing work @amargedon!