cyberjunky/3commas-cyber-bots

Some problems with the new compound script

dangalv opened this issue · 11 comments

Hello again!
First I'm going to share some problems that I noticed with the new update of the compound script. The first notable one is the following, the script says the bot's earnings and settings, but then doesn't proceed to apply the new BO and SO values to my bot.
I tried the old version of the script (I do backups) and it works, but the new version gives the following error:

Logs:

Q1: 2022-10-10 03:29:57 - compound - INFO - 3C Cyber Bot-Helper compound 2022-10-10 03:29:57 - compound - INFO - Started on Monday 03:29:57 2022-10-10 2022-10-10 03:29:57 - compound - INFO - Notifications are disabled 2022-10-10 03:29:57 - compound - INFO - Created example config file '/home/ubuntu/3commas-cyber-bots/compound.ini', edit it and restart the program 2022-10-10 05:58:35 - compound - INFO - 3C Cyber Bot-Helper compound 2022-10-10 05:58:35 - compound - INFO - Started on Monday 05:58:35 2022-10-10 2022-10-10 05:58:35 - compound - INFO - Notifications are disabled 2022-10-10 05:58:35 - compound - INFO - Created example config file '/home/ubuntu/3commas-cyber-bots/compound.ini', edit it and restart the program 2022-10-10 08:01:46 - compound - INFO - 3C Cyber Bot-Helper compound 2022-10-10 08:01:46 - compound - INFO - Started on Monday 08:01:46 2022-10-10 2022-10-10 08:01:46 - compound - INFO - Notifications are disabled 2022-10-10 08:01:46 - compound - INFO - Loaded configuration from '/home/ubuntu/3commas-cyber-bots/compound.ini' 2022-10-10 08:01:46 - compound - INFO - Database '/home/ubuntu/3commas-cyber-bots/compound.sqlite3' created successfully 2022-10-10 08:01:46 - compound - INFO - Database tables created successfully 2022-10-10 08:01:46 - compound - INFO - Reloaded configuration from '/home/ubuntu/3commas-cyber-bots/compound.ini' 2022-10-10 08:01:47 - compound - INFO - Finished deals: 28 total profit: 2.032481839999999 2022-10-10 08:01:47 - compound - INFO - Profit available to compound: 2.032481839999999 2022-10-10 08:01:47 - compound - INFO - Profit available after applying percentage value (0.07): 0.14227372879999994 2022-10-10 08:01:47 - compound - INFO - Current bot settings : 2022-10-10 08:01:47 - compound - INFO - Base order volume : 5.0 2022-10-10 08:01:47 - compound - INFO - Safety order volume : 5.0 2022-10-10 08:01:47 - compound - INFO - Max active deals : 2 2022-10-10 08:01:47 - compound - INFO - Max safety orders : 5 2022-10-10 08:01:47 - compound - INFO - SO volume scale : 1.2 2022-10-10 08:01:47 - compound - INFO - Leverage type : cross 2022-10-10 08:01:47 - compound - INFO - Leverage custom value : 20.0 2022-10-10 08:01:47 - compound - INFO - BO percentage: 11.846095526914329 2022-10-10 08:01:47 - compound - INFO - SO percentage: 88.15390447308567 2022-10-10 08:01:47 - compound - INFO - BO compound value: 0.16853881823351016 2022-10-10 08:01:47 - compound - INFO - SO compound value: 0.16853881823351016 Traceback (most recent call last): File "/home/ubuntu/3commas-cyber-bots/./compound.py", line 870, in compound_bot(config, botdata) File "/home/ubuntu/3commas-cyber-bots/./compound.py", line 715, in compound_bot update_bot_order_volumes( File "/home/ubuntu/3commas-cyber-bots/./compound.py", line 151, in update_bot_order_volumes db_lastpassupdate = cursor.execute( TypeError: 'NoneType' object is not subscriptable A1: JavaScript

Secondly as feedback and possible future improvements to the script.

For example in the previous script of compound.py I noticed a problem.
I have a futures bot with 2 maximum deals of which it only uses 1 Safety order, it is a cheap, fast bot with a stop loss. So if the bot hit stop loss or time out theoretically it should subtract me from the BO and the SO, it does that but not in the way it should, from that bot I won for example 2 dollars with a 20 USDT BO/SO and then those 2 USDT I lost them, but the bot was not left with 20 dollars again, its left with an extra approximate 0.9 USDT~ instead of 20 usdt.
Theoretically and logically it should have returned to 20 usdt right?

edit: Possible solution but cumbersome, to resolve the true value that the bot's BO/SO should have, you should delete the sqlite3 file, then reset your BO/SO to initial values and restart the script, this will again recalculate the actual value that should have in the imbalance cases on the value of the orders. But it is a somewhat forced solution.

Another thing, I put these values the same depending on the percentage that I want it to compose, I know the function they fulfill, but I don't know why they separate it into 2 different lines, does it differ in something if they are modified differently?

default-profittocompound = X
profittocompound = X

Excuse my grammar, I use a translator, I'm not ashamed to say it, any detail that has not been understood please ask me. I hope you can consider a possible solution. Thank you

The crash should not have happened, something to look into. This is something changed in the last version as we improved the script to handle profits which are too small for increasing the BO/SO size (so we store the increase, until enough profit has been made to increase the BO/SO).

Regarding the increase and decrease based on the stoploss; would expect it to return to 20 indeed. However, last week discussed with someone else and the code is not using a floor() but a round() which can have some impact. Think we must change it to always use floor(). At least would be my first step as approach.

The default-profittocompound is old an only used if one of the sections below does not contain the profittocompound property. Let's call it a leftover ;)

Will see if an update regarding the first point (the crash) can be created on short notice.

The crash should not have happened, something to look into. This is something changed in the last version as we improved the script to handle profits which are too small for increasing the BO/SO size (so we store the increase, until enough profit has been made to increase the BO/SO).

Regarding the increase and decrease based on the stoploss; would expect it to return to 20 indeed. However, last week discussed with someone else and the code is not using a floor() but a round() which can have some impact. Think we must change it to always use floor(). At least would be my first step as approach.

The default-profittocompound is old an only used if one of the sections below does not contain the profittocompound property. Let's call it a leftover ;)

Will see if an update regarding the first point (the crash) can be created on short notice.

Thanks for replying and for your work.
I know that it is somewhat complicated to make an almost perfect script to handle several values of the deals and especially when losses occur, for something I think that 3commas does not add it natively. I know it's cumbersome but the way to fix the bot imbalance manually works for me: returning to the original values of the BO/SO and then resetting the SQL DB so the script recalculates the gains and losses correctly. Would it be crazy to add an option in the .ini file like "imbalance force fix " with the aforementioned in case the script detects a negative value? forced but 100% effective, the option can be activate/deactivated by the user obviously. Consider it.

Thank you for the bug report.
Could you please share your compound.ini (excluding the sensitive parts), of course?

Thank you for the bug report. Could you please share your compound.ini (excluding the sensitive parts), of course?

Yes no problem, this is the same .ini one I used for the old script and also the new one that didn't work. I even generated an .ini from scratch by running the .py file and it also gave me the same error

[settings]
timezone = Europe/Amsterdam
timeinterval = 900
debug = False
logrotate = 7
default-profittocompound = 0.6
3c-apikey = xxx
3c-apisecret = xxx
notifications = False
notify-urls = ['notify-url1', 'notify-url2']

[bot_xxx]
compoundmode = boso
profittocompound = 0.6
usermaxactivedeals = 2
usermaxsafetyorders = 1
comment = xxx

Thanks!

Just to verify:

[bot_xxx]
compoundmode = boso
profittocompound = 0.6
usermaxactivedeals = 2
usermaxsafetyorders = 1
comment = xxx

I assume the xxx here are actual values from a bot?

Thanks!

Just to verify:

[bot_xxx]
compoundmode = boso
profittocompound = 0.6
usermaxactivedeals = 2
usermaxsafetyorders = 1
comment = xxx

I assume the xxx here are actual values from a bot?

That's right mate.
Botid, API, comment has personal values

How are you running the script?
Which OS, Python version?

How are you running the script? Which OS, Python version?

Sorry for the delay.

Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-1020-aws x86_64)
Python 3.10.6

Hi @dangalv
Thank you for the information.
I found the error and have fixed it in PR #146
Once that is merged, it should work fine :)

Apologies for the inconvenience.

Maybe, to keep things clear, you can put your second request in a separate issue, then we can close this one.

I've just approved PR #146 so it should work for you again after updating.

Hi @dangalv Thank you for the information. I found the error and have fixed it in PR #146 Once that is merged, it should work fine :)

Apologies for the inconvenience.

Maybe, to keep things clear, you can put your second request in a separate issue, then we can close this one.

Hello @brhahlen
No need to apologize friend, your work and that of your team @amargedon is very appreciated. Then I will try the new script and if there is no problem I will open a new topic for the second request. Thanks you