Edit DCA Bot

Description: Edits an existing DCA Bot using its ID

Permission: BOTS_WRITE Security: SIGNED

PATCH

/ver1/bots/{bot_id}/update

Path Parameter

bot_id integer required Unique 3Commas ID for this DCA Bot entity

Body Parameters

name string required DCA Bot name specified by the user

pairs string required Trading pair(s) in 3Commas format

max_active_deals integer The maximum number of active deals available for this DCA Bot Minimum:1, Maximum:199 Default: 1

base_order_volume_type number The volume type of the base order for this DCA Bot: quote_currency, base_currency or percent

base_order_volume number required The volume of the base order for this DCA Bot

take_profit number required Percentage value for the bot’s Take Profit. If multiple steps are specified in take_profit_steps settings, this parameter should be set to 0

take_profit_steps array[object] Take Profit Steps, each represented as an object with properties:

  • amount_percentage;

  • profit_percentage.

safety_order_volume number required The volume of the Safety Order for this DCA Bot

safety_order_volume_type string The volume type of the Safety Order for this DCA Bot

martingale_volume_coefficient number required Coefficient for increasing safety order volume in Martingale strategy Minimum:0,1; Maximum:10

martingale_step_coefficient number required Coefficient for increasing safety order price (safety_order_step_percentage) in Martingale strategy. Minimum:0,1; Maximum:10

max_safety_orders integer required The maximum total number of Safety Orders allowed per deal opened by this DCA Bot Minimum:0; Maximum:200

active_safety_orders_count integer required The number of active Safety Orders the DCA Bot is allowed to place at one time

stop_loss_percentage number The percentage of price movement in the opposite direction of the Take Profit target that triggers the Stop Loss. The value should be set to 0 to disable Stop Loss

sl_to_breakeven_enabled boolean Enables (true) or disable (false) the Move to Breakeven feature for this DCA Bot. To use this feature, you must have at least two Take Profit steps Default: false

sl_to_breakeven_data json Upper limit for Stop Loss to move to breakeven, where 0 is the base order bought price, 1 is 1st step of TP, and 2 is 2st step of TP Example: {upper_breakeven_limit: 1}

cooldown number The time (in seconds) that the DCA bot will wait after closing a deal before accepting a signal to start a new deal for the same asset pair Minimum: 0; Maximum: 2592000

trailing_enabled boolean Indicates whether trailing is enabled for Take Profit (true) or not (false)

trailing_deviation number Percentage value of the trailing price, in percent. This parameter is required when trailing_enabled is set to true

safety_order_step_percentage number required Price deviation in percentage to open Safety Trades

take_profit_type string required The type of profit (base or total), which sets the basis for profit calculation in this DCA Bot

strategy_list array[json] required Array of strategies specifically for opening deals in this DCA Bot

leverage_type string Sets leverage settings for a futures account: cross or isolated

leverage_custom_value number Leverage value. Leverage value is dependent on the exchange and the pair

stop_loss_timeout_enabled boolean Indicates whether the Stop Loss timeout is enabled (true) or disabled (false) Default: false

stop_loss_timeout_in_seconds integer Value timeout in seconds This parameter is required when stop_loss_timeout_enabled is set to true

tsl_enabled boolean Indicates whether trailing is enabled (true) for Stop Loss or not (false)

min_volume_btc_24h number The minimum trading volume in BTC over the last 24 hours required to open a deal

deal_start_delay_seconds integer Delay in seconds before a new deal starts

profit_currency string Currency used for the profit from the trades executed by this bot: base_currency; quite_currency

start_order_type string The start order type for this DCA Bot: limit or market

stop_loss_type string The type of action the bot should perform after closing a deal due to the Stop Loss setting: stop_loss or stop_loss_and_disable_bot

disable_after_deals_count integer The number of opening deals after that DCA bot will disabled

allowed_deals_on_same_pair integer Allow to set up a specific number of deals on the same pair. It works only for bot where type is Bot::MultiBot

min_profit_percentage number The minimum profit percentage when it reaches the deal will be complete by the chosen strategy

min_profit_type string The type of minimum profit, which sets the basis for profit calculation in this DCA Bot: base_order_volume or total_bought_volume

close_strategy_list array[json] Array of strategies used for closing deals in this DCA Bot

risk_reduction_percentage number Percentage of losses that allows reducing the base order and Safety Orders proportionally to losses

reinvesting_percentage number Set up a percentage of realized profit to be reinvested in each new deal Minimum: 0; Maximum: 100

min_price_percentage number Min price percent. Must be greater then -95 and lower then 1000

max_price_percentage number Max price percent. Must be greater then -95 and lower then 1000

close_deals_timeout integer The time in seconds after which the deals will close automatically Minimum: 60

Additional Information

pairs

Use endpoint All market pairs to get value for parameter.


leverage_custom_value

Use endpoints Currency rates and limits with leverage data to check available value for this parameter.


take_profit_steps When using multiple steps for Take Profit, each step should be represented as an object with the following properties:

amount_percentage profit_percentage

Keep in mind, you can create a maximum of 4 targets, allocating 100% of your position volume is allocated across them.

For example:

    "take_profit_steps": [
    {
        "amount_percentage": 50,
        "profit_percentage": 10
        },
    {
        "amount_percentage": 50,
        "profit_percentage": 20
    }
]

strategy list, close_strategy_list, safety_strategy_list,

The data strategies are used to populate the strategy_list and close_strategy_list parameters. You can retrieve the full list of strategies available for this DCA bot through the Available strategy list for bot endpoint.

Below are several examples demonstrating how to fill these parameters with strategy data:

[
   {
      "strategy": "manual"
   }
]

or

[]

Parameters response

If successful, the response includes a copy of DCA Bot entity.

Example Request

PATCH /ver1/bots/12345678/update
Body:

{
   "account_id": 32199203,
   "name": "name DCA Bot",
   "pairs": "USDT_ETH",
   "strategy_list": [
      {
         "options": {},
         "strategy": "nonstop"
      }
   ],
   "base_order_volume": "100.0",
   "take_profit_type": "total",
   "take_profit": null,
   "take_profit_steps": [
    {
        "amount_percentage": 50,
        "profit_percentage": 10
        },
    {
        "amount_percentage": 50,
        "profit_percentage": 20
    }
],
   "stop_loss_percentage": "8",
   "close_deals_timeout": "100",
   "max_safety_orders": 3,
   "active_safety_orders_count": 3,
   "safety_order_volume": "20.0",
   "safety_order_step_percentage": "1.0",
   "min_profit_type": null,
   "martingale_volume_coefficient": "2",
   "martingale_step_coefficient": "2"
}

Example response and errors

Status: 200 OK

{
    "id": 15656489,
    "account_id": 32199203,
    "is_enabled": false,
    "max_safety_orders": 3,
    "active_safety_orders_count": 3,
    "pairs": [
        "USDT_ETH"
    ],
    "strategy_list": [
        {
            "options": {},
            "strategy": "nonstop"
        }
    ],
    "close_strategy_list": [],
    "safety_strategy_list": [],
    "max_active_deals": 1,
    "active_deals_count": 0,
    "deletable?": true,
    "created_at": "2024-11-19T21:04:11.299Z",
    "updated_at": "2024-11-21T15:22:24.557Z",
    "trailing_enabled": null,
    "tsl_enabled": false,
    "deal_start_delay_seconds": null,
    "stop_loss_timeout_enabled": false,
    "stop_loss_timeout_in_seconds": 0,
    "disable_after_deals_count": null,
    "deals_counter": null,
    "allowed_deals_on_same_pair": null,
    "easy_form_supported": false,
    "close_deals_timeout": 100,
    "url_secret": "5e334993e6",
    "take_profit_steps": [
        {
            "amount_percentage": 50,
            "profit_percentage": 10,
            "id": 0
        },
        {
            "amount_percentage": 50,
            "profit_percentage": 20,
            "id": 1
        }
    ],
    "name": "name DCA Bot",
    "take_profit": null,
    "min_profit_percentage": null,
    "base_order_volume": "100.0",
    "safety_order_volume": "20.0",
    "safety_order_step_percentage": "1.0",
    "take_profit_type": "total",
    "min_profit_type": null,
    "type": "Bot::SingleBot",
    "martingale_volume_coefficient": "2.0",
    "martingale_step_coefficient": "2.0",
    "stop_loss_percentage": "8.0",
    "cooldown": "0",
    "btc_price_limit": "0.0",
    "strategy": "long",
    "min_volume_btc_24h": "0.0",
    "profit_currency": "quote_currency",
    "min_price": null,
    "max_price": null,
    "stop_loss_type": "stop_loss",
    "safety_order_volume_type": "quote_currency",
    "base_order_volume_type": "quote_currency",
    "account_name": "Paper Account 1251857",
    "trailing_deviation": "0.2",
    "finished_deals_profit_usd": "0.0",
    "finished_deals_count": "0",
    "leverage_type": "not_specified",
    "leverage_custom_value": null,
    "start_order_type": "limit",
    "active_deals_usd_profit": "0.0",
    "reinvesting_percentage": null,
    "risk_reduction_percentage": null,
    "reinvested_volume_usd": null,
    "min_price_percentage": null,
    "max_price_percentage": null
Status: 400 Bad Request

{
    "error": "record_invalid",
    "error_description": "Invalid parameters",
    "error_attributes": {
        "stop_loss_percentage": [
            "Stop Loss should be below the last safety order (7.0)"
        ]
    }
}

Last updated

Was this helpful?