Skip to content

DealCluster

Amargedon edited this page Nov 3, 2023 · 3 revisions

Deal cluster bot helper named dealcluster.py

Type = deal manager

What does it do?

Tired of having multiple deals of the same pair open for a number of bots? This helper will help you out by adjusting the configured pairs in a bot inside a cluster.

How does it work?

First, you will need to create a cluster of bots by configuring the botids. This script will start to monitor the active deals of these bots and register them in a local database.

The deals inside one cluster will be grouped in order to determine how many deals for a given pair are active. If this number exceeds the max-same-deal, the pair will be disabled for all the bots inside the cluster. Disabled means the pair configuration of the bots is updated and the specific pair is removed from them.

Once a deal is gone and the number of deals for this pair is below max-same-deals, the pair is enabled and the bots inside the cluster are updated again.

Notice you can create more than one cluster as long as each section starts with 'cluster_'. The example configuration below contains a single 'default' cluster.

When the SHAREDIR option is used, this script will create a .pairexclude file for each bot within a configured cluster. This file contains the pairs which have been disabled and can be used by other scripts to prevent enabling these pairs and triggering new deals, making this script ineffective.

Note: the latest version supports the use of WebSockets meaning updates are reveived from 3C regarding opened and closed deals. This means in most cases the script is fast enough to prevent a second deal within seconds on another bot. Therefor the interval of this script can be set to one hour or so, as safety to check if the administration is still up to date.

Author of this script is amargedon.

Configuration

The configuration file for dealcluster contains the following settings:

  • timezone - timezone. (default is 'Europe/Amsterdam')
  • timeinterval - update timeinterval in Seconds. (default is 3600)
  • debug - set to true to enable debug logging to file. (default is False)
  • logrotate - number of days to keep logs. (default = 7
  • 3c-apikey - your 3Commas API key value.
  • 3c-apisecret - your 3Commas API key secret value.
  • 3c-apikey-path - path to your own generated RSA private key, or empty.
  • notifications - set to true to enable notifications. (default = False)
  • notify-urls - one or a list of apprise notify urls, each in " " seperated with commas. See Apprise website for more information.
  • cluster_default
  • botids - a list of bot id's to manage separated with commas.
  • max-same-deals - number of deals for the same pair allowed. (default = 1)

Example: (keys are bogus)

[settings]
timezone = Europe/Amsterdam
timeinterval = 86400
debug = False
logrotate = 7
3c-apikey = 4mzhnpio6la4h1158ylt2
3c-apisecret = 4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt
3c-apikey-path = 
notifications = True
notify-urls = [ "tgram://9995888120:BoJPor6opeHyxx5VVZPX-BoJPor6opeHyxx5VVZPX/" ]

[cluster_default]
botids = [ 12345, 67890]
max-same-deals = 1

Example output

Dealcluster