Creating New Bot

This endpoint allows you to create a new bot from scratch.

Create/update new bot

POST https://api.aitrade.com/api/bots

Request Body

Name
Type
Description

bot_id (only for updating bot)

(integer, optional)

Unique ID of the created bot (only for the update bot API).

user_id

integer

A unique ID to identify the user

exchange_pair_id

integer

A unique ID to identify the pair.

initial_fund

float

Fund allocation for the bot

name

string

A name to identify the bot created

strategy

string

Options are Long, Short .

base_order_percentage

integer

Percentage of Fund used for the base order

extra_order_percentage

integer

Remaining Fund not used in base order are used to create extra orders. The number indicates percentage used for the next order.

base_order_type

string

Options static, dynamic. Static will always use the same Base Order Limit set, regardless of the bots performance. Dynamic allows the bot to use profits from it’s previous trades for it’s next trade or lowers the base order if it has encountered a loss previously

order_type

string

Options are limit,market . Limit order is normally used to ensure price level especially when your take profit level is small. Market order is typically used when you need to ensure immediate Filled condition

frequency

integer

options are, 1,5,15,60,240,1440

profit

float

Take profit percentage

stop_loss

float

Stop loss percentage

bot_indicators

Object

An object containing the indicators.Please refer to Bot Indicator Parameter Sample

indicator_triggers_entry

integer

Number of entry indicators

indicator_triggers_exit

integer

Number of exit indicators

Bot Indicators parameters

  1. RSI and Stock RSI

Name
Meaning
Value range
Example

period_num

Number of candles

2-50

14

value2

Buy Level for Base Order

0-100

30

value3

Sell Level for Base Order

0-100

70

value4

Activate Trailing Flag

0 or 1

1

value5

Buy Level for Extra Order

0-100

25

value6

Sell Level for Extra Order

0-100

75

value7

Average Level for Base Order

0-10

5

value8

Average Level for Extra Order

0-10

5

value9

Entry Reverse Cross Direction Flag

0 or 1

0

value10

Exit Reverse Cross Direction Flag

0 or 1

0

is_compulsory

Whether this indicator must hit in the group or not

0 or 1

0

  1. Bollinger Band

Name
Meaning
Value range
Example

period_num

Number of candles

14-50

20

value2

Lower Band Standard Deviation

2-20

2

value3

Upper Band Standard Deviation

2-20

2

is_compulsory

Whether this indicator must hit in the group or not

0, 1

0

  1. EMA

Name
Meaning
Value Range
Example

period_num

Number of candles

10-100

50

value2

Short period

2-20

9

is_compulsory

Whether this indicator must hit in the group or not

0, 1

0

  1. MACD

Name
Meaning
Value Range
Example

period_num

Fast Period

2-50

12

value2

Slow period

2-50

26

value3

Signal period

2-50

9

is_compulsory

Whether this indicator must hit in the group or not

0, 1

0

  1. Volume

Name
Meaning
Value Range
Example

period_num

Number of candles

0-50

2

value2

Minimum volume

is_compulsory

Whether this indicator must hit in the group or not

0, 1

0

Bot Indicator Parameter Sample in api

Both exit and entry indicators are send together as an array of an object

[
   {
        "id": null, // Id null when creating new and is returned after creating bot. Has to pass id when updating 
        "name": "EMA",
        "description": null,
        "period_num": 50,
        "value2": 9,
        "value3": null,
        "value4": null,
        "value5": null,
        "value6": null,
        "updated_at": null,
        "created_at": null,
        "indicator_id": 2,
        "ind_key": 5414,
        "type": "entry"
    },
    {
        "id": null,
        "name": "Stochastic RSI",
        "description": null,
        "period_num": 14,
        "value2": 18.5,
        "value3": 81.5,
        "value4": 1,
        "value5": 18.5,
        "value6": 81.5,
        "updated_at": null,
        "created_at": null,
        "indicator_id": 3,
        "ind_key": 1940,
        "type": "exit"
    }
]

Responses:

  • Success (200): Returns the details of the bot created or updated including ID, name, status, and other specific settings.

  • Failure (401): Unauthenticated, indicating you're not logged in or lack permission to carry out the request.

{
    "code": 200,
    "message": "Success",
    "bot": {
        "id": 13331,
        "user_id": 1,
        "name": "New Bot",
        "status": "active",
        "frequency": 15,
        "exchange_pair_id": 2,
        "strategy": "Long",
        "initial_fund": 1000,
        "base_order_percentage": 50,
        "base_order_type": "static",
        "extra_order_percentage": 25,
        "stop_loss": 0,
        "back_test_time_frame": 365,
        "updated_at": "2024-03-26 16:13:59",
        "created_at": "2024-03-26 16:13:59",
        "indicator_triggers_entry": 1,
        "indicator_triggers_exit": 1,
        "pair_id": 1,
        "exchange_id": 0,
        "min_tp": 0,
        "order_type": "market"
    }
}

Last updated