> 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/deals.md).

# Deals

The **Deal** is a sub-entity of the DCA Bot. It represents a single automated transaction executed based on the bot's configured strategy.

The **Deal** entity holds the following information about:

* Order type;
* Trading pair(s);
* Status of the deal;
* Initial and realized trade amounts;
* Initial and realized total values of the trade;
* Price details, including entry, average, and final prices;
* Position percentage reached during the trade;
* Conditions related to trailing mechanisms and triggers (e.g., trailing stop enabled, trigger price).

Deals are created automatically by the DCA Bot based on predefined conditions and the selected trading strategy.

A **Deal** can include various trading stages or types, depending on the configuration, such as:

* Initial trade opening;
* Trailing take profit execution;
* Stop-loss activation;
* Safety orders placement;
* Final trade closure.

Here, you can find methods and attributes to monitor, update, or analyze the details of deal.

<br>

## Attributes<br>

**from\_currency\_id**: 0,\
\[TBD]

**to\_currency\_id**: 0,\
\[TBD]

**id**     `integer`\
Unique 3Commas ID for this Deal entity

**type**     `string`\
The type of entity

**bot\_id**     `integer`\
Unique 3Commas ID for this DCA Bot entity

**bot\_name**     `string`\
DCA Bot name specified by the user

**deal\_has\_error**     `boolean`\
Indicates whether this Deal has encountered any errors (`true`) or not (`false`)

**account\_id**     `integer`\
Unique 3Commas ID for this exchange account entity

**account\_name**     `string`\
The name for the exchange account set by the user

**created\_at**     `string`\
ISO 8601 datetime string of when this Deal entity was created

**updated\_at**     `string`\
ISO 8601 datetime string of when this Deal entity was update last time

**closed\_at**     `string`\
ISO 8601 datetime string of when this Deal entity was closed

**finished?**     `boolean`\
Indicates whether this Deal is finished (`true`) or not (`false`)

**max\_safety\_orders**     `integer`\
Maximum number of Safety Orders allowed for this Deal

**active\_safety\_orders\_count**     `integer`\
The number of Safety Trades Deal is allowed to place in advance on the exchange's order book

**current\_active\_safety\_orders\_count**     `integer`\
\[TBD]

**current\_active\_safety\_orders**     `integer`\
Number of active Safety Orders at the current time

**completed\_safety\_orders\_count**     `integer`\
Number of Safety Orders that have been completed

**active\_manual\_safety\_orders**     `integer`\
Number of active manual Safety Orders at the current time

**completed\_manual\_safety\_orders\_count**     `integer`\
Number of manually executed Safety Orders that have been completed

**safety\_order\_volume**     `string`\
The volume of the Safety Order for this Deal

**safety\_order\_step\_percentage**     `number`\
Price deviation in percentage to open Safety Orders

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

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

**cancellable?**     `boolean`\
Indicates whether this Deal can be canceled (true) or not (false)

**panic\_sellable?**     `boolean`\
Indicates whether this Deal can be closed at market price (true) or not (false)

**trailing\_enabled**     `boolean` or `null`\
Indicates whether trailing is enabled for Take Profit of this bot (`true`) or not (`false`)

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

**stop\_loss\_timeout\_enabled**     `boolean`\
Indicates if the Stop Loss timeout is active (`true`) or not (`false`)

**stop\_loss\_timeout\_in\_seconds**     `integer`\
Duration of the Stop Loss timeout in seconds for this Deal

**pair**     `strign`\
Trading pair(s) in 3Commas format

**status**     `string`\
3Commas status for this Deal

<details>

<summary><em>Allowed values</em></summary>

**Bought** - Asset bought;\
**Cancelled** - Deal canceled;\
**Completed** - Deal closed successfully;\
**Base\_order\_placed** - Base order placed;\
**Stop\_loss\_finished** - Closed by stop-loss;\
**Ttp\_order\_placed** - Trailing Take Profit order placed;\
**Panic\_sold** - Deal closed manually at market;\
**Failed** - Deal failed due to an error;\
**Liquidated** - Position liquidated;\
**Settled** - Contract expired on the exchange;\
**Close\_strategy\_activated** - Close strategy executed<br>

</details>

**localized\_status**     `string`\
&#x20;   Brief description of this status

<details>

<summary><em>Allowed value</em></summary>

* Active - ;
* Cancelled - Deal canceled;
* Completed - Deal closed successfully;
* Closed at Market Price - Deal closed manually at market;
* Base order placed - ;

</details>

**take\_profit\_type**     `string`\
Type of take profit calculation (e.g. `base`, `total`)

**take\_profit**     `number`\
Percentage value for the deal’s Take Profit

**take\_profit\_steps**     `object`\
Details of the Take Profit and its steps applied to this Deal

&#x20;     **id**     `string`\
&#x20;     \[TBD]

&#x20;     **amount\_percentage**     `string`\
&#x20;     \[TBD]

&#x20;     **profit\_percentage**     `string`\
&#x20;     The specific percentage of the price set to trigger this Take Profit trade

&#x20;     **editable**     `boolean`\
&#x20;     Indicates whether the user can modify the settings of trade when editing Deal (`true`) or not (`false`)

&#x20;     **panic\_sellable**     `boolean`\
&#x20;     \[TBD]

&#x20;     **trade\_id**     `string`\
&#x20;     Unique 3Commas Trade entity ID

&#x20;     **execution\_timestamp**     `string` or `null`\
&#x20;     The timestamp of when the deal was executed, in ISO 8601 format, or `null` if not yet executed

&#x20;     **initial\_amount**     `string`\
&#x20;     \[TBD]

&#x20;     **price**     `string`\
&#x20;     \[TBD]

&#x20;     **status**     `string`\
&#x20;     \[TBD]

**take\_profit\_price**     `string`\
\[TBD]

**base\_order\_volume**     `number`\
The volume of the base order for this Deal Bot

**leverage\_type**     `string`\
Type of leverage applied for this Deal<br>

<details>

<summary><em>Allowed value</em></summary>

* **cross** - uses all available funds in your account as collateral for your trades;
* **isolated** - the margin is limited to a specific position;
* **not\_specified** - no leverage type specified for deal;

</details>

**leverage\_custom\_value**     `string` or `null`\
The leverage value set by the user

**bought\_amount**     `string`\
The amount of the purchased asset

**bought\_volume**     `string`\
The volume of purchased assets in the base currency

**bought\_average\_price**     `string`\
The average price of the purchased asset

**base\_order\_average\_price**     `string`\
The average price of the base order

**sold\_amount**     `string`\
The amount of the sold asset

**sold\_volume**     `string`\
The volume of sold assets in the base currency

**sold\_average\_price**     `string`\
The average price at which the asset was sold

**final\_profit**: "-3.35618503", The final profit from the deal

**martingale\_coefficient**     `number`\
\[TBD]

**martingale\_volume\_coefficient**     `number`\
Coefficient for increasing *safety order volume* in Martingale strategy

**martingale\_step\_coefficient**     `number`\
Coefficient for increasing safety order price in Martingale strategy

**stop\_loss\_percentage**     `number`\
Stop loss percentage for this Deal

**sl\_to\_breakeven\_enabled**     `boolean`\
Indicates whether enables the Move to Breakeven feature for this Deal (`true`) or not (`false`)

**sl\_to\_breakeven\_data**     `json`\
The upper limit to which the stop loss will move Example: `{upper_breakeven_limit: 1}`

**error\_message**: null, Description of the error for this Deal if it fails

**profit\_currency**>     `string`\
Currency used for the profit from the trades executed by this bot

**stop\_loss\_type**     `string`\
Specifies the type of action the Deal performs when Stop Loss is triggered after closing a deal

**base\_order\_volume\_type**     `string`\
Volume type for base orders (e.g., `quote_currency`, `base_currency`, `percent`)

**from\_currency**: "USDT",\
\[TBD]

**to\_currency**: "ETH",\
\[TBD]

**final\_profit\_percentage**     `string`\
The final profit percentage from the deal

**usd\_final\_profit**     `string`\
The final profit expressed in USD

**actual\_profit**: "-7.69294593", \[TBD]

**actual\_usd\_profit**: "-7.69294593", \[TBD]

**failed\_message**: null, \[TBD]

**trailing\_deviation**     `number`\
Percentage value of the trailing price, in percent

**trailing\_max\_price**     `string` or `null`\
\[TBD]

**tsl\_max\_price**     `string` or `null`\
\[TBD]

**strategy**     `string`\
Type of strategy used by the bot: `long` or `short`

**last\_known\_position\_info**     `string` or `null`<br>

**min\_profit\_percentage**     `string`\
The minimum profit percentage needed to reach for completing a deal, applicable to the close strategy of Take Profit

**min\_profit\_type**     `string` or `null`\
The type of minimum profit used as the basis for profit calculation in this Deal, applicable to the close strategy of Take Profit

**close\_strategy\_list**     `array[json]`\
An array of strategies used for closing deal

**note**     `string`\
Optional user-defined note for this Deal

**add\_fundable**     `boolean`\
Indicates whether adding funds is available for this Deal (`true`) or (`not`)

**smart\_trade\_convertable**     `boolean`\
Indicates if this deal was converted to SmartTrade (`true`) or not (`false`)

**market\_type**: "spot", \[TBD] Type of strategy used by the bot (e.g., long, short)

**current\_price**: "2428.0", \[TBD]

**stop\_loss\_price**: null, \[TBD]

**actual\_profit\_percentage**     `string`\
\[TBD]

**reserved\_quote\_funds**     `string`\
\[TBD]

**reserved\_base\_funds**     `string`\
\[TBD]

**reserved\_base\_coin**:     `string`\
\[TBD]

**reserved\_second\_coin**     `string`\
\[TBD]

**orderbook\_price\_currency**: "USDT", \[TBD]

**crypto\_widget**     `object`<br>

**buy\_steps**     `array`<br>

**bot\_events**     `array`<br>

&#x20;     **message**       \[TBD]

&#x20;     **created\_at**       \[TBD]
