Skip to main content

private/bot/create-trading-bot (TWAP)

POST 

/private/bot/create-trading-bot

Creates a new TWAP (Time-Weighted Average Price) Trading Bot that executes large orders by splitting them into smaller slices over a defined time window to minimise market impact.

Request

Body

required
    id int64required

    Request id (echoed in response)

    method stringrequired

    Must be "private/bot/create-trading-bot"

    api_key stringrequired

    Your API key (only required for private REST)

    sig stringrequired

    HMAC-SHA256 signature in hex (only required for private REST)

    nonce int64required

    Current timestamp in milliseconds, e.g. "1610905028000".

    params objectrequired
    bot_type BotType (string)required

    Possible values: [DCA, TWAP, GRID, FUNDING_ARBITRAGE]

    Trading bot type:

    • DCA: Dollar Cost Averaging
    • TWAP: Time-Weighted Average Price
    • GRID: Grid trading
    • FUNDING_ARBITRAGE: Funding arbitrage
    notify_on_bot_change booleanrequired

    Whether to receive push notifications on bot state changes

    display_name string

    Display name of the trading bot. 4-15 characters; letters, numbers,

    settings object required
    Bot-type-specific settings. Schema depends on bot_type parameter
    oneOf
    is_basket booleanrequired

    Whether this is a basket DCA bot (multiple instruments)

    allocations object[]required
    Array of instrument allocations
  • Array [
  • instrument_name stringrequired

    Instrument name

    allocated_percentage decimalrequired

    Percentage allocated (must sum to 100 across all allocations)

  • ]
  • investment_currency stringrequired

    Currency used for investment

    side string

    Possible values: [BUY, SELL]

    BUY or SELL. Required when is_basket is false

    type string

    Possible values: [MARKET, LIMIT]

    MARKET or LIMIT. Required when is_basket is false

    auto_stake boolean

    Whether to automatically stake earned tokens. Required when is_basket is false

    price decimal

    Limit price. Required when type is LIMIT

    quantity decimal

    Quantity per order. Either quantity or total_investment is required

    total_investment decimal

    Total investment amount. Either quantity or total_investment is required

    investment_frequency_mode InvestmentFrequencyMode (string)required

    Possible values: [FIXED_DURATION, MONTHLY]

    Investment frequency mode for DCA bots:

    • FIXED_DURATION: Fixed interval in milliseconds
    • MONTHLY: Monthly investment
    investment_frequency int64

    Interval between orders in milliseconds. Required when investment_frequency_mode is FIXED_DURATION

    first_investment_time int64

    Unix timestamp in milliseconds for the first order

    investment_duration int64

    Total duration. In number of months when investment_frequency_mode is MONTHLY; in milliseconds when FIXED_DURATION.

    max_order string

    Maximum number of orders to place

    stop_price decimal

    Stop-loss price. Not supported for basket bots

    take_profit_price decimal

    Take-profit price. Not supported for basket bots

    simplified_mode boolean

    Whether to use simplified mode

Success.
Schema
    id int64

    Original request identifier

    method string

    Method name

    code int32

    0 for success; error code otherwise

    message string

    Error message for non-zero codes

    result object
    bot_id string

    Newly created Trading Bot ID