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

# SmartTrade

The **SmartTrade** allows users to open, manage, and close orders on the exchange with predefined conditions.

3Commas provides a set of methods to create and manage SmartTrade entities and their associated trade entities.

A **SmartTrade** entity holds information, including:

* Exchange account and trading pair;
* Position data;
* Conditions for Take Profit and Stop Loss;
* Conditions for closing at market;
* Conditions for reducing funds.

The process starts with a **SmartTrade** entity, where all conditions are configured. **SmartTrade** then manages trades, which are automatically created by 3Commas based on the conditions set within the SmartTrade entity.

**SmartTrade** can include the following trade types:

* Position trade;
* Take profit trade;
* Stop-loss trade;
* Reduce funds trade;
* Market close trade.

## Attributes<br>

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

**account**     `object`\
Details about user account

&#x20;   **id**     `integer`\
&#x20;   Unique 3Commas ID for this exchange account entity

&#x20;   **type**     `string`\
&#x20;   Exchange types where this SmartTrade was created

&#x20;   **name**     `string`\
&#x20;   Name of this exchange account

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

&#x20;   **link**     `string`\
&#x20;   The URL of the account where this SmartTrade was created

**pair**     string\
Trading pair in 3Commas format

**instant**    \`boolean\`\
\[TBD]

**status**     `object`\
The common status and information about this status for this SmartTrade entity

&#x20;   **basic\_type**     `string`\
&#x20;   3Commas status for this SmartTrade

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

&#x20;   **error**     `string`\
&#x20;   Description of the error for this SmartTrade if it fails

**leverage**     `object`\
Details of the leverage for this SmartTrade

&#x20;   **enabled**     `boolean`\
&#x20;   Information about this leverage for a futures account\
&#x20;   `false` if editing is not available

&#x20;   **type**     `string`\
&#x20;   Shows the leverage type that was set when creating a SmartTrade on a futures account

&#x20;   **value**     `number`\
&#x20;   Shows the leverage value that was set when creating a SmartTrade on a futures account

&#x20;   **type\_editable**     `boolean`\
&#x20;   Indicates whether the user can modify the `leverage[type]` settings when editing SmartTrade.\
&#x20;   `true` means editing is allowed

**position**     `object`\
Details of the Position applied to this SmartTrade

&#x20;   **type**     `string`\
&#x20;   The side of the order to be created by this trade

&#x20;   **editable**     `boolean`\
&#x20;   Indicates whether the user can modify the settings of position when editing SmartTrade.\
&#x20;   `true` if editing is available

&#x20;   **units**\
&#x20;   Details of Units

&#x20;       **value**     `string`\
&#x20;       Amount of units for position trade

&#x20;       **editable**     `boolean`\
&#x20;       Indicates whether the user can modify the value of the unit parameter when editing SmartTrade

&#x20;   **price**     `object`\
&#x20;   Details of price

&#x20;       **value**     `number`\
&#x20;       The price of the position order, including commission

&#x20;       **value\_without\_commission**     `number`\
&#x20;       The price of the position order, excluding commission

&#x20;       **editable**     `boolean`\
&#x20;       Indicates whether the user can modify the group of price settings parameters when editing SmartTrade

&#x20;   **total**     `number`\
&#x20;   The total value of the position, including all relevant factors such as price and quantity

&#x20;   **order\_type**     `string`\
&#x20;   The type of order used to open the position (e.g., \`market\`, \`limit\`, \`conditional\`)

&#x20;   **conditional**     `object`\
&#x20;   \[TBD]

&#x20;       **editable**     `boolean`\
&#x20;       Indicates whether the user can modify the settings of conditional of position when editing SmartTrade

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

&#x20;           **value**     `number`\
&#x20;           The specific price value set for the conditional order trigger

&#x20;           **type**     `string`\
&#x20;           The type of price for the conditional order used to open the position

&#x20;       **order\_type**     `string`\
&#x20;       The type of conditional order used to open the position\
&#x20;       (e.g., `market`, `limit`, `conditional`)

&#x20;       **trailing**     `object`\
&#x20;       \[TBD]

&#x20;           **editable**     `boolean`\
&#x20;           Indicates whether the trailing stop settings for the conditional order can be edited

&#x20;           **percent**     `number`\
&#x20;           The trailing stop percentage for the conditional order, specifying the distance from the market price at which the trailing stop is triggered

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

&#x20;   **enabled**     `boolean`\
&#x20;   Indicates whether the take profit settings for this SmartTrade can be edited

&#x20;   **price\_type**     `string`\
&#x20;   The price type for the take profit trade(s) that was set when creating the SmartTrade.\
&#x20;   Can be either `value` or `percentage`

&#x20;   **steps**     `array`\
&#x20;   Detailed conditions for each step of the Take Profit<br>

&#x20;       **id**     `integer`\
&#x20;       Unique 3Commas trade ID for this SmartTrade entity

&#x20;       **order\_type**     `string`\
&#x20;       The type of order for this trade's take profit

&#x20;       **editable**     `boolean`\
&#x20;       Indicates whether the step of take profit settings for this SmartTrade can be edited

&#x20;       **units\[value]**     `number`\
&#x20;       Amount of units for this trade

&#x20;       **price**     `object`\
&#x20;       Details of the price applied for one step of Take Profit

&#x20;           **type**     `integer`\
&#x20;           The type of price for the take profit order used to open the position

&#x20;           **value**     `number`\
&#x20;           The specific price value set to trigger the take profit order

&#x20;           **percent**     `number`\
&#x20;           The specific percentage of the price set to trigger this take profit trade

&#x20;       **trailing**     `object`\
&#x20;       Details of the trailing applied for one step of Take Profit

&#x20;           **editable**     `boolean`\
&#x20;           Indicates whether the trailing settings for the take profit in this SmartTrade can be edited

&#x20;           **percent**     `number`\
&#x20;           The specific trailing percentage applied to the price for this take profit trade

&#x20;       **status**     `object`\
&#x20;       Status of this the step of Take Profit. Set automatically by 3Commas

&#x20;           **basic\_type**     `string`\
&#x20;           3Commas status for this take profit trade

&#x20;           **title**     `string`\
&#x20;           Brief description of this status for this trade

&#x20;           **error**     `string`\
&#x20;           Error description for this take profit trade if it fails

&#x20;       **data**     `object`\
&#x20;       Available actions for one step Take Profit

&#x20;           **cancelable**     `integer`\
&#x20;           Indicates whether the take profit trade can be canceled

&#x20;           **panic\_sell\_available**     `boolean`\
&#x20;           Indicates whether the one step of Take Profit can be closed at market based on its current status

&#x20;       **position**     `string`\
&#x20;       Indicates the position of this take profit step for this SmartTrade

**stop\_loss**     `object`\
Details of the Stop Loss applied to this SmartTrade

&#x20;   **enabled**     `boolean`\
&#x20;   Indicates whether the stop loss settings for this SmartTrade can be edited

&#x20;   **price\_type**     `string`\
&#x20;   The price type for the stop loss trade(s) that was set when creating the SmartTrade.\
&#x20;   Can be either `value` or `percentage`

&#x20;   **breakeven**     `boolean`\
&#x20;   Indicates whether the stop loss has been set at the breakeven point

&#x20;   **order\_type**     `string`     The type of order for this trade's stop loss

&#x20;   **editable**     `boolean`\
&#x20;   Indicates whether the stop loss settings for this SmartTrade can be edited

&#x20;   **status**     `object`\
&#x20;   Status of this the step of Stop Loss. Set automatically by 3Commas

&#x20;        **basic\_type**     `string`\
&#x20;        3Commas status for this stop loss trade

&#x20;        **title**     `string`\
&#x20;        Brief description of this status for this trade

&#x20;        **error**     `string`\
&#x20;        Error description for this stop loss trade if it fails

&#x20;   **units**     `object`\
&#x20;   \[TBD]

&#x20;       **value**     `number`\
&#x20;       The specific price value set for the stope loss order trigger

&#x20;   **total**     `object`\
&#x20;   \[TBD]

&#x20;       **value**     `number`\
&#x20;       The total value of the stop loss trade

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

&#x20;       **value**     `number`\
&#x20;       \[TBD]

&#x20;   **conditional**     `object`\
&#x20;   \[TBD]

&#x20;       **price**     `object`\
&#x20;       Details of the price applied the Stop Loss

&#x20;           **type**     `string`\
&#x20;           The type of price for the stop loss order used to close the position

&#x20;           **value**     `number`\
&#x20;           The specific price value set to trigger the Stop Loss order

&#x20;           **percent**     `number`\
&#x20;           The specific percentage of the price set to trigger this Stop Loss trade

&#x20;       **trailing**     `object`\
&#x20;       Details of the trailing applied for one step of Stop Loss

&#x20;           **editable**     `boolean`\
&#x20;           Indicates whether trailing is enabled for the conditional stop loss

&#x20;           **percent**     `number`\
&#x20;           The trailing percentage for the conditional stop loss

&#x20;   **timeout**     `object`\
&#x20;   TBD

&#x20;       **enabled**     `boolean`\
&#x20;       Indicates whether the timeout setting for the stop loss is enabled

&#x20;       **value**     `integer`\
&#x20;       The value of the timeout setting for the stop loss trade

**reduce\_funds**     `array`\
Details of the Reduce Funds applied to this SmartTrade

&#x20;   **steps**     `array`\
&#x20;   \[TBD]

&#x20;       **id**     `integer`\
&#x20;       Unique 3Commas trade ID for this market close trade in the SmartTrade

&#x20;       **type**     `string`\
&#x20;       The order type for this reduce funds trade

&#x20;       **status**     `object`\
&#x20;       Detailed information about the status and any errors for a single Reduce Funds step

&#x20;           **basic\_type**     `string`\
&#x20;           3Commas status for this Reduce funds trade

&#x20;           **title**     `string`\
&#x20;           Brief description of this status for this trade

&#x20;           **error**     `string`\
&#x20;           Error description for this reduce funds trade if it fails

&#x20;       **units**     `object`\
&#x20;       \[TBD]

&#x20;           **value**     `number`\
&#x20;           Amount of units for this reduce funds trade

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

&#x20;           **value**     `number`\
&#x20;           The price of the reduce funds trade, including the commission

&#x20;           **value\_without\_commission**     `number`\
&#x20;           The price of the reduce funds trade, excluding commission

&#x20;       **total**     `object`\
&#x20;       \[TBD]

&#x20;           **value**     `integer`\
&#x20;           The total value of the reduce funds trade, including all relevant factors such as price\
&#x20;           and quantity

&#x20;       **data**     `object`\
&#x20;       Available actions for a single Reduce Funds step

&#x20;           **cancelable**     `boolean`\
&#x20;           Indicates whether the reduce funds trade can be canceled

&#x20;           **panic\_sell\_available**     `boolean`\
&#x20;           Indicates whether a drawdown transaction can be closed at market

**market\_close**     `object`\
Details of the Market Close applied to this SmartTrade

&#x20;   **id**     `integer`\
&#x20;   Unique 3Commas trade ID for this market close trade in the SmartTrade

&#x20;   **type**`integer`\
&#x20;   The type of order for this trade's market close

&#x20;   **status**`object`\
&#x20;   Detailed information about the status and any errors for this Market Clode

&#x20;       **basic\_type**     `string`\
&#x20;       The status type of the market close trade for this SmartTrade

&#x20;       **title**     `string`\
&#x20;       3Commas status for this market close trade

&#x20;       **error**     `string`\
&#x20;       Error description for this market close trade if it fails

&#x20;   **units**

&#x20;       **value**     `number`\
&#x20;       Amount of units for position trade

&#x20;   **price**

&#x20;       **value**     `number`\
&#x20;       The price of the market close trade, including commission

&#x20;       **value\_without\_commission**     `number`\
&#x20;       The price of the market close trade, excluding commission

&#x20;   **total**     `object`\
&#x20;   \[TBD]

&#x20;       **value**     `number`\
&#x20;       Indicates whether the reduce funds trade can be closed at market

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

**note\_raw**     `string`\
\[TBD]

**skip\_enter\_step**     `boolean`\
Shows whether the position opening step was skipped

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

**note\_raw**     `string`\
\[TBD]

**skip\_enter\_step**     `boolean`\
Shows whether the position opening step was skipped

**data**     `object`\
Available actions applicable to the entire SmartTrade entity

&#x20;   **editable**     `boolean`\
&#x20;   Indicates whether the user can modify the settings of this SmartTrade.\
&#x20;   `true` if editing is available

&#x20;   **current\_price**     `object`\
&#x20;   \[TBD]

&#x20;       **bid**     `number`\
&#x20;       The current highest bid price of the asset

&#x20;       **ask**     `number`\
&#x20;       The current lowest ask price of the asset

&#x20;       **last**     `number`\
&#x20;       The last traded price of the asset

&#x20;       **quote\_volume**     `number`\
&#x20;       \[TBD]

&#x20;       **day\_change\_percent**     `number`\
&#x20;       Percentage price change for the asset over the last 24 hours

&#x20;   **target\_price\_type**     `string`\
&#x20;   \[TBD]

&#x20;   **orderbook\_price\_currency**     `string`\
&#x20;   \[TBD]

&#x20;   **base\_order\_finished**     `boolean`\
&#x20;   \[TBD]

&#x20;   **missing\_funds\_to\_close**     `number`\
&#x20;   \[TBD]

&#x20;   **liquidation\_price**     `number`\
&#x20;   The liquidation price of the asset on the futures exchange

&#x20;   **average\_enter\_price**     `number`\
&#x20;   The average entering price of the asset with fees

&#x20;   **average\_close\_price**     `number`\
&#x20;   The average closing price of the asset with fees

&#x20;   **average\_enter\_price\_without\_commission**     `number`\
&#x20;   The average entering price of the asset without accounting for any fees

&#x20;   **average\_close\_price\_without\_commission**     `number`\
&#x20;   The average closing price of the asset without accounting for any fees

&#x20;   **panic\_sell\_available**     `boolean`\
&#x20;   Indicates whether the SmartTrade can be closed at market based on its current status

&#x20;   **add\_funds\_available**     `boolean`\
&#x20;   Indicates whether adding funds is available for this SmartTrade based on its current status

&#x20;   **reduce\_funds\_available**     `boolean`\
&#x20;   Indicates whether reducing funds is available for this SmartTrade based on its current status

&#x20;   **force\_start\_available**     `boolean`\
&#x20;   Indicates whether the option to force a market entry for the SmartTrade is available based on its current status

&#x20;   **force\_process\_available**     `boolean`\
&#x20;   Indicates whether the SmartTrade can be force processed

&#x20;   **cancel\_available**     `boolean`\
&#x20;   Indicates whether the SmartTrade can be canceled

&#x20;   **finished**     `boolean`\
&#x20;   Indicates whether the SmartTrade has been completed or finished.\
&#x20;   `true` means SmartTrade finished

&#x20;   **base\_position\_step\_finished**     `boolean`\
&#x20;   Shows whether entry into the position has been completed.\
&#x20;   `true` means the entry process is finished

&#x20;   **entered\_amount**     `number`\
&#x20;   The total amount of funds used to enter the position for this SmartTrade,\
&#x20;   including all additional funds trades, specified in base

&#x20;   **entered\_total**     `number`\
&#x20;   Total amount of funds used to enter the position for this SmartTrade, specified in quote

&#x20;   **closed\_amount**     `number`\
&#x20;   Total amount of SmartTrade closing volume in base

&#x20;   **closed\_total**     `number`\
&#x20;   Total amount of SmartTrade closing volume in quote

&#x20;   **commission**     `number`\
&#x20;   The trading fee of exchange for transaction

&#x20;   **created\_at**     `string <date-time>`\
&#x20;   ISO 8601 datetime string of when this SmartTrade entity was created

&#x20;   **updated\_at**     `string <date-time>` or `null`\
&#x20;   ISO 8601 datetime string of when this SmartTrade entity was updated

&#x20;   **type**     `string`\
&#x20;   Type of SmartTrade

**profit**     `object`\
Detailed information about the profit received on this SmartTrade

&#x20;   **volume**     `number`\
&#x20;   The total profit volume generated by this SmartTrade in quote

&#x20;   **usd**     `number`\
&#x20;   The total profit volume generated by this SmartTrade in USD

&#x20;   **percent**     `number`\
&#x20;   The total profit volume generated by this SmartTrade in percent

&#x20;   **roe**     `number` or `null`\
&#x20;   The return on equity (ROE) for this SmartTrade's profit, applicable only for futures accounts

**margin**    `object`\
Detailed information about the margin for this SmartTrade

&#x20;   **amount**    `number` or `null`\
&#x20;   The total margin amount required for this SmartTrade (base)

&#x20;   **total**    `number` or `null`\
&#x20;   The total margin value for this SmartTrade (quote)

**is\_position\_not\_filled**     `boolean`\
Indicates whether a position has been successfully entered for this SmartTrade<br>
