> For the complete documentation index, see [llms.txt](https://3commas.gitbook.io/3commas-official-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://3commas.gitbook.io/3commas-official-api-docs/dca-bot/create-dca-bot2.md).

# Create DCA Bot

<br>

**Description:** Creates a new DCA Bot<br>

**Permission:** BOTS\_WRITE\
**Security** SIGNED\ <br>

> <mark style="color:green;">**`POST`**</mark>
>
> `/ver1/bots/create_bot`

<br>

## Body Parameters<br>

**name**     `string`     <mark style="color:orange;">required</mark>\
User-defined name of the DCA Bot. If not specified, the system will generate a default name automatically\
Characters: `[1 ... 200]`

**account\_id**     `integer`     <mark style="color:orange;">required</mark>\
ID of the exchange account entity where you want to creat DCA Bot

**pairs**     `string`     <mark style="color:orange;">required</mark>\
Trading pair(s) in 3Commas format\
If a single pair is passed, a SingleBot is created. If two or more pairs are passed, a MultiBot is created

**max\_active\_deals**     `integer`\
The maximum number of active deals available for this DCA Bot\
Minimum:`1`, Maximum:`199`\
Default: `1`

**strategy**     `string`\
The type of trading strategy used by this DCA Bot: `short` or `long`

**profit\_currency**     `string`\
Currency used for the profit from the trades executed by this bot: `base_currency`; `quite_currency`

**base\_order\_volume\_type**     `number`     <mark style="color:orange;">required</mark>\
The volume type of the base order for this DCA Bot: `quote_currency`, `base_currency` or `percent`

**base\_order\_volume**     `number`     <mark style="color:orange;">required</mark>\
The volume of the base order for this DCA Bot

**start\_order\_type**     `string`\
The start order type for this DCA Bot: `limit` or `market`

**strategy\_list**     `array[json]`     <mark style="color:orange;">required</mark>\
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

**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`

**take\_profit\_type**     `string`     <mark style="color:orange;">required</mark>\
The type of profit (`base` or `total`), which sets the basis for profit calculation in this DCA Bot

**take\_profit**     `number`     <mark style="color:orange;">required</mark>\
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`.

**close\_strategy\_list**     `array[json]`\
Array of strategies used for closing deals in this DCA Bot

**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`

**min\_profit\_percentage**     `number`\
The minimum profit percentage when it reaches the deal will be complete by the chosen strategy

**reinvesting\_percentage**     `string`\
Set up a percentage of realized profit to be reinvested in each new deal\
Minimum: `0`; Maximum: `100`

**stop\_loss\_percentage**     `number`\
The percentage of price movement in the opposite direction of the Take Profit target that triggers the Stop Loss<br>

**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`

**tsl\_enabled**     `boolean`\
Indicates whether trailing is enabled (`true`) for Stop Loss or not (`false`)

**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}`

**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`

**risk\_reduction\_percentage**     `string`     <mark style="color:orange;">required</mark>\
Percentage of losses that allows reducing the base order and Safety Orders proportionally to losses

**safety\_order\_step\_percentage**     `number`     <mark style="color:orange;">required</mark>\
Price deviation in percentage to open Safety Trades

**safety\_order\_volume\_type**     `string`\
The volume type of the Safety Order for this DCA Bot

**safety\_order\_volume**     `number`     <mark style="color:orange;">required</mark>\
The volume of the Safety Order for this DCA Bot

**safety\_strategy\_list**     `array[json]`\
Array of strategies specifically for the execution of your safety orders in this DCA Bot

**max\_safety\_orders**     `integer`     <mark style="color:orange;">required</mark>\
The maximum total number of Safety Orders allowed per deal opened by this DCA Bot\
Minimum:`0`; Maximum:`200`

**active\_safety\_orders\_count**     `integer`     <mark style="color:orange;">required</mark>\
The number of active Safety Orders the DCA Bot is allowed to place at one time

**martingale\_volume\_coefficient**     `number`     <mark style="color:orange;">required</mark>\
Coefficient for increasing *safety order volume* in Martingale strategy\
Minimum:`0,1`; Maximum:`10`

**martingale\_step\_coefficient**     `number`     <mark style="color:orange;">required</mark>\
Coefficient for increasing safety order price (`safety_order_step_percentage`) in Martingale strategy\
Minimum:`0,1`; Maximum:`10`

**min\_volume\_btc\_24h**     `number`\
The minimum trading volume in BTC over the last 24 hours required to open a deal

**min\_price**     `number`\
The minimum price to open a new deal for this DCA Bot

**max\_price**     `number`\
The maximum price to open a new deal for this DCA Bot

**deal\_start\_delay\_seconds**     `integer`\
Delay in seconds before a new deal starts

**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`

**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\_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`

<br>

## Additional Information<br>

**pairs**

Use endpoint [All market pairs](/3commas-official-api-docs/market-data/all-market-pairs.md) to get value for parameter.

***

**leverage\_custom\_value**<br>

Use endpoints [Currency rates and limits with leverage data](/3commas-official-api-docs/market-data/currency-rates-and-limits-with-leverage-data.md) 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:<br>

```json
    "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](/3commas-official-api-docs/dca-bot/available-strategy-list.md) endpoint.

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

{% tabs %}
{% tab title="Manual signals" %}

```json
[
   {
      "strategy": "manual"
   }
]
```

or

```
[]
```

{% endtab %}

{% tab title="Non-stop" %}
It's using only for 1 pair bot.

```json
[
   {
      "strategy": "nonstop"
   },
   {
      "options": {}
   }
]
```

{% endtab %}

{% tab title="QFL" %}

```json
[
   {
      "options": {
         "type": "original",
         "percent": 3
      },
      "strategy": "qfl"
   }
]
```

{% endtab %}

{% tab title="TradingView" %}

```json
[
   {
      "options": {
         "time": "5m",
         "type": "buy_or_strong_buy"
      },
      "strategy": "trading_view"
   }
]
```

{% endtab %}

{% tab title="RSI" %}

```json
[
   {
      "options": {
         "time": "5m",
         "points": 30,
         "trigger_condition": "less",
         "time_period": 7
      },
      "strategy": "rsi"
   }
] 
```

{% endtab %}
{% endtabs %}

<br>

## Response Parameters<br>

If successful, the response includes a update copy of [DCA Bot](/3commas-official-api-docs/dca-bot.md) entity.

<br>

## Example Request<br>

```json
POST /ver1/bots/create_bot
```

```json
Body:

{
   "account_id": 32833909,
   "name": "name DCA Bot",
   "pairs": "BNFCR_1INCHUSDT",
   "strategy_list": [
      {
         "options": {},
         "strategy": "nonstop"
      }
   ],
   "base_order_volume": "100.0",
   "max_safety_orders": 4,
   "take_profit": null,
   "take_profit_steps": [
    {
        "amount_percentage": 50,
        "profit_percentage": 10
        },
    {
        "amount_percentage": 50,
        "profit_percentage": 20
    }
],
   "close_deals_timeout": "60",
   "active_safety_orders_count": 1,
   "safety_order_volume": "30.0",
   "safety_order_step_percentage": "1.0",
   "take_profit_type": "total",
   "min_profit_type": null,
   "martingale_volume_coefficient": "2",
   "martingale_step_coefficient": "4.0"
}
```

<br>

## Example Response and errors<br>

<details>

<summary>Status: 201 Created</summary>

<br>

```json
{
    "id": 15564828,
    "account_id": 32833909,
    "is_enabled": false,
    "max_safety_orders": 4,
    "active_safety_orders_count": 1,
    "pairs": [
        "BNFCR_1INCHUSDT"
    ],
    "strategy_list": [
        {
            "strategy": "nonstop",
            "options": {}
        }
    ],
    "close_strategy_list": [],
    "safety_strategy_list": [],
    "max_active_deals": 1,
    "active_deals_count": 0,
    "deletable?": true,
    "created_at": "2024-10-24T19:57:43.635Z",
    "updated_at": "2024-10-24T19:57:43.635Z",
    "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": null,
    "url_secret": "738d600eb4",
    "take_profit_steps": [],
    "name": "test 24 oct",
    "take_profit": "2.0",
    "min_profit_percentage": null,
    "base_order_volume": "15.0",
    "safety_order_volume": "30.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": "4.0",
    "stop_loss_percentage": "0.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": "My Binance",
    "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
}
```

</details>

<details>

<summary>Status: 400 Bad Request</summary>

<br>

```json
{
    "error": "record_invalid",
    "error_description": "Invalid parameters",
    "error_attributes": {
        "name": [
            "is missing"
        ]
    }
}
```

</details>

<details>

<summary>Status: 404 Not Found</summary>

<br>

```json
{
    "error": "not_found",
    "error_description": "Not Found"
}
```

</details>
