NAV Navbar
  • ABOUT ChangellyPRO API
  • DEVELOPMENT GUIDE
  • RATE LIMITING
  • Change Log
  • BEST PRACTICES
  • REST API Reference
  • Market Data
  • Authentication
  • Authentication HS256
  • Spot Trading
  • Spot Trading History
  • Margin Trading
  • Margin Trading History
  • Futures Trading
  • Futures Trading History
  • Wallet Management
  • Sub-accounts
  • Socket API Reference
  • Socket Market Data
  • Socket Session Authentication
  • Socket Trading
  • Socket Spot Trading
  • Socket Margin Trading
  • Socket Futures Trading
  • Socket Wallet Management
  • Errors
  • ABOUT ChangellyPRO API

    ChangellyPRO REST & Streaming API version 3.0 provides programmatic access to ChangellyPRO’s next generation trading engine.

    We strongly recommend that our new customers use API version 3.0 to get the best trading experience. We also recommend that our current traders switch to the newest version 3.0.

    API version 2.0 is still available. For detailed description refer to API v2.

    DEVELOPMENT GUIDE

    API URLs

    REST https://api.pro.changelly.com/api/3
    Streaming Market Data wss://api.pro.changelly.com/api/3/ws/public
    Streaming Trading wss://api.pro.changelly.com/api/3/ws/trading
    Streaming Wallet wss://api.pro.changelly.com/api/3/ws/wallet

    API Explorer

    You can explore the API using SwaggerUI including methods requiring authorization.

    DateTime Format

    All timestamps are returned in ISO 8601 format or UNIX timestamp in milliseconds (UTC).
    Example: "2021-06-03T10:20:49.315Z" or "1614815872000".

    Number Format

    All finance data, e.g., price, quantity, fee, etc., should be arbitrary precision numbers and have a string representation.
    Example: "10.2000058".

    Pagination

    Parameters:

    Parameter Description
    limit Number of results per call.
    offset Number of results offset.
    sort Sort direction.
    Accepted values: ASC (ascending order), DESC (descending order)
    by Filter type.
    Accepted values: id, timestamp
    from Interval initial value.
    If filter by timestamp is used, then parameter type is DateTime, otherwise — Number.
    till Interval end value.
    If filter by timestamp is used, then parameter type is DateTime, otherwise — Number.

    RATE LIMITING

    The following Rate Limits are applied:

    Significantly exceeding the Rate Limits can lead to suspension.

    Change Log

    23.11.2021

    19.11.2021

    10.11.2021

    25.08.2021

    24.08.2021

    30.07.2021

    28.07.2021

    BEST PRACTICES

    The ChangellyPRO API development team strives to bring the best trading experience to API users. This manual contains a set of best practices for using the API as efficiently as possible.

    HTTP Persistent Connection

    The underlying TCP connection is kept active for multiple requests/responses. Subsequent requests will result in reduced latency as the TCP handshaking process is no longer required.

    If you use the HTTP 1.0 client, please ensure it supports the Keep-Alive directive and submit the "Connection: Keep-Alive" header with your request.

    Keep-Alive is a part of the HTTP/1.1 or HTTP/2 protocol and enabled by default on compliant clients. However, you will have to ensure your implementation does not set other values as the connection header.

    Retrieving and Updating Account State

    Use the Streaming API for real-time updates of your orders, trades, and any transaction changes.

    REST API Reference

    HTTP Status Codes

    Error Response

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, taken into account the commissions"
        }
    }
    

    All error responses have error code and human readable message fields. Some errors contain an additional description field.

    Market Data

    Currencies

    Get Currencies

    curl "https://api.pro.changelly.com/api/3/public/currency"
    

    Response:

    {
        "BTC": {
            "full_name":"Bitcoin",
            "payin_enabled":true,
            "payout_enabled":true,
            "transfer_enabled":true,
            "precision_transfer":"0.00000001",
            "networks": [
              {
                "network":"btc",
                "protocol":"",
                "default":true,
                "payin_enabled":true,
                "payout_enabled":true,
                "precision_payout":"0.00000001",
                "payout_fee":"0.000900000000",
                "payout_is_payment_id":false,
                "payin_payment_id":false,
                "payin_confirmations":1,
                "low_processing_time":"21.709",
                "high_processing_time":"3639.385",
                "avg_processing_time":"421.6391704545454"
              }
            ]
          },
          "USDT": {
            "full_name": "Tether",
            "payin_enabled": true,
            "payout_enabled": true,
            "transfer_enabled": true,
            "precision_transfer": "0.01",
            "networks": [
              {
                "network": "BTC",
                "protocol": "OMNI",
                "default": true,
                "payin_enabled": true,
                "payout_enabled": true,
                "precision_payout": "0.01",
                "payout_fee": "45.000000000000",
                "payout_is_payment_id": false,
                "payin_payment_id": false,
                "payin_confirmations": 2,
                "low_processing_time": "3.291",
                "high_processing_time": "1495.602",
                "avg_processing_time": "85.98873076923078"
              }
            ]
        }
    }
    

    GET /api/3/public/currency

    Returns the actual list of available currencies, tokens, etc.

    You can optionally use a comma-separated list of currencies. If it is not provided, null or empty, the request returns all currencies.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    currencies String Optional. Comma-separated list of currency codes.

    Response:

    Name Type Description
    full_name String Currency full name (e.g., "Bitcoin").
    payin_enabled Boolean Determines whether it is allowed to generate addresses for a deposit.
    payout_enabled Boolean Determines whether withdrawal is allowed.
    transfer_enabled Boolean Determines whether transfer between trading account and wallet account is allowed (may be disabled on maintenance).
    precision_transfer Number Currency precision for transfer (accepted number of digits after the decimal point).
    networks Array of Network A list of the networks used for processing currency-related transactions.

    Network model consists of:

    Name Type Description
    network String Name of the network.
    protocol String Optional. Token underlying standard. Specified for tokens, for example, "ERC20".
    default Boolean Determines whether a network is used by default for processing currency-related transactions.
    payin_enabled Boolean Determines whether it is allowed to generate addresses for a deposit.
    payout_enabled Boolean Determines whether withdrawal is allowed.
    precision_payout Number Currency precision for payout (accepted number of digits after the decimal point).
    payout_fee Number Optional. Default withdrawal fee.
    payout_is_payment_id Boolean Determines whether providing additional information for withdrawal is allowed.
    payin_payment_id Boolean Determines whether it is required to provide additional information other than the address for deposit.
    payin_confirmations Number Count of blocks confirmations, which are needed for deposit.
    address_regex String Optional. Regular expression to address string.
    payment_id_regex String Optional. Regular expression to payment ID string.
    low_processing_time Number Optional. The lowest processing time in seconds for payout operation.
    high_processing_time Number Optional. The highest processing time in seconds for payout operation.
    avg_processing_time Number Optional. The average processing time in seconds for payout operation.

    Get Currency

    curl "https://api.pro.changelly.com/api/3/public/currency/BTC"
    

    Response:

    {
        "full_name":"Bitcoin",
        "payin_enabled":true,
        "payout_enabled":true,
        "transfer_enabled":true,
        "precision_transfer":"0.00000001",
        "networks": [
          {
            "network":"btc",
            "protocol":"",
            "default":true,
            "payin_enabled":true,
            "payout_enabled":true,
            "precision_payout":"0.00000001",
            "payout_fee":"0.000900000000",
            "payout_is_payment_id":false,
            "payin_payment_id":false,
            "payin_confirmations":1,
            "low_processing_time":"21.709",
            "high_processing_time":"3639.385",
            "avg_processing_time":"421.6391704545454"
          }
        ]
    }
    

    GET /api/3/public/currency/{currency}

    Returns the data for a certain currency.

    Requires no API key Access Rights.

    Response:

    Name Type Description
    full_name String Currency full name (e.g., "Bitcoin").
    payin_enabled Boolean Determines whether it is allowed to generate addresses for a deposit.
    payout_enabled Boolean Determines whether withdrawal is allowed.
    transfer_enabled Boolean Determines whether transfer between trading account and wallet account is allowed (may be disabled on maintenance).
    precision_transfer Number Currency precision for transfer (accepted number of digits after the decimal point).
    networks Array of Network A list of the networks used for processing currency-related transactions.

    Symbols

    Get Symbols

    curl "https://api.pro.changelly.com/api/3/public/symbol"
    

    Response:

    {
        "ETHBTC": {
            "type": "spot",
            "base_currency": "ETH",
            "quote_currency": "BTC",
            "quantity_increment": "0.001",
            "tick_size": "0.000001",
            "take_rate": "0.001",
            "make_rate": "-0.0001",
            "fee_currency": "BTC",
            "margin_trading": true,
            "max_initial_leverage": "10.00"
        }
    }
    

    GET /api/3/public/symbol

    Returns the actual list of currency symbols (currency pairs) traded on exchange. The first listed currency of a symbol is called the base currency, and the second currency is called the quote currency. The currency pair indicates how much of the quote currency is needed to purchase one unit of the base currency. Read more

    You can optionally use a comma-separated list of symbols. If it is not provided, null or empty, the request returns all symbols.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    symbols String Comma-separated list of symbol codes.

    Response:

    Name Type Description
    type String Symbol type.
    Possible values: spot, futures
    expiry DateTime or null Futures expiration date.
    null for perpetual contracts.
    underlying String Futures contract underlying asset.
    base_currency String or null Name (code) of base currency, (e.g., "ETH"). For futures contracts is null.
    quote_currency String Name (code) of quote currency.
    quantity_increment Number Symbol quantity should be divided by this value with no remainder.
    tick_size Number Symbol price should be divided by this value with no remainder.
    take_rate Number Default fee rate.
    make_rate Number Default fee rate for market making trades.
    fee_currency String Currency in which fees are determined.
    margin_trading Boolean Whether margin trading is available.
    max_initial_leverage Number Optional. Maximum leverage that the user can use for margin trading. Shown only if margin_trading is true.

    Get Symbol

    curl "https://api.pro.changelly.com/api/3/public/symbol/ETHBTC"
    

    Response:

    {
        "type": "spot",
        "base_currency": "ETH",
        "quote_currency": "BTC",
        "quantity_increment": "0.0001",
        "tick_size": "0.000001",
        "take_rate": "0.002",
        "make_rate": "0.001",
        "fee_currency": "BTC",
        "margin_trading": true,
        "max_initial_leverage": "10.00"
    }
    

    GET /api/3/public/symbol/{symbol}

    Returns the data for a certain symbol.

    Requires no API key Access Rights.

    Response:

    Name Type Description
    type String Symbol type.
    Possible values: spot, futures
    expiry DateTime or null Futures expiration date.
    null for perpetual contracts.
    underlying String Futures contract underlying asset.
    base_currency String or null Name (code) of base currency, (e.g., "ETH"). For futures contracts is null.
    quote_currency String Name (code) of quote currency.
    quantity_increment Number Symbol quantity should be divided by this value with no remainder.
    tick_size Number Symbol price should be divided by this value with no remainder.
    take_rate Number Default fee rate.
    make_rate Number Default fee rate for market making trades.
    fee_currency String Currency in which fees are determined.
    margin_trading Boolean Whether margin trading is available.
    max_initial_leverage Number Optional. Maximum leverage that the user can use for margin trading. Shown only if margin_trading is true.

    Tickers

    Get Tickers

    curl "https://api.pro.changelly.com/api/3/public/ticker"
    

    Response:

    {
        "ETHBTC": {
            "ask": "0.050043",
            "bid": "0.050042",
            "last": "0.050042",
            "low": "0.047052",
            "high": "0.051679",
            "open": "0.047800",
            "volume": "36456.720",
            "volume_quote": "1782.625000",
            "timestamp": "2021-06-12T14:57:19.999Z"
        }
    }
    

    GET /api/3/public/ticker

    Returns ticker information.

    You can optionally use a comma-separated list of symbols. If it is not provided, null or empty, the request returns tickers for all symbols.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    symbols String Optional. Comma-separated list of symbol codes.

    Response:

    Name Type Description
    ask Number or null Best ask price. Can return null if no data.
    bid Number or null Best bid price. Can return null if no data.
    last Number or null Last trade price. Can return null if no data.
    low Number The lowest trade price within 24 hours.
    high Number The highest trade price within 24 hours.
    open Number or null Last trade price 24 hours ago. Can return null if no data.
    volume Number Total trading amount within 24 hours in base currency.
    volume_quote Number Total trading amount within 24 hours in quote currency.
    timestamp DateTime Last update or refresh ticker timestamp.

    Get Ticker by Symbol

    curl "https://api.pro.changelly.com/api/3/public/ticker/ETHBTC"
    

    Response:

    {
        "ask": "0.020572",
        "bid": "0.020566",
        "last": "0.020574",
        "low": "0.020388",
        "high": "0.021084",
        "open": "0.020913",
        "volume": "138444.3666",
        "volume_quote": "2853.6874972480",
        "timestamp": "2021-06-02T17:52:36.731Z"
    }
    

    GET /api/3/public/ticker/{symbol}

    Returns the ticker for a certain symbol.

    Requires no API key Access Rights.

    Response:

    Name Type Description
    ask Number or null Best ask price. Can return null if no data.
    bid Number or null Best bid price. Can return null if no data.
    last Number or null Last trade price. Can return null if no data.
    low Number The lowest trade price within 24 hours.
    high Number The highest trade price within 24 hours.
    open Number or null Last trade price 24 hours ago. Can return null if no data.
    volume Number Total trading amount within 24 hours in base currency.
    volume_quote Number Total trading amount within 24 hours in quote currency.
    timestamp DateTime Last update or refresh ticker timestamp.

    Prices

    Get Prices

    curl "https://api.pro.changelly.com/api/3/public/price/rate?from=ETH&to=BTC"
    

    Response:

    {
        "ETH":{
            "currency": "BTC",
            "price": "0.021084",
            "timestamp": "2021-06-02T17:52:36.731Z"
        }
    }
    

    GET /api/3/public/price/rate

    Returns currencies quotation prices.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    from String Source currency code.
    to String Target currency code.

    Response:

    Name Type Description
    currency String Quote currency code.
    price Number Quotation price.
    timestamp DateTime Last update or refresh price timestamp.

    Get Prices History

    curl "https://api.pro.changelly.com/api/3/public/price/history?from=ETH&to=BTC"
    

    Response:

    {
        "ETH":{
            "currency": "BTC",
            "history":{
                "timestamp": "2021-07-01T20:00:00.000Z",
                "open": "0.063420",
                "close": "0.063767",
                "min": "0.063403",
                "max": "0.063782"
            }
        }
    }
    

    GET /api/3/public/price/history

    Returns quotation prices history.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    from String Source currency code.
    to String Target currency code.
    until DateTime Optional. Interval end value.
    since DateTime Optional. Interval initial value.
    limit Number Optional. Default value: 1
    Accepted values: 1 – 1000
    period String Optional. Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    sort String Optional. Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC

    Response:

    Name Type Description
    currency String Quote currency code.
    history History Quotation price history entry.

    History model consists of:

    Name Type Description
    timestamp DateTime Last update or refresh price timestamp.
    open Number Open price.
    close Number Closing price.
    min Number The lowest price for the period.
    max Number The highest price for the period.

    Get Ticker Last Prices

    curl "https://api.pro.changelly.com/api/3/public/price/ticker"
    

    Response:

    {
        "ETHBTC": {
            "price": "0.050042",
            "timestamp": "2021-06-12T14:57:19.999Z"
        }
    }
    

    GET /api/3/public/price/ticker

    Returns tickers' last prices for all symbols.

    You can optionally use a comma-separated list of symbols. If it is not provided, null or empty, the request returns tickers' last prices for all symbols.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    symbols String Optional. Comma-separated list of symbol codes.

    Response:

    Name Type Description
    price Number Ticker last price.
    timestamp DateTime Last update or refresh ticker timestamp.

    Get Ticker Last Price by Symbol

    curl "https://api.pro.changelly.com/api/3/public/price/ticker/ETHBTC"
    

    Response:

    {
        "price": "0.021084",
        "timestamp": "2021-06-02T17:52:36.731Z"
    }
    

    GET /api/3/public/price/ticker/{symbol}

    Returns the ticker last price for a certain symbol.

    Requires no API key Access Rights.

    Response:

    Name Type Description
    price Number Ticker last price.
    timestamp DateTime Last update or refresh ticker timestamp.

    Trades

    Get Trades

    curl "https://api.pro.changelly.com/api/3/public/trades"
    

    Response:

    {
        "BTCUSDT":[
            {
                "id":782135488,
                "price":"9793.94",
                "qty":"0.21469",
                "side":"sell",
                "timestamp":"2021-06-24T12:54:41.972Z"
            }
        ],
        "ETHBTC":[
            {
                "id":782135414,
                "price":"0.027668",
                "qty":"0.069",
                "side":"buy",
                "timestamp":"2021-06-24T12:54:32.843Z"
            }
        ]
    }
    

    GET /api/3/public/trades

    Returns trades information for all or multiple symbols.

    You can optionally use a comma-separated list of symbols. If it is not provided, null or empty, the request returns trades for all symbols.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    symbols String Comma-separated list of symbol codes.
    by String Filter type.
    Accepted values: id, timestamp
    Default value: timestamp
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    from DateTime or Number Interval initial value.
    If sorting by timestamp is used, then DateTime, otherwise — Number.
    till DateTime or Number Interval end value.
    If sorting by timestamp is used, then DateTime, otherwise — Number.
    limit Number Default value: 10
    Accepted values: 1 – 1000

    Response:

    Name Type Description
    id Number Trade identifier.
    price Number Trade price.
    qty Number Trade quantity.
    side String Trade side.
    Accepted values: sell, buy
    timestamp DateTime Trade timestamp.

    Get Trades by Symbol

    curl "https://api.pro.changelly.com/api/3/public/trades/ETHBTC?sort=DESC"
    

    Response:

    [
        {
            "id": 9533117,
            "price": "0.046001",
            "qty": "0.220",
            "side": "sell",
            "timestamp": "2021-06-14T12:18:40.426Z"
        },
        {
            "id": 9533116,
            "price": "0.046002",
            "qty": "0.022",
            "side": "buy",
            "timestamp": "2021-06-14T11:56:37.027Z"
        }
    ]
    

    GET /api/3/public/trades/{symbol}

    Returns trades information for a certain symbol.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    by String Filter type.
    Accepted values: id, timestamp
    Default value: timestamp
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    from DateTime or Number Optional. Interval initial value.
    If sorting by timestamp is used, then DateTime, otherwise — Number.
    till DateTime or Number Optional. Interval end value.
    If sorting by timestamp is used, then DateTime, otherwise — Number.
    limit Number Default value: 100
    Accepted values: 1 – 1000
    offset Number Default value: 0
    Accepted values: 0 – 100000

    Response:

    Name Type Description
    id Number Trade identifier.
    price Number Trade price.
    qty Number Trade quantity.
    side String Trade side.
    Possible values: sell, buy
    timestamp DateTime Trade timestamp.

    Order Books

    Get Order Books

    curl "https://api.pro.changelly.com/api/3/public/orderbook"
    

    Response:

    {
        "BTCUSDT": {
            "timestamp": "2021-06-11T11:18:03.857366871Z",
            "ask": [
              [
                "9777.51",                      // Price
                "4.50579"                       // Amount
              ],
              [
                "9777.52",
                "5.79832"
              ]
            ],
            "bid": [
              [
                "9777.5",
                "0.00002"
              ],
              [
                "9776.26",
                "0.0001"
              ]
            ]
          },
          "ETHBTC": {
            "timestamp": "2021-06-11T11:18:03.790858502Z",
            "ask": [
              [
                "0.022626",
                "0.0057"
              ],
              [
                "0.022628",
                "1.4259"
              ]
            ],
            "bid": [
              [
                "0.022624",
                "0.5748"
              ],
              [
                "0.022623",
                "26.5"
              ]
            ]
        }
    }
    

    GET /api/3/public/orderbook

    An Order Book is a list of buy and sell orders for a specific symbol, structured by price level.

    You can optionally use a comma-separated list of symbols. If it is not provided, null or empty, the request returns an Order Book for all symbols.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    depth Number Optional. Order Book depth.
    Default value: 100
    Set to 0 to view the full Order Book.
    symbols String Optional. Comma-separated list of symbol codes.

    Response:

    Name Type Description
    timestamp DateTime Order timestamp.
    ask Array Ask side array of levels.
    bid Array Bid side array of levels.

    Get Order Book by Symbol

    curl "https://api.pro.changelly.com/api/3/public/orderbook/ETHBTC?volume=0.5"
    

    Response:

    {
        "timestamp": "2021-06-11T11:30:38.597950917Z",
        "ask": [
          [
            "9779.68",                          // Price
            "2.497"                             // Quantity
          ]
        ],
        "bid": [
          [
            "9779.67",
            "0.03719"
          ],
          [
            "9779.29",
            "0.171"
          ],
          [
            "9779.27",
            "0.171"
          ],
          [
            "9779.21",
            "0.171"
          ]
        ]
    }
    

    GET /api/3/public/orderbook/{symbol}

    The request returns an Order Book for a certain symbol.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    depth Number Optional. Order Book depth.
    Default value: 100
    Set to 0 to view the full Order Book.
    volume Number Optional. Desired volume for market depth search.

    Please note that if the volume is specified, the depth will be ignored.

    Response:

    Name Type Description
    timestamp DateTime Order timestamp.
    ask Array Ask side array of levels.
    bid Array Bid side array of levels.

    Candles

    Get Candles

    curl "https://api.pro.changelly.com/api/3/public/candles"
    

    Response:

    {
        "BTCUSDT":[
          {
            "timestamp": "2021-07-01T20:00:00.000Z",
            "open": "33079.93",
            "close": "33236.53",
            "min": "33079.93",
            "max": "33295.73",
            "volume": "146.86223",
            "volume_quote": "4877838.3025063"
          }
       ],
       "ETHBTC":[
          {
            "timestamp": "2021-07-01T20:00:00.000Z",
            "open": "0.063420",
            "close": "0.063767",
            "min": "0.063403",
            "max": "0.063782",
            "volume": "866.6776",
            "volume_quote": "55.2132903904"
          }
        ]
    }
    

    GET /api/3/public/candles

    Candles are used for the representation of a specific symbol as an OHLC chart.

    You can optionally use a comma-separated list of symbols. If it is not provided, null or empty, the request returns candles for all symbols.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    symbols String Comma-separated list of symbol codes.
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 10
    Accepted values: 1 – 1000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open price.
    close Number Closing price.
    min Number The lowest price for the period.
    max Number The highest price for the period.
    volume Number Volume in base currency.
    volume_quote Number Volume in quote currency.

    Get Candles by Symbol

    curl "https://api.pro.changelly.com/api/3/public/candles/ETHBTC"
    

    Response:

    [
        {
            "timestamp": "2021-06-20T20:00:00.000Z",
            "open": "0.050459",
            "close": "0.050087",
            "min": "0.050000",
            "max": "0.050511",
            "volume": "1326.628",
            "volume_quote": "66.555987736"
        },
        {
            "timestamp": "2021-06-20T20:30:00.000Z",
            "open": "0.050108",
            "close": "0.050139",
            "min": "0.050068",
            "max": "0.050223",
            "volume": "87.515",
            "volume_quote": "4.386062831"
        }
    ]
    

    GET /api/3/public/candles/{symbol}

    Returns candles for a certain symbol.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Accepted values: 1 – 1000
    offset Number Default value: 0
    Accepted values: 0 – 100000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open price.
    close Number Closing price.
    min Number The lowest price for the period.
    max Number The highest price for the period.
    volume Number Volume in base currency.
    volume_quote Number Volume in quote currency.

    Futures Info

    Get Futures Information

    curl "https://api.pro.changelly.com/api/3/public/futures/info"
    

    Response:

    {
        "BTCUSDT_PERP": {
            "mark_price": "30897.68",
            "index_price": "30895.29",
            "funding_rate": "0.0001",
            "open_interest": "93.7128",
            "next_funding_time": "2021-07-21T16:00:00.000Z",
            "indicative_funding_rate": "0.0001",
            "premium_index": "0.000047541807127312",
            "avg_premium_index": "0.000087063368020112",
            "interest_rate": "0.0001",
            "timestamp": "2021-07-21T09:48:37.235Z"
        },
        "EOSETH_PERP": {
            "mark_price":"0.0020600",
            "index_price":"0.0020600",
            "funding_rate":"0.0001",
            "open_interest":"60.6580",
            "next_funding_time":"2021-05-25T16:00:00.000Z",
            "indicative_funding_rate":"0.0001",
            "premium_index":"0.1045547",
            "avg_premium_index":"0.1004467",
            "interest_rate": "0.0001",
            "timestamp":"2021-05-25T14:43:20.079Z"
        }
    }
    

    GET /api/3/public/futures/info

    Returns futures information for all or multiple contracts.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    symbols String Optional. Comma-separated list of contract codes.

    Response:

    Name Type Description
    mark_price String Recent asset price adjusted by the value of fair basis.
    index_price String Average underlying asset price.
    funding_rate String Percentage of contract mark value paid after the end of current funding interval.
    open_interest String Total quantity of traded futures contracts.
    next_funding_time DateTime Timestamp of the next funding.
    indicative_funding_rate String Estimated value of funding_rate in the next funding period calculated at the moment.
    premium_index String Time-weighted average over premium indexes from the previous funding to the moment. Used during calculation of indicative_funding_rate.
    avg_premium_index String Time-weighted average over premium indexes for previous funding period. Used during calculation of funding_rate for adjusting it to the deviation of contract market price from the mark price.
    interest_rate String Contract interest rate for one funding period.
    timestamp DateTime Request timestamp.

    Get Futures Information for Contract

    curl "https://api.pro.changelly.com/api/3/public/futures/info/BTCUSDT_PERP"
    

    Response:

    {
        "BTCUSDT_PERP": {
            "mark_price": "30897.68",
            "index_price": "30895.29",
            "funding_rate": "0.0001",
            "open_interest": "93.7128",
            "next_funding_time": "2021-07-21T16:00:00.000Z",
            "indicative_funding_rate": "0.0001",
            "premium_index": "0.000047541807127312",
            "avg_premium_index": "0.000087063368020112",
            "interest_rate": "0.0001",
            "timestamp": "2021-07-21T09:48:37.235Z"
        }
    }
    

    GET /api/3/public/futures/info/{symbol}

    Returns futures information for a specified contract.

    Requires no API key Access Rights.

    Response:

    Name Type Description
    mark_price String Recent asset price adjusted by the value of fair basis.
    index_price String Average underlying asset price.
    funding_rate String Percentage of contract mark value paid after the end of current funding interval.
    open_interest String Total quantity of traded futures contracts.
    next_funding_time DateTime Timestamp of the next funding.
    indicative_funding_rate String Estimated value of funding_rate in the next funding period calculated at the moment.
    premium_index String Time-weighted average over premium indexes from the previous funding to the moment. Used during calculation of indicative_funding_rate.
    avg_premium_index String Time-weighted average over premium indexes for previous funding period. Used during calculation of funding_rate for adjusting it to the deviation of contract market price from the mark price.
    interest_rate String Contract interest rate for one funding period.
    timestamp DateTime Request timestamp.

    Funding History

    curl "https://api.pro.changelly.com/api/3/public/futures/history/funding"
    

    Response:

    {
        "BTCUSDT_PERP": [{
            "timestamp": "2021-07-29T16:00:00.271Z",
            "funding_rate": "0.0001",
            "avg_premium_index": "0.000061858585213222",
            "next_funding_time": "2021-07-30T00:00:00.000Z",
            "interest_rate": "0.0001"
        }, {
            "timestamp": "2021-07-29T08:00:00.506Z",
            "funding_rate": "0.0001",
            "avg_premium_index": "0.000064275104721498",
            "next_funding_time": "2021-07-29T16:00:00.000Z",
            "interest_rate": "0.0001"
        }, {
            "timestamp": "2021-07-29T00:00:00.233Z",
            "funding_rate": "0.0001",
            "avg_premium_index": "0.000025719039726718",
            "next_funding_time": "2021-07-29T08:00:00.000Z",
            "interest_rate": "0.0001"
        }]
    }
    

    GET /api/3/public/futures/history/funding

    Returns funding history for a specified contract.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    symbols String Comma-separated list of symbol codes.
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Accepted values: 1 – 1000
    offset Number Default value: 0
    Accepted values: 0 – 100000

    Response:

    Name Type Description
    timestamp DateTime Request timestamp.
    funding_rate String Percentage of contract mark value paid after the end of current funding interval.
    avg_premium_index String Time-weighted average over premium indexes for previous funding period. Used during calculation of funding_rate for adjusting it to the deviation of contract market price from the mark price.
    next_funding_time DateTime Timestamp of the next funding.
    interest_rate String Contract interest rate for one funding period.

    Futures Index Price Candles

    Get Index Price Candles

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/index_price"
    

    Response:

    {
        "BTCUSDT_PERP": [
          {
            "timestamp": "2021-07-08T07:30:00.000Z",
            "open": "32414.58",
            "close": "32414.58",
            "min": "32414.58",
            "max": "32414.58"
          },
          {
            "timestamp": "2021-07-07T18:00:00.000Z",
            "open": "34748.31",
            "close": "34748.31",
            "min": "34748.31",
            "max": "34748.31"
          },
          {
            "timestamp": "2021-07-07T12:30:00.000Z",
            "open": "34777.96",
            "close": "34777.96",
            "min": "34777.96",
            "max": "34777.96"
          }
        ]
    }
    

    GET /api/3/public/futures/candles/index_price

    Returns index price candles for all contracts.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    symbols String Comma-separated list of contract codes.
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 10
    Accepted values: 1 – 1000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open index price.
    close Number Closing index price.
    min Number The lowest index price for the period.
    max Number The highest index price for the period.

    Get Index Price Candles by Contract

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/index_price/BTCUSDT_PERP"
    

    Response:

    [
        {
            "timestamp": "2021-07-08T07:30:00.000Z",
            "open": "32414.58",
            "close": "32414.58",
            "min": "32414.58",
            "max": "32414.58"
        },
        {
            "timestamp": "2021-07-07T18:00:00.000Z",
            "open": "34748.31",
            "close": "34748.31",
            "min": "34748.31",
            "max": "34748.31"
        },
        {
            "timestamp": "2021-07-07T12:30:00.000Z",
            "open": "34777.96",
            "close": "34777.96",
            "min": "34777.96",
            "max": "34777.96"
        }
    ]
    

    GET /api/3/public/futures/candles/index_price/{symbol}

    Returns index price candles for a certain contract.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Accepted values: 1 – 1000
    offset Number Default value: 0
    Accepted values: 0 – 100000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open index price.
    close Number Closing index price.
    min Number The lowest index price for the period.
    max Number The highest index price for the period.

    Futures Mark Price Candles

    Get Mark Price Candles

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/mark_price"
    

    Response:

    {
        "BTCUSDT_PERP": [
          {
            "timestamp": "2021-07-08T07:30:00.000Z",
            "open": "32414.58",
            "close": "32414.58",
            "min": "32414.58",
            "max": "32414.58"
          },
          {
            "timestamp": "2021-07-07T18:00:00.000Z",
            "open": "34748.31",
            "close": "34748.31",
            "min": "34748.31",
            "max": "34748.31"
          },
          {
            "timestamp": "2021-07-07T12:30:00.000Z",
            "open": "34777.96",
            "close": "34777.96",
            "min": "34777.96",
            "max": "34777.96"
          }
        ]
    }
    

    GET /api/3/public/futures/candles/mark_price

    Returns mark price candles for all contracts.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Limit to candles.
    Default value: 10
    Max value: 1000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open mark price.
    close Number Closing mark price.
    min Number The lowest mark price for the period.
    max Number The highest mark price for the period.

    Get Mark Price Candles by Contract

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/mark_price/BTCUSDT_PERP"
    

    Response:

    [
        {
            "timestamp": "2021-07-08T07:30:00.000Z",
            "open": "32414.58",
            "close": "32414.58",
            "min": "32414.58",
            "max": "32414.58"
        },
        {
            "timestamp": "2021-07-07T18:00:00.000Z",
            "open": "34748.31",
            "close": "34748.31",
            "min": "34748.31",
            "max": "34748.31"
        },
        {
            "timestamp": "2021-07-07T12:30:00.000Z",
            "open": "34777.96",
            "close": "34777.96",
            "min": "34777.96",
            "max": "34777.96"
        }
    ]
    

    GET /api/3/public/futures/candles/mark_price/{symbol}

    Returns mark price candles for a certain contract.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Accepted values: 1 – 1000
    offset Number Default value: 0
    Accepted values: 0 – 100000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open mark price.
    close Number Closing mark price.
    min Number The lowest mark price for the period.
    max Number The highest mark price for the period.

    Futures Premium Index Candles

    Get Premium Index Candles

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/premium_index"
    

    Response:

    {
        "BTCUSDT_PERP": [
          {
            "timestamp": "2021-07-08T23:00:00.000Z",
            "open": "0.0001",
            "close": "-0.000204666639856002",
            "min": "-0.000390287528832163",
            "max": "0.000191382142641392"
          },
          {
            "timestamp": "2021-07-08T22:30:00.000Z",
            "open": "-0.000057633026633848",
            "close": "0.00006436921844495",
            "min": "-0.00060179788527768",
            "max": "0.0001"
          },
          {
            "timestamp": "2021-07-08T22:00:00.000Z",
            "open": "0.0001",
            "close": "-0.000205510656144068",
            "min": "-0.000604732863348008",
            "max": "0.0001"
          }
        ]
    }
    

    GET /api/3/public/futures/candles/premium_index

    Returns premium index candles for all contracts.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    symbols String Comma-separated list of contract codes.
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 10
    Accepted values: 1 – 1000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open premium index.
    close Number Closing premium index.
    min Number The lowest premium index for the period.
    max Number The highest premium index for the period.

    Get Premium Index Candles by Contract

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/premium_index/BTCUSDT_PERP"
    

    Response:

    [
        {
            "timestamp": "2021-07-08T23:00:00.000Z",
            "open": "0.0001",
            "close": "-0.000204666639856002",
            "min": "-0.000390287528832163",
            "max": "0.000191382142641392"
        },
        {
            "timestamp": "2021-07-08T22:30:00.000Z",
            "open": "-0.000057633026633848",
            "close": "0.00006436921844495",
            "min": "-0.00060179788527768",
            "max": "0.0001"
        },
        {
            "timestamp": "2021-07-08T22:00:00.000Z",
            "open": "0.0001",
            "close": "-0.000205510656144068",
            "min": "-0.000604732863348008",
            "max": "0.0001"
        }
    ]
    

    GET /api/3/public/futures/candles/premium_index/{symbol}

    Returns premium index candles for a certain contract.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Accepted values: 1 – 1000
    offset Number Default value: 0
    Accepted values: 0 – 100000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Open premium index.
    close Number Closing premium index.
    min Number The lowest premium index for the period.
    max Number The highest premium index for the period.

    Futures Open Interest Candles

    Get Open Interest Candles

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/open_interest"
    

    Response:

    {
        "BTCUSDT_PERP": [{
            "timestamp": "2021-07-22T16:30:00.000Z",
            "open": "1.06523",
            "close": "1.06523",
            "min": "1.06523",
            "max": "1.06523"
        }, {
            "timestamp": "2021-07-22T16:00:00.000Z",
            "open": "1.06523",
            "close": "1.06523",
            "min": "1.06523",
            "max": "1.06523"
        }, {
            "timestamp": "2021-07-22T15:30:00.000Z",
            "open": "1.06523",
            "close": "1.06523",
            "min": "1.06523",
            "max": "1.06523"
        }]
    }
    

    GET /api/3/public/futures/candles/open_interest

    Returns open interest candles for all contracts.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    symbols String Comma-separated list of contract codes.
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 10
    Accepted values: 1 – 1000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Opening value.
    close Number Closing value.
    min Number The lowest open interest for the period.
    max Number The highest open interest for the period.

    Get Open Interest Candles by Contract

    curl "https://api.pro.changelly.com/api/3/public/futures/candles/open_interest/BTCUSDT_PERP"
    

    Response:

    [   
        {
            "timestamp": "2021-07-22T16:30:00.000Z",
            "open": "1.06523",
            "close": "1.06523",
            "min": "1.06523",
            "max": "1.06523"
        }, {
            "timestamp": "2021-07-22T16:00:00.000Z",
            "open": "1.06523",
            "close": "1.06523",
            "min": "1.06523",
            "max": "1.06523"
        }, {
            "timestamp": "2021-07-22T15:30:00.000Z",
            "open": "1.06523",
            "close": "1.06523",
            "min": "1.06523",
            "max": "1.06523"
        }
    ]
    

    GET /api/3/public/futures/candles/open_interest/{symbol}

    Returns open interest candles for a certain contract.

    Requires no API key Access Rights.

    All parameters are optional.

    Parameters:

    Name Type Description
    sort String Sort direction.
    Accepted values: ASC, DESC
    Default value: DESC
    period String Accepted values: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)
    Default value: M30 (30 minutes)
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Accepted values: 1 – 1000
    offset Number Default value: 0
    Accepted values: 0 – 100000

    Response:

    Name Type Description
    timestamp DateTime Candle timestamp.
    open Number Opening value.
    close Number Closing value.
    min Number The lowest open interest for the period.
    max Number The highest open interest for the period.

    Authentication

    curl -u "apiKey:secretKey" https://api.pro.changelly.com/api/3/spot/balance
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    
    
    const fetch = require('node-fetch');
    
    const credentials = Buffer.from('apiKey' + ':' + 'secretKey').toString('base64');
    
    fetch('https://api.pro.changelly.com/api/3/spot/balance', {
        method: 'GET',
        headers: {
            'Authorization': 'Basic ' + credentials
        }
    });
    
    

    Public market data are available without authentication. Authentication is required for other requests.

    You should create API keys on the API Settings page. You can create multiple API keys with different access rights for your applications.

    Use Basic Authentication to access the REST API.

    Authentication HS256

    from base64 import b64encode
    from hashlib import sha256
    from hmac import HMAC
    from time import time
    from urllib.parse import urlsplit
    from requests import Session
    from requests.auth import AuthBase
    
    class HS256(AuthBase):
    
        def __init__(self, api_key: str, secret_key: str, window: int = None):
            self.api_key = api_key
            self.secret_key = secret_key
            self.window = window
    
        def __call__(self, r):
            url = urlsplit(r.url)
            message = [r.method, url.path]
            if url.query:
                message.append('?')
                message.append(url.query)
            if r.body:
                message.append(r.body)
    
            timestamp = str(int(time() * 1000))
            window = str(self.window) if self.window else None
            message.append(timestamp)
            if window:
                message.append(window)
    
            signature = HMAC(key=self.secret_key.encode(),
                             msg=''.join(message).encode(),
                             digestmod=sha256).hexdigest()
            data = [self.api_key, signature, timestamp]
            if window:
                data.append(window)
    
            base64_encoded = b64encode(':'.join(data).encode()).decode()
            r.headers['Authorization'] = f'HS256 {base64_encoded}'
            return r
    
    auth = HS256(api_key='apiKey', secret_key='secretKey')
    with Session() as s:
        response = s.get('https://api.pro.changelly.com/api/3/spot/balance', auth=auth)
        print(response.json())
    

    The alternative authentication method is the HMAC signature.

    To send a request, you should establish a persistent session using the credentials signed as follows:

    1. Create an HMAC signature with secret_key as the secret key, SHA256 as the hash algorithm, and payload as the message, structured like:
      <method> + <URL path> + [“?” + <query>] + [<body>] + <timestamp> + [<window>]
    2. Add the authorization header to a request. It should have the following structure:
      "HS256 " + Base64(api_key + ":" + <HMAC signature> + ":" + timestamp + [":" + window])

    Spot Trading

    Order Model

    {
        "id": 828680665,
        "client_order_id": "f4307c6e507e49019907c917b6d7a084",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "partiallyFilled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "13.942",
        "price": "0.011384",
        "quantity_cumulative": "5.240",
        "created_at": "2021-06-16T14:18:47.321Z",
        "updated_at": "2021-06-16T14:18:47.321Z",
        "post_only": false,
        "trades": [
            {
                "id": 1361171432,
                "quantity": "5.240",
                "price": "0.011384",
                "fee": "0.001237803000",
                "taker": true,
                "timestamp": "2021-06-16T14:18:47.321Z"
            }
        ]
    }
    

    Order model consists of:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Symbol code.
    side String Trade side.
    Possible values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    quantity_cumulative Number Executed order quantity.
    price Number Optional. Order price.
    stop_price Number Optional. The price level that triggers order activation. Specified if type is stopLimit or stopMarket.
    expire_time DateTime Optional. Date of order expiration. Specified if time_in_force is GTD.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    original_client_order_id String Optional. Identifier of replaced order.
    created_at DateTime Date of order's creation.
    updated_at DateTime Date of order's last update.
    trades Array of Trade Optional. List of trades.

    Trade model consists of:

    Name Type Description
    id Number Trade identifier.
    quantity Number Quantity of trade.
    price Number Trade price.
    fee Number Fee paid for trade.
    taker Boolean Liquidity indicator.
    timestamp DateTime Date of trade.

    Get Spot Trading Balance

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/balance"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/spot/balance').json()
    print(b)
    

    Response. All currencies:

    [
        {
            "currency": "ETH",
            "available": "10.000000000",
            "reserved": "0.56",
            "reserved_margin": "0"
        },
        {
            "currency": "BTC",
            "available": "0.010205869",
            "reserved": "0",
            "reserved_margin": "0"
        }
    ]
    

    Response. One currency:

    {
        "available": "10.000000000",
        "reserved": "0.56",
        "reserved_margin": "0"
    }
    

    GET /api/3/spot/balance GET /api/3/spot/balance/{currency}

    Returns the user's trading balance.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    Parameters:

    Name Type Description
    currency String Optional. Currency filter.

    Response:

    Name Type Description
    currency String Currency code.
    available Number Amount available for trading or transfer to wallet.
    reserved Number Total amount reserved for active orders, incomplete transfers to wallet, and margin trading.
    available Number Amount available for trading or transfer to main account.
    reserved Number Total amount reserved for active orders, incomplete transfers to main account, and margin trading.
    reserved_margin Number Amount reserved for margin trading.

    Get All Active Spot Orders

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/order"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/spot/order').json()
    print(b)
    

    Response:

    [
        {
            "id": 840450210,
            "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
            "symbol": "ETHBTC",
            "side": "buy",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.020",
            "price": "0.046001",
            "quantity_cumulative": "0.005",
            "post_only": false,
            "created_at": "2021-06-12T17:17:57.437Z",
            "updated_at": "2021-06-12T17:18:08.610Z"
        }
    ]
    

    GET /api/3/spot/order

    Returns a list of all active spot orders.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    symbol String Optional. Parameter to filter active spot orders by symbol.

    Response: array of spot orders

    Get Active Spot Order

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/order/c1837634ef81472a9cd13c81e7b91401"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/spot/order/c1837634ef81472a9cd13c81e7b91401').json()
    print(b)
    

    Response:

    {
        "id": 840450210,
        "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
        "symbol": "ETHBTC",
        "side": "buy",
        "status": "partiallyFilled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.020",
        "price": "0.046001",
        "quantity_cumulative": "0.005",
        "post_only": false,
        "created_at": "2021-06-12T17:17:57.437Z",
        "updated_at": "2021-06-12T17:18:08.610Z"
    }
    

    GET /api/3/spot/order/{client_order_id}

    Returns an active spot order by client_order_id.

    Requires the "Place/cancel orders" API key Access Right.

    Response: spot order

    Create New Spot Order

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/order" \
        -d 'symbol=ETHBTC&side=sell&quantity=0.063&price=0.046016'
    
        import requests
        session = requests.session()
        session.auth = ("apiKey", "secretKey")
        orderData = {'symbol':'ETHBTC', 'side': 'sell', 'quantity': '0.063', 'price': '0.046016' }
        r = session.post('https://api.pro.changelly.com/api/3/spot/order/', data = orderData)
    
        print(r.json())
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "new",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T17:01:05.092Z"
    }
    

    Error response example:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        }
    }
    

    POST /api/3/spot/order

    Creates a new spot order.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    client_order_id String Optional. If omitted, an order will be created, and it will be generated by the Server. Uniqueness must be guaranteed within a single trading day, including all active orders.
    If specified and corresponds to an existing order, a request will be rejected.
    symbol String Symbol code.
    side String Trade side.
    Accepted values: sell, buy
    type String Optional. Order type.
    Accepted values: limit, market, stopLimit, stopMarket
    Default value: limit
    time_in_force String Optional. Time in Force is instruction.
    Accepted values: GTC, IOC, FOK, Day, GTD
    Default value: GTC
    quantity Number Order quantity.
    price Number Order price. Required if type is limit or stopLimit.
    stop_price Number The price level that triggers order activation. Required if type is stopLimit or stopMarket.
    expire_time DateTime Date of order expiration. Required if time_in_force is GTD.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment.
    post_only Boolean Optional. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    take_rate Number Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.
    make_rate Number Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

    Response: spot order

    Price accuracy and quantity

    Symbol config contains the tick_size parameter which means that price should be divided by tick_size with no remainder.
    quantity should be divided by quantity_increment with no remainder.
    By default, if strict_validate is not enabled, the Server rounds half down the price and quantity for tick_size and quantity_increment.

    Example of ETHBTC: if tick_size is 0.000001, then price 0.046016 is valid, and '0.0460165' is invalid.

    Fees

    Charged fee is determined by the symbol's fee_currency. Maker-taker fees offer a transaction rebate make_rate to those who provide liquidity (a maker), while charging customers who take that liquidity take_rate (a taker).

    To create buy orders, you must have sufficient balance including fees.
    Available balance > price × quantity × (0.1 + take_rate)

    Order result status

    For orders with time_in_force = IOC or FOK, the REST API returns final order status: filled or expired.

    If an order can be instantly executed, then the REST API returns a status of filled or partiallyFilled in the order's info.

    Replace Spot Order

    curl -X PATCH -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/order/d8574207d9e3b16a4a5511753eeef174" \
        -d 'quantity=0.063&price=0.046016&new_client_order_id=d8574207d9e3b16a4a5511753eeef175'
    
        import requests
        session = requests.session()
        session.auth = ("apiKey", "secretKey")
        orderData = {'quantity': '0.063', 'price': '0.046016' , 'new_client_order_id': 'd8574207d9e3b16a4a5511753eeef175'}
        r = session.patch('https://api.pro.changelly.com/api/3/spot/order/d8574207d9e3b16a4a5511753eeef174', data = orderData)
        print(r.json())
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "new",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T17:01:05.092Z"
    }
    

    Error response example:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        }
    }
    

    PATCH /api/3/spot/order/{client_order_id}

    Replaces a spot order

    Parameters:

    Name Type Description
    new_client_order_id String client_order_id for a new order.
    quantity Number Order quantity.
    price Number Order price. Required if type is limit or stopLimit.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment.

    Response: spot order

    Cancel All Spot Orders

    DELETE /api/3/spot/order

    Cancels all active spot orders.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    symbol String Optional. Parameter to filter active spot orders by symbol.

    Response: array of spot orders

    Cancel Spot Order

    curl -X DELETE -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/order/d8574207d9e3b16a4a5511753eeef175"
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "canceled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T17:01:05.092Z"
    }
    

    Example of Order not found error response:

    {
        "error": {
            "code": 20002,
            "message": "Order not found",
            "description": ""
        }
    }
    

    DELETE /api/3/spot/order/{client_order_id}

    Cancels a spot order.

    Requires the "Place/cancel orders" API key Access Right.

    Response: spot order

    Get All Trading Commissions

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/fee"
    

    Response:

    [
        {
            "symbol": "BTCUSDT",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        },
        {
            "symbol": "ETHBTC",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        }
    ]
    

    GET /api/3/spot/fee

    Returns personal trading commission rates for all symbols.

    Requires the "Place/cancel orders" API key Access Right.

    Get Trading Commission

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/fee/ETHBTC"
    

    Response:

    {
        "symbol": "ETHBTC",
        "take_rate": "0.001",
        "make_rate": "-0.0001"
    }
    

    GET /api/3/spot/fee/{symbol}

    Returns personal trading commission rate by symbol.

    Requires the "Place/cancel orders" API key Access Right.

    Spot Trading History

    Spot Orders History

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/history/order?symbol=ETHBTC"
    
    [
        {
            "id": 828680665,
            "client_order_id": "f4307c6e507e49019907c917b6d7a084",
            "symbol": "ETHBTC",
            "side": "sell",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "13.942",
            "price": "0.011384",
            "price_average": "0.055487",
            "quantity_cumulative": "5.240",
            "created_at": "2021-06-16T14:18:47.321Z",
            "updated_at": "2021-06-19T15:23:54.876Z"
        },
        {
            "id": 828680667,
            "client_order_id": "f4307c6e507e49019907c917b6d7a084",
            "symbol": "ETHBTC",
            "side": "sell",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "13.942",
            "price": "0.011384",
            "price_average": "0.045000",
            "quantity_cumulative": "5.240",
            "created_at": "2021-06-16T14:18:50.321Z",
            "updated_at": "2021-06-19T15:23:56.876Z"
        }
    ]
    

    GET /api/3/spot/history/order

    Returns all spot orders. Orders without executions are deleted after 24 hours.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    client_order_id String If specified, other parameters will be ignored, including limit and offset.
    symbol String Comma-separated symbol codes.
    sort String Sort direction.
    Accepted values: DESC, ASC
    Default value: DESC
    by String Filter type.
    Accepted values: timestamp, id
    Default value: id
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    Response:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Symbol code.
    side String Trade side.
    Possible values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    quantity_cumulative Number Executed order quantity.
    price Number Order price.
    price_average Number Average price of executed order quantity.
    expire_time DateTime Date of order expiration. Specified if time_in_force is GTD.
    stop_price Number The price level that triggers order activation. Specified if type is stopLimit or stopMarket.
    created_at DateTime Date of order's creation.
    updated_at DateTime Date of order's last update.

    Spot Trades History

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/spot/history/trade?symbol=ETHBTC"
    
    [
        {
            "id": 9535486,
            "order_id": 816088377,
            "client_order_id": "f8dbaab336d44d5ba3ff578098a68454",
            "symbol": "ETHBTC",
            "side": "sell",
            "quantity": "0.061",
            "price": "0.045487",
            "fee": "0.000002775",
            "timestamp": "2021-06-17T12:32:57.848Z",
            "taker": true
        },
        {
            "id": 9535437,
            "order_id": 816088021,
            "client_order_id": "27b9bfc068b44194b1f453c7af511ed6",
            "symbol": "ETHBTC",
            "side": "buy",
            "quantity": "0.038",
            "price": "0.046000",
            "fee": "-0.000000174",
            "timestamp": "2021-06-17T12:30:57.848Z",
            "taker": true
        }
    ]
    

    GET /api/3/spot/history/trade

    Returns the user's spot trading history.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    order_id String Order unique identifier as assigned by exchange.
    symbol String Comma-separated symbol codes.
    sort String Sort direction.
    Accepted values: DESC, ASC
    Default value: DESC
    by String Filter type.
    Accepted values: timestamp, id
    Default value: id
    from DateTime or Number Interval initial value.
    If sorting by timestamp is used, then DateTime, otherwise — Number.
    till DateTime or Number Interval end value.
    If sorting by timestamp is used, then DateTime, otherwise — Number.
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    Response:

    Name Type Description
    id Number Trade unique identifier as assigned by exchange.
    order_id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader.
    symbol String Symbol code.
    side String Trade side.
    Possible values: sell, buy
    quantity Number Trade quantity.
    price Number Trade price.
    fee Number Trade commission.
    Can be negative ("rebate" — reward paid to a trader). See fee currency in the symbol config.
    timestamp DateTime Trade timestamp.
    taker Boolean Liquidity indicator.

    Margin Trading

    Margin Order Model

    Margin Order:

    {
    {
        "id": 828680665,
        "client_order_id": "f4307c6e507e49019907c917b6d7a084",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "partiallyFilled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "13.942",
        "price": "0.011384",
        "quantity_cumulative": "5.240",
        "created_at": "2021-06-16T14:18:47.321Z",
        "updated_at": "2021-06-16T14:18:47.321Z",
        "post_only": false,
        "trades": [
            {
                "id": 1361171432,
            "position_id": 123,
                "quantity": "5.240",
                "price": "0.011384",
                "fee": "0.001237803000",
                "taker": true,
                "timestamp": "2021-06-16T14:18:47.321Z"
            }
        ]
    }
    }
    

    Margin order model consists of:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Symbol code.
    side String Trade side.
    Possible values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    quantity_cumulative Number Executed order quantity.
    price Number Optional. Order price.
    stop_price Number Optional. The price level that triggers order activation. Specified if type is stopLimit or stopMarket.
    expire_time DateTime Optional. Date of order expiration. Specified if time_in_force is GTD.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    original_client_order_id String Optional. Identifier of replaced order.
    created_at DateTime Date of order's creation.
    updated_at DateTime Date of order's last update.
    trades Array of Trade Optional. List of trades.

    Trade model consists of:

    Name Type Description
    id Number Trade identifier.
    quantity Number Quantity of trade.
    price Number Trade price.
    fee Number Fee paid for trade.
    position_id Number Position identifier of the trade.
    taker Boolean Liquidity indicator.
    timestamp DateTime Date of trade.

    Margin Model

    Margin Account:

    [
        {
            "symbol": "ETHUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:20:25.118Z",
            "updated_at": "2021-07-01T21:20:25.118Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.002000000000",
                "reserved_orders": "0",
                "reserved_positions": "0"
              }
            ],
            "positions": null
          },
          {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-06-19T17:26:10.758Z",
            "updated_at": "2021-07-01T21:20:03.64Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.097289003250",
                "reserved_orders": "0",
                "reserved_positions": "0.029557397625"
              }
            ],
            "positions": [
              {
                "id": 475421,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33304.11",
                "price_margin_call": "25395.20",
                "price_liquidation": "24884.62",
                "pnl": "0",
                "created_at": "2021-06-19T17:26:10.758Z",
                "updated_at": "2021-07-01T21:20:03.64Z"
              }
            ]
        }
    ]
    

    Margin Account model consists of:

    Name Type Description
    symbol String Symbol code.
    leverage Number The ratio of borrowed funds to trader's initial margin.
    type String Type of margin. Only isolated.
    created_at DateTime Date of account creation.
    updated_at DateTime Date of account last update.
    currencies Array of Currency Amount of funds on Margin Account.
    positions Array of Position Optional. Open positions of the Margin Account.

    Currency Model

    {
        "code": "USDT",
        "margin_balance": "999.9841334080000",
        "reserved_orders": "0",
        "reserved_positions": "1.605699104000"
    }
    

    Currency model consists of:

    Name Type Description
    code String Currency code.
    margin_balance Number Total quantity of contracts on the user's trading account.
    reserved_orders Number Margin reserved for open orders. These funds are unavailable for withdrawal.
    reserved_positions Number Margin reserved for open position. These funds are unavailable for withdrawal.

    Position Model

    {
        "id": 298724,
        "symbol": "BTCUSDT",
        "quantity": "-0.00100",
        "pnl": "0",
        "price_entry": "7933.30",
        "price_margin_call": "887772.25",
        "price_liquidation": "914625.61",
        "created_at": "2021-06-21T14:33:34.723Z",
        "updated_at": "2021-06-21T14:33:46.149Z"
    }
    

    Position model consists of:

    Name Type Description
    id String Position identifier.
    symbol String Symbol code.
    quantity Number Position quantity.
    pnl Number Unrealized profit and loss.
    price_entry Number Average weighted price of position open orders.
    price_margin_call Number The mark price of margin call.
    price_liquidation Number The mark price of force close.
    created_at DateTime Position creation date and time.
    updated_at DateTime Position last update date and time.

    Get All Margin Accounts

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/account"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/margin/account').json()
    print(b)
    

    Response:

    [
        {
          "symbol": "BTCUSDT",
          "type": "isolated",
          "leverage": "12.00",
          "created_at": "2021-07-01T21:43:19.727Z",
          "updated_at": "2021-07-01T23:24:46.27Z",
          "currencies": [
            {
              "code": "USDT",
              "margin_balance": "0.080816916750",
              "reserved_orders": "0.000018250000",
              "reserved_positions": "0.333861705262"
            }
          ],
          "positions": [
            {
              "id": 485264,
              "symbol": "BTCUSDT",
              "quantity": "0.00001",
              "price_entry": "33386.18",
              "price_margin_call": "27259.95",
              "price_liquidation": "26711.87",
              "pnl": "0",
              "created_at": "2021-07-01T21:43:19.727Z",
              "updated_at": "2021-07-01T23:24:46.27Z"
            }
          ]
        },
        {
          "symbol": "ETHUSDT",
          "type": "isolated",
          "leverage": "12.00",
          "created_at": "2021-07-01T21:20:25.118Z",
          "updated_at": "2021-07-01T21:20:25.118Z",
          "currencies": [
            {
              "code": "USDT",
              "margin_balance": "0.002000000000",
              "reserved_orders": "0",
              "reserved_positions": "0"
            }
          ],
          "positions": null
        }
    ]
    

    GET /api/3/margin/account

    Returns user's all Margin Accounts' details.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    Get Margin Account

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/account/isolated/BTCUSDT"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/margin/account/isolated/BTCUSDT').json()
    print(b)
    

    Response:

    {
        "symbol": "BTCUSDT",
        "type": "isolated",
        "leverage": "12.00",
        "created_at": "2021-07-01T21:43:19.727Z",
        "updated_at": "2021-07-01T23:24:46.27Z",
        "currencies": [
          {
            "code": "USDT",
            "margin_balance": "0.080816916750",
            "reserved_orders": "0.000018250000",
            "reserved_positions": "0.333861705262"
          }
        ],
        "positions": [
          {
            "id": 485264,
            "symbol": "BTCUSDT",
            "quantity": "0.00001",
            "price_entry": "33386.18",
            "price_margin_call": "27259.95",
            "price_liquidation": "26711.87",
            "pnl": "0",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-01T23:24:46.27Z"
          }
        ]
    }
    

    GET /api/3/margin/account/isolated/{symbol}

    Returns Isolated Margin Account details by symbol.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    Create/Update Margin Account

    curl -X PUT -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/account/isolated/BTCUSDT" \
        -d "margin_balance=123.44"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.put('https://api.pro.changelly.com/api/3/margin/account/isolated/BTCUSDT',
                    json={"margin_balance":"123.4455", "strict_validate": True}).json()
    print(b)
    
    {
        "symbol": "BTCUSDT",
        "type": "isolated",
        "leverage": "12.00",
        "created_at": "2021-06-19T17:26:10.758Z",
        "updated_at": "2021-07-01T21:20:03.64Z",
        "currencies": [
          {
            "code": "USDT",
            "margin_balance": "0.097289003250",
            "reserved_orders": "0",
            "reserved_positions": "0.029557397625"
          }
        ],
        "positions": [
          {
            "id": 475421,
            "symbol": "BTCUSDT",
            "quantity": "0.00001",
            "price_entry": "33304.11",
            "price_margin_call": "25395.20",
            "price_liquidation": "24884.62",
            "pnl": "0",
            "created_at": "2021-06-19T17:26:10.758Z",
            "updated_at": "2021-07-01T21:20:03.64Z"
          }
        ]
    }
    

    PUT /api/3/margin/account/isolated/{symbol}

    Creates or updates a Margin Account. Setting the margin balance to zero will lead to closing a margin account and retrieval of all formerly reserved funds to the trading account.

    To withdraw all funds from margin account send request with margin_balance equal to 0.

    Returns the created/updated Margin Account details.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    margin_balance Number Amount of currency. 0 to close margin account.
    strict_validate Boolean The value indicating whether the margin_balance is going to be checked for correct non-exponential format and currency precision.

    Close Margin Positions

    curl -X DELETE -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/position"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.delete('https://api.pro.changelly.com/api/3/margin/position').json()
    print(b)
    

    DELETE /api/3/margin/position

    Closes all open positions.

    Returns a list of the successfully closed margin positions.

    Requires the "Place/cancel orders" API key Access Right.

    Close Margin Position

    curl -X DELETE -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/position/isolated/BTCUSDT"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.delete('https://api.pro.changelly.com/api/3/margin/position/isolated/BTCUSDT',
                       json={"price": "9800.50", "strict_validate": True}).json()
    print(b)
    

    DELETE /api/3/margin/position/isolated/{symbol}

    Closes open position by symbol.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    price Number Optional. If a price is defined, then close order would be a limit order, instead, close order would be a market order.
    strict_validate Boolean Optional.
    The value indicating whether the price is going to be checked for incrementation within the symbol’s tick size step. See the symbol's tick_size.
    Default value: false

    Get Active Margin Orders

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/order"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/margin/order').json()
    print(b)
    

    Response:

    [
        {
            "id": 840450210,
            "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
            "symbol": "ETHBTC",
            "side": "buy",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.020",
            "price": "0.046001",
            "quantity_cumulative": "0.005",
            "post_only": false,
            "created_at": "2021-06-12T17:17:57.437Z",
            "updated_at": "2021-06-12T17:18:08.610Z"
        }
    ]
    

    GET /api/3/margin/order

    Returns an array of active margin orders.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    symbol String Optional. Parameter to filter active orders by symbol.

    Get Active Margin Order

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/order/c1837634ef81472a9cd13c81e7b91401"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/margin/order/c1837634ef81472a9cd13c81e7b91401').json()
    print(b)
    

    Response:

    {
        "id": 840450210,
        "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
        "symbol": "ETHBTC",
        "side": "buy",
        "status": "partiallyFilled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.020",
        "price": "0.046001",
        "quantity_cumulative": "0.005",
        "post_only": false,
        "created_at": "2021-06-12T17:17:57.437Z",
        "updated_at": "2021-06-12T17:18:08.610Z"
    }
    

    GET /api/3/margin/order/{client_order_id}

    Returns an active margin order by client_order_id.

    Requires the "Place/cancel orders" API key Access Right.

    Create Margin Order

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/order" \
        -d 'symbol=ETHBTC&side=sell&quantity=0.063&price=0.046016'
    
        import requests
        session = requests.session()
        session.auth = ("apiKey", "secretKey")
        orderData = {'symbol':'ETHBTC', 'side': 'sell', 'quantity': '0.063', 'price': '0.046016'}
        r = session.post('https://api.pro.changelly.com/api/3/margin/order', data = orderData)
        print(r.json())
    
    

    Response:

    {
        "id": 583463871253,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "new",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T17:01:05.092Z"
    }
    

    Error response example:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        }
    }
    

    POST /api/3/margin/order

    Requires the Margin Account for the order symbol.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    client_order_id String Optional.
    If it is skipped, it will be generated by the Server. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Trading symbol.
    side String Trade side.
    Accepted values: sell, buy
    type String Optional. Order type.
    Accepted values: limit, market, stopLimit, stopMarket
    Default value: limit
    time_in_force String Optional. Time in Force is instruction.
    Accepted values: GTC, IOC, FOK, Day, GTD
    Default value: GTC
    quantity Number Order quantity.
    price Number Order price. Required if type is limit or stopLimit.
    stop_price Number The price level that triggers order activation. Required if type is stopLimit or stopMarket.
    expire_time DateTime Date of order expiration. Required if time_in_force is GTD.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment.
    post_only Boolean Optional. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    take_rate Number Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.
    make_rate Number Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

    Response: order

    Replace Margin Order

    curl -X PATCH -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/order/d8574207d9e3b16a4a5511753eeef174" \
        -d 'quantity=0.063&price=0.046016&new_client_order_id=d8574207d9e3b16a4a5511753eeef175'
    
        import requests
        session = requests.session()
        session.auth = ("apiKey", "secretKey")
        orderData = {'quantity': '0.063', 'price': '0.046016', 'new_client_order_id': 'd8574207d9e3b16a4a5511753eeef175' }
        r = session.patch('https://api.pro.changelly.com/api/3/margin/order/d8574207d9e3b16a4a5511753eeef174', data = orderData)
        print(r.json())
    
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "new",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T17:01:05.092Z"
    }
    

    Error response example:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        }
    }
    

    PATCH /api/3/margin/order/{client_order_id}

    Replaces a margin order.

    Parameters:

    Name Type Description
    new_client_order_id String client_order_id for a new order.
    quantity Number Order quantity.
    price Number Order price. Required if type is limit or stopLimit.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment.

    Response: margin order

    Cancel All Margin Orders

    DELETE /api/3/margin/order

    Cancels all active margin orders.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    symbol String Optional. Parameter to filter active margin orders by symbol.

    Response: array of margin orders

    Cancel Margin Order

    curl -X DELETE -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/order/d8574207d9e3b16a4a5511753eeef175"
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC",
        "side": "sell",
        "status": "canceled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.000",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T18:08:57.226Z"
    }
    

    Example of Order not found error response:

    {
        "error": {
            "code": 20002,
            "message": "Order not found",
            "description": ""
        }
    }
    

    DELETE /api/3/margin/order/{client_order_id}

    Cancels a margin order.

    Requires the "Place/cancel orders" API key Access Right.

    Response: margin order

    Margin Trading History

    Margin Orders History

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/history/order?symbol=ETHBTC"
    
    [
        {
            "id": 828680665,
            "client_order_id": "f4307c6e507e49019907c917b6d7a084",
            "symbol": "ETHBTC",
            "side": "sell",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "13.942",
            "price": "0.011384",
            "price_average": "0.055487",
            "quantity_cumulative": "5.240",
            "created_at": "2021-06-16T14:18:47.321Z",
            "updated_at": "2021-06-19T15:23:54.876Z"
        },
        {
            "id": 828680667,
            "client_order_id": "f4307c6e507e49019907c917b6d7a084",
            "symbol": "ETHBTC",
            "side": "sell",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "13.942",
            "price": "0.011384",
            "price_average": "0.045000",
            "quantity_cumulative": "5.240",
            "created_at": "2021-06-16T14:18:50.321Z",
            "updated_at": "2021-06-19T15:23:56.876Z"
        }
    ]
    

    GET /api/3/margin/history/order

    Returns all margin orders. Orders without executions are deleted after 24 hours.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    client_order_id String If set, other parameters will be ignored, including limit and offset.
    sort String Sort direction.
    Accepted values: DESC, ASC
    Default value: DESC
    by String Filter type.
    Accepted values: timestamp, id. Default value: id
    symbol String Comma-separated symbol codes.
    from DateTime Interval initial value.
    If sorting by timestamp is used, then DateTime, otherwise Number.
    till DateTime Interval end value.
    If sorting by timestamp is used, then DateTime, otherwise Number.
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    Response:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Symbol code.
    side String Trade side.
    Possible values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    quantity_cumulative Number Executed order quantity.
    price Number Order price.
    price_average Number Average price of executed order quantity.
    expire_time DateTime Date of order expiration. Specified if time_in_force is GTD.
    position_id Number Optional. Position identifier of the order.
    stop_price Number The price level that triggers order activation. Specified if type is stopLimit or stopMarket.
    created_at DateTime Date of order's creation.
    updated_at DateTime Date of order's last update.

    Margin Trades History

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/margin/history/trade?symbol=ETHBTC"
    
    [
        {
            "id": 9535486,
            "order_id": 816088377,
            "client_order_id": "f8dbaab336d44d5ba3ff578098a68454",
            "symbol": "ETHBTC",
            "side": "sell",
            "quantity": "0.061",
            "price": "0.045487",
            "fee": "0.000002775",
            "timestamp": "2021-06-17T12:32:57.848Z",
            "taker": true
        },
        {
            "id": 9535437,
            "order_id": 816088021,
            "client_order_id": "27b9bfc068b44194b1f453c7af511ed6",
            "symbol": "ETHBTC",
            "side": "buy",
            "quantity": "0.038",
            "price": "0.046000",
            "fee": "-0.000000174",
            "timestamp": "2021-06-17T12:30:57.848Z",
            "taker": true
        }
    ]
    

    GET /api/3/margin/history/trade

    Get the user's trading history.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    order_id String Order unique identifier as assigned by exchange.
    symbol String Comma-separated symbol codes.
    sort String Sort direction.
    Accepted values: DESC, ASC
    Default value: DESC
    by String Filter type.
    Accepted values: timestamp, id. Default value: id
    from DateTime or Number Interval initial value. If sorting by timestamp is used, then DateTime, otherwise Number.
    till DateTime or Number Interval end value. If sorting by timestamp is used, then DateTime, otherwise Number.
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    Response:

    Name Type Description
    id String Trade unique identifier as assigned by exchange.
    order_id String Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader.
    symbol String Trading symbol.
    side String Trade side.
    Possible values: sell, buy
    quantity Number Trade quantity.
    price Number Trade price.
    fee Number Trade commission.
    Can be negative ("rebate" — reward paid to a trader). See fee currency in the symbol config.
    timestamp DateTime Trade timestamp.
    taker Boolean Liquidity indicator.
    position_id Number Optional. Position identifier of the trade.
    pnl Number Optional. Realized Profit and Loss on this trade.
    liquidation Boolean Optional. Whether it is a liquidation trade.

    Futures Trading

    A full order and margin model description can be found in the "Margin Trading" section.

    Get Trading Balance

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/balance"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/futures/balance').json()
    print(b)
    

    Response. All currencies:

    [
        {
            "currency": "ETH",
            "available": "10.000000000",
            "reserved": "0.56",
            "reserved_margin": "0"
        },
        {
            "currency": "BTC",
            "available": "0.010205869",
            "reserved": "0",
            "reserved_margin": "0"
        }
    ]
    

    Response. One currency:

    {
        "available": "10.000000000",
        "reserved": "0.56",
        "reserved_margin": "0"
    }
    

    GET /api/3/futures/balance GET /api/3/futures/balance/{currency}

    Returns the user's trading balance.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    Parameters:

    Name Type Description
    currency String Optional. Currency filter.

    Response:

    Name Type Description
    currency String Currency code.
    available Number Amount available for trading or transfer to wallet.
    reserved Number Total amount reserved for active orders, incomplete transfers to wallet, and margin trading.
    available Number Amount available for trading or transfer to main account.
    reserved Number Total amount reserved for active orders, incomplete transfers to main account, and margin trading.
    reserved_margin Number Amount reserved for margin trading.

    Get Futures Margin Accounts

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/account"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/futures/account').json()
    print(b)
    

    Response:

    [
        {
          "symbol": "BTCUSDT_PERP",
          "type": "isolated",
          "leverage": "12.00",
          "created_at": "2021-07-01T21:43:19.727Z",
          "updated_at": "2021-07-01T23:24:46.27Z",
          "currencies": [
            {
              "code": "USDT",
              "margin_balance": "0.080816916750",
              "reserved_orders": "0.000018250000",
              "reserved_positions": "0.333861705262"
            }
          ],
          "positions": [
            {
              "id": 485264,
              "symbol": "BTCUSDT_PERP",
              "quantity": "0.00001",
              "price_entry": "33386.18",
              "price_margin_call": "27259.95",
              "price_liquidation": "26711.87",
              "pnl": "0",
              "created_at": "2021-07-01T21:43:19.727Z",
              "updated_at": "2021-07-01T23:24:46.27Z"
            }
          ]
        }
    ]
    

    GET /api/3/futures/account

    Returns all user's Futures Margin Accounts.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    Get Futures Margin Account

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/account/isolated/BTCUSDT_PERP"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/futures/account/isolated/BTCUSDT_PERP').json()
    print(b)
    

    GET /api/3/futures/account/isolated/{symbol}

    Returns Futures Margin Account details by symbol.

    A full margin model description can be found in the "Margin Model" section.

    Requires the "Place/cancel orders" API key Access Right.

    Create/Update Margin Account

    curl -X PUT -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/account/isolated/BTCUSDT_PERP" \
        -d "margin_balance=123.44&leverage=15"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.put('https://api.pro.changelly.com/api/3/futures/account/isolated/BTCUSDT_PERP',
                    json={"margin_balance":"123.4455", "leverage": "15", "strict_validate": True}).json()
    print(b)
    

    Response:

    {
      "symbol": "BTCUSDT_PERP",
      "type": "isolated",
      "leverage": "15.00",
      "created_at": "2021-07-01T21:43:19.727Z",
      "updated_at": "2021-07-01T23:24:46.27Z",
      "currencies": [
        {
          "code": "USDT",
          "margin_balance": "123.4455",
          "reserved_orders": "0",
          "reserved_positions": "0"
        }
      ],
      "positions": null
    }
    

    PUT /api/3/futures/account/isolated/{symbol}

    Creates or updates a margin account. Setting margin balance to zero will lead to closing margin account and retrieval all formerly reserved funds to the trading account.

    Returns margin account details.

    To withdraw all funds from margin account send request with margin_balance equal to 0.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    margin_balance Number Amount of currency reserved.
    leverage Number User leverage.
    strict_validate Boolean The value indicating whether the margin_balance is going to be checked for correct non-exponential format and currency precision.

    Close All Futures Margin Positions

    curl -X DELETE -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/position"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.delete('https://api.pro.changelly.com/api/3/futures/position').json()
    print(b)
    

    DELETE /api/3/futures/position

    Closes all open positions.

    Returns a list of the successfully closed margin positions.

    Requires the "Place/cancel orders" API key Access Right.

    Close Futures Margin Position

    curl -X DELETE -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/position/isolated/BTCUSDT_PERP"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.delete('https://api.pro.changelly.com/api/3/futures/position/isolated/BTCUSDT_PERP',
                      json={"price": "9800.50", "strict_validate": True}).json()
    print(b)
    

    DELETE /api/3/futures/position/isolated/{symbol}

    Closes open position by contract.

    Returns a list of the successfully closed margin positions.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    symbol String Contract code.
    price Number Optional. If a price is defined, then close order would be a limit order with the specified price, instead, close order would be a market order with the market price.
    strict_validate Boolean Optional. The value indicating whether the price is going to be checked for incrementation within the symbol’s tick size step. See the symbol's tick_size.
    Default value: false

    Get Active Futures Orders

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/order"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/futures/order').json()
    print(b)
    

    Response:

    [
        {
            "id": 840450210,
            "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
            "symbol": "ETHBTC_PERP",
            "side": "buy",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.020",
            "price": "0.046001",
            "quantity_cumulative": "0.005",
            "post_only": false,
            "created_at": "2021-05-12T16:16:30.430Z",
            "updated_at": "2021-05-12T16:17:15.620Z"
        }
    ]
    

    GET /api/3/futures/order

    Returns an array of active futures orders.

    A full order description can be found in the "Order Model" section.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    symbol String Optional. Contract code.

    Response: array of orders

    Get Active Futures Order

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/order/c1837634ef81472a9cd13c81e7b91401"
    
    import requests
    session = requests.session()
    session.auth = ("apiKey", "secretKey")
    b = session.get('https://api.pro.changelly.com/api/3/futures/order/c1837634ef81472a9cd13c81e7b91401').json()
    print(b)
    

    Response:

    {
        "id": 840450210,
        "client_order_id": "c1837634ef81472a9cd13c81e7b91401",
        "symbol": "ETHBTC_PERP",
        "side": "buy",
        "status": "partiallyFilled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.020",
        "price": "0.046001",
        "quantity_cumulative": "0.005",
        "post_only": false,
        "created_at": "2021-05-12T16:16:30.430Z",
        "updated_at": "2021-05-12T16:17:15.620Z"
    }
    

    GET /api/3/futures/order/{client_order_id}

    Returns an active order by client_order_id.

    Requires the "Place/cancel orders" API key Access Right.

    Create Futures Order

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/order" \
        -d 'symbol=ETHBTC_PERP&side=sell&quantity=0.063&price=0.046016'
    
        import requests
        session = requests.session()
        session.auth = ("apiKey", "secretKey")
        orderData = {'symbol':'ETHBTC_PERP', 'side': 'sell', 'quantity': '0.063', 'price': '0.046016' }
        r = session.post('https://api.pro.changelly.com/api/3/futures/order', data = orderData)
        print(r.json())
    
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC_PERP",
        "side": "sell",
        "status": "new",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T17:01:05.092Z"
    }
    

    Error response example:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        }
    }
    

    POST /api/3/futures/order

    Creates a new futures order.

    A full order description can be found in the "Create New Spot Order" subsection.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    client_order_id String Optional. If omitted, an order will be created, and it will be generated by the Server. Uniqueness must be guaranteed within a single trading day, including all active orders.
    If specified and corresponds to an existing order, a request will be rejected.
    symbol String Contract code.
    side String Trade side.
    Possible values: sell, buy
    type String Optional. Order type.
    Possible values: limit, market, stopLimit, stopMarket
    Default value: limit
    time_in_force String Optional. Time in Force is instruction.
    Possible values: GTC, IOC, FOK, Day, GTD
    Default value: GTC
    quantity Number Order quantity.
    price Number Order price. Required if type is limit or stopLimit.
    stop_price Number The price level that triggers order activation. Required if type is stopLimit or stopMarket.
    expire_time DateTime Date of order expiration. Required if time_in_force is GTD.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment.
    post_only Boolean Optional. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    take_rate Number Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.
    make_rate Number Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

    Response: futures order

    Cancel Futures Orders

    DELETE /api/3/futures/order

    Cancels all active futures orders or all active futures orders for the specified contract.

    Returns a list of cancelled futures orders.

    Requires the "Place/cancel orders" API key Access Right.

    Parameters:

    Name Type Description
    symbol String Optional. Parameter to filter active futures orders by contract code.

    Replace Futures Order

    curl -X PATCH -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/order/d8574207d9e3b16a4a5511753eeef174" \
        -d 'quantity=0.063&price=0.046016&new_client_order_id=d8574207d9e3b16a4a5511753eeef175'
    
        import requests
        session = requests.session()
        session.auth = ("apiKey", "secretKey")
        orderData = {'quantity': '0.063', 'price': '0.046016' , 'new_client_order_id': 'd8574207d9e3b16a4a5511753eeef175'}
        r = session.patch('https://api.pro.changelly.com/api/3/futures/order/d8574207d9e3b16a4a5511753eeef174', data = orderData)
        print(r.json())
    
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC_PERP",
        "side": "sell",
        "status": "new",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.063",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-05-12T16:16:30.430Z",
        "updated_at": "2021-05-12T16:17:15.620Z"
    }
    

    Error response example:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        }
    }
    

    PATCH /api/3/futures/order/{client_order_id}

    Replaces a futures order.

    Parameters:

    Name Type Description
    client_order_id String Unique order identifier given by a trader or the system.
    quantity Number Order quantity.
    price Number Order price. Required if type is limit or stopLimit.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment.

    Response: futures order

    Cancel Futures Order

    curl -X DELETE -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/order/d8574207d9e3b16a4a5511753eeef175"
    

    Response:

    {
        "id": 0,
        "client_order_id": "d8574207d9e3b16a4a5511753eeef175",
        "symbol": "ETHBTC_PERP",
        "side": "sell",
        "status": "canceled",
        "type": "limit",
        "time_in_force": "GTC",
        "quantity": "0.000",
        "price": "0.046016",
        "quantity_cumulative": "0.000",
        "post_only": false,
        "created_at": "2021-06-15T17:01:05.092Z",
        "updated_at": "2021-06-15T18:08:57.226Z"
    }
    

    Example of Order not found error response:

    {
        "error": {
            "code": 20002,
            "message": "Order not found",
            "description": ""
        }
    }
    

    DELETE /api/3/futures/order/{client_order_id}

    Returns the successfully cancelled futures order.

    Requires the "Place/cancel orders" API key Access Right.

    Get All Trading Commissions

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/fee"
    

    Response:

    [
        {
            "symbol": "BTCUSDT_PERP",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        },
        {
            "symbol": "ETHBTC_PERP",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        }
    ]
    

    GET /api/3/futures/fee

    Returns personal trading commission rates for all contracts.

    Requires the "Place/cancel orders" API key Access Right.

    Get Trading Commission

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/fee/ETHBTC_PERP"
    

    Response:

    {
        "symbol": "ETHBTC_PERP",
        "take_rate": "0.001",
        "make_rate": "-0.0001"
    }
    

    GET /api/3/futures/fee/{symbol}

    Returns personal trading commission rate by contract.

    Requires the "Place/cancel orders" API key Access Right.

    Futures Trading History

    Futures Orders History

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/history/order?symbol=ETHBTC_PERP"
    
    [
        {
            "id": 828680665,
            "client_order_id": "f4307c6e507e49019907c917b6d7a084",
            "symbol": "ETHBTC_PERP",
            "side": "sell",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "13.942",
            "price": "0.011384",
            "price_average": "0.055487",
            "quantity_cumulative": "5.240",
            "created_at": "2021-06-16T14:18:47.321Z",
            "updated_at": "2021-06-19T15:23:54.876Z"
        },
        {
            "id": 828680667,
            "client_order_id": "f4307c6e507e49019907c917b6d7a084",
            "symbol": "ETHBTC_PERP",
            "side": "sell",
            "status": "partiallyFilled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "13.942",
            "price": "0.011384",
            "price_average": "0.045000",
            "quantity_cumulative": "5.240",
            "created_at": "2021-06-16T14:18:50.321Z",
            "updated_at": "2021-06-19T15:23:56.876Z"
        }
    ]
    

    GET /api/3/futures/history/order

    Returns all futures orders. Orders without executions are deleted after 24 hours.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    client_order_id String If set, other parameters will be ignored, including limit and offset.
    symbol String Comma-separated symbol codes.
    from DateTime Interval initial value.
    till DateTime Interval end value.
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    Response:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Symbol code.
    side String Trade side.
    Possible values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    quantity_cumulative Number Executed order quantity.
    price Number Order price.
    price_average Number Average price of executed order quantity.
    expire_time DateTime Date of order expiration. Specified if time_in_force is GTD.
    position_id Number Optional. Position identifier of the order.
    stop_price Number The price level that triggers order activation. Specified if type is stopLimit or stopMarket.
    created_at DateTime Date of order's creation.
    updated_at DateTime Date of order's last update.

    Futures Trades History

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/futures/history/trade?symbol=ETHBTC_PERP"
    
    [
        {
            "id": 9535486,
            "order_id": 816088377,
            "client_order_id": "f8dbaab336d44d5ba3ff578098a68454",
            "symbol": "ETHBTC_PERP",
            "side": "sell",
            "quantity": "0.061",
            "price": "0.045487",
            "fee": "0.000002775",
            "timestamp": "2021-06-17T12:32:57.848Z",
            "taker": true
        },
        {
            "id": 9535437,
            "order_id": 816088021,
            "client_order_id": "27b9bfc068b44194b1f453c7af511ed6",
            "symbol": "ETHBTC_PERP",
            "side": "buy",
            "quantity": "0.038",
            "price": "0.046000",
            "fee": "-0.000000174",
            "timestamp": "2021-06-17T12:30:57.848Z",
            "taker": true
        }
    ]
    

    GET /api/3/futures/history/trade

    Get the user's futures trading history.

    Requires the "Orderbook, History, Trading balance" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    order_id String Order unique identifier as assigned by exchange.
    symbol String Comma-separated symbol codes.
    sort String Sort direction.
    Accepted values: DESC, ASC
    Default value: DESC
    by String Filter type.
    Accepted values: timestamp, id. Default value: id
    from DateTime or Number Interval initial value. If sorting by timestamp is used, then DateTime, otherwise Number.
    till DateTime or Number Interval end value. If sorting by timestamp is used, then DateTime, otherwise Number.
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    Response:

    Name Type Description
    id String Trade unique identifier as assigned by exchange.
    order_id String Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader.
    symbol String Contract code.
    side String Trade side.
    Possible values: sell, buy
    quantity Number Trade quantity.
    price Number Trade price.
    fee Number Trade commission.
    Can be negative ("rebate" — reward paid to a trader). See fee currency in the symbol config.
    timestamp DateTime Trade timestamp.
    taker Boolean Liquidity indicator.
    position_id Number Optional. Position identifier of the trade.
    pnl Number Optional. Realized Profit and Loss on this trade
    liquidation Boolean Optional. Whether it is a liquidation trade.

    Wallet Management

    Wallet Balance

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/balance"
    

    Response. All currencies:

    [
        {
            "currency":"BTC",
            "available":"0.00005821",
            "reserved":"0.00001"
        },
        {
            "currency":"USDT",
            "available":"0.01",
            "reserved":"0"
        }
    ]
    

    Response. One currency:

    {
        "available":"0.00005821",
        "reserved":"0.00001"
    }
    

    GET /api/3/wallet/balance GET /api/3/wallet/balance/{currency}

    Returns the user's wallet balances except zero balances.

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    currency String Optional. Currency filter.

    Response:

    Name Type Description
    currency String Currency code.
    available Number Amount available for withdrawal or transfer to trading account.
    reserved Number Amount reserved for incomplete transactions.

    Deposit Crypto Address

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/address?currency=BTC"
    
    [
        {
            "currency":"BTC",
            "address":"3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv",
            "payment_id":"",
            "public_key":""
        }
    ]
    

    GET /api/3/wallet/crypto/address

    Get current address.

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    currency String Optional. Currency code.

    POST /api/3/wallet/crypto/address

    Creates a new address.

    Requires the "Payment information" API key Access Right.

    Name Type Description
    currency String Currency code.

    Response:

    Name Type Description
    currency String Currency code.
    address String Address for deposit.
    payment_id String Optional. If this parameter is returned for specific currency, it is required for deposit.
    public_key String Optional. If this parameter is returned for specific currency, it is required for deposit.

    Last 10 Deposit Crypto Addresses

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/address/recent-deposit?currency=BTC"
    
    [
        {
            "currency":"BTC",
            "address":"3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv",
            "payment_id":"",
            "public_key":""
        }
    ]
    

    GET /api/3/wallet/crypto/address/recent-deposit

    Returns the last 10 unique addresses used for deposits (by currency).

    Requires the "Payment information" API key Access Right.

    Name Type Description
    currency String Currency code.

    Response:

    Name Type Description
    currency String Currency code.
    address String Address for deposit.
    payment_id String Optional. If this parameter is returned for specific currency, it is required for deposit.
    public_key String Optional. If this parameter is returned for specific currency, it is required for deposit.

    Last 10 Withdrawal Crypto Addresses

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/address/recent-withdraw?currency=BTC"
    
    [
        {
            "currency":"BTC",
            "address":"3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv",
            "payment_id":"",
            "public_key":""
        }
    ]
    

    GET /api/3/wallet/crypto/address/recent-withdraw

    Returns the last 10 unique addresses used for withdrawals (by currency).

    Requires the "Payment information" API key Access Right.

    Name Type Description
    currency String Currency code.

    Response:

    Name Type Description
    currency String Currency code.
    address String Address for deposit.
    payment_id String Optional. If this parameter is returned for specific currency, it is required for deposit.
    public_key String Optional. If this parameter is returned for specific currency, it is required for deposit.

    Withdraw Crypto

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/withdraw" \
        -d 'currency=BTC&amount=0.001&address=3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv&auto_commit=false'
    
    {
        "id": "d2ce578f-647d-4fa0-b1aa-4a27e5ee597b"
    }
    

    POST /api/3/wallet/crypto/withdraw

    Requires the "Withdraw cryptocurrencies" API key Access Right.

    Parameters:

    Name Type Description
    currency String Currency code.
    amount Number The amount that will be sent to the specified address.
    address String Address identifier.
    payment_id String Optional parameter.
    include_fee Boolean Default value: false
    If true is set, then total spent value will include fees.
    auto_commit Boolean Default value: true
    If false is set, then you should commit or rollback a transaction in an hour. Used in two phase commit schema.
    use_offchain String Whether the withdrawal may be committed offchain.
    Accepted values: never, optionally, required
    public_comment String Optional parameter. Maximum length is 255.

    Response:

    Name Type Description
    id String Transaction unique identifier.

    Convert Between Currencies

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/convert" \
        -d 'from_currency=USDT20&to_currency=USDT&amount=0.001'
    
    {
        "result": [
            "d2ce578f-647d-4fa0-b1aa-4a27e5ee597b",
            "d2ce57hf-6g7d-4ka0-b8aa-4a27e5ee5i7b"
        ]
    }
    

    POST /api/3/wallet/convert

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    from_currency String Currency code.
    to_currency String Currency code.
    amount Number The amount that will be sent to the specified address.

    Response:

    Name Type Description
    result Array Transaction unique identifiers as assigned by exchange.

    Withdraw Crypto Commit or Rollback

    curl -X PUT -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/withdraw/d2ce578f-647d-4fa0-b1aa-4a27e5ee597b"
    
    {
        "result": true
    }
    

    PUT /api/3/wallet/crypto/withdraw/{id}

    Commit a withdrawal.

    DELETE /api/3/wallet/crypto/withdraw/{id}

    Rollback a withdrawal.

    Requires the "Withdraw cryptocurrencies" API key Access Right.

    Both methods are idempotent.

    Response:

    Name Type Description
    result Boolean true if the request is completed.

    Check If Crypto Address Belongs to Current Account

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/address/check-mine/1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2"
    
    {
        "result": true
    }
    

    GET /api/3/wallet/crypto/address/check-mine

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    address String Address.

    Response:

    Name Type Description
    result Boolean true if the address belongs to the current account.

    Transfer Between Wallet and Exchange

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/transfer" \
        -d "currency=eth&amount=0.01&source=wallet&destination=spot"
    
    {
        "id": "d2ce578f-647d-4fa0-b1aa-4a27e5ee597b"
    }
    

    POST /api/3/wallet/transfer

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    currency String Currency code.
    amount Number The amount that will be transferred between accounts.
    source String Transfer source account type.
    Accepted values: wallet, spot, derivatives. Must not be the same as destination.
    destination String Transfer destination accounts type.
    Accepted values: wallet, spot, derivatives. Must not be the same as source.

    Response:

    Name Type Description
    id String Transaction unique identifier as assigned by exchange.

    Transfer Money to Another User

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/internal/withdraw" \
        -d "by=email&[email protected]&currency=BTC&amount=0.001"
    
    {
        "result": "fd3088da-31a6-428a-b9b6-c482673ff0f2"
    }
    

    POST /api/3/wallet/internal/withdraw

    Requires the "Withdraw cryptocurrencies" API key Access Right.

    Parameters:

    Name Type Description
    currency String Currency code.
    amount Number The amount that will be transferred.
    by String Accepted values: email, username
    identifier String Identifier value. Either email or username.

    Response:

    Name Type Description
    result String Transaction unique identifier as assigned by exchange.

    Get Transactions History

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/transactions?currencies=ETH,BTC&order=DESC"
    
    [
      {
        "id": 50844835,
        "created_at": "2021-06-22T21:03:04.111Z",
        "updated_at": "2021-06-22T21:04:41.487Z",
        "status": "SUCCESS",
        "type": "WITHDRAW",
        "subtype": "BLOCKCHAIN",
        "native": {
            "tx_id": "27fa7f14-ca49-42fd-834a-4ce630d069d2",
            "index": 1071885589,
            "currency": "ETH",
            "amount": "0.01042",
            "fee": "0.00958",
            "hash": "0xfb0ba568213d11230cd34d62fddd1cc1fe11fdc173l4f2007b0e47a06ad73d20",
            "address": "0xd959463c3fcb222124bb7bb642d6a6573a6c5aba",
            "confirmations": 20
        }
      },
      {
        "id": 36896428,
        "created_at": "2020-11-12T10:27:26.135Z",
        "updated_at": "2020-11-12T10:42:29.065Z",
        "status": "SUCCESS",
        "type": "DEPOSIT",
        "subtype": "BLOCKCHAIN",
        "native": {
            "tx_id": "a271ad64-5f34-4115-a63e-1cb5bbe4f67e",
            "index": 429625504,
            "currency": "BTC",
            "amount": "0.04836614",
            "hash": "4d7ae7c9d6fe84405ae167b3f0beacx8c68eb5a9d5189bckeb65d5e306427oe6",
            "address": "3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv",
            "confirmations": 2,
            "senders": [
              "0xd959463c3fcb0d2124bb7ac642d6a6573a6c5aba"
            ]
        }
      }
    ]
    

    GET /api/3/wallet/transactions

    Returns all transactions or a number of transactions by identifiers.

    Requires the "Payment information" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    from DateTime Interval initial value (inclusive).
    till DateTime Interval end value (inclusive).
    types String Comma-separated transaction types. The list of supported types may be expanded in future versions.
    Accepted values: DEPOSIT, WITHDRAW, TRANSFER, SWAP
    subtypes String Comma-separated transaction subtypes. Some subtypes are reserved for future use and do not purport to provide any functionality on the platform. The list of supported subtypes may be expanded in future versions.
    Accepted values: UNCLASSIFIED, BLOCKCHAIN, AIRDROP, AFFILIATE, STAKING, BUY_CRYPTO, OFFCHAIN, FIAT, SUB_ACCOUNT, WALLET_TO_SPOT, SPOT_TO_WALLET, WALLET_TO_DERIVATIVES, DERIVATIVES_TO_WALLET, CHAIN_SWITCH_FROM, CHAIN_SWITCH_TO, INSTANT_EXCHANGE
    statuses String Comma-separated transaction statuses.
    Accepted values: CREATED, PENDING, FAILED, SUCCESS, ROLLED_BACK
    currencies String Comma-separated currency codes.
    id_from Number Index interval initial value.
    Accepted values: 0 or greater
    id_till Number Index interval end value.
    Accepted values: 0 or greater
    tx_ids String Comma-separated transaction identifiers.
    order_by String Defines sorting type.
    Accepted values: created_at, id
    Default value: created_at
    sort String Sort direction.
    Accepted values: DESC, ASC
    Default value: DESC
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    GET /api/3/wallet/transactions/{tx_id}

    Returns transaction by identifier.

    Requires the "Payment information" API key Access Right.

    Response:

    Name Type Description
    id Number Transaction unique identifier as assigned by exchange.
    status String Transaction status.
    Possible values: CREATED, PENDING, FAILED, SUCCESS, ROLLED_BACK
    type String Transaction type. The list of supported types may be expanded in future versions.
    Possible values: DEPOSIT, WITHDRAW, TRANSFER, SWAP
    subtype String Transaction subtype. Some subtypes are reserved for future use and do not purport to provide any functionality on the platform. The list of supported subtypes may be expanded in future versions.
    Possible values: UNCLASSIFIED, BLOCKCHAIN, AIRDROP, AFFILIATE, STAKING, BUY_CRYPTO, OFFCHAIN, FIAT, SUB_ACCOUNT, WALLET_TO_SPOT, SPOT_TO_WALLET, WALLET_TO_DERIVATIVES, DERIVATIVES_TO_WALLET, CHAIN_SWITCH_FROM, CHAIN_SWITCH_TO, INSTANT_EXCHANGE
    created_at DateTime Date of transaction creation.
    updated_at DateTime Date of transaction last update.
    native Native Optional. Transaction native attributes as assigned by the platform.
    meta Meta Optional. Additional attributes assigned to certain types of transactions.

    Native model consists of:

    Name Type Description
    tx_id String Transaction unique identifier as assigned by exchange.
    index Number Internal index value that represents when the entry was updated.
    currency String Currency code.
    amount Number Amount of funds.
    fee Number Payment commission value.
    address String Address identifier.
    payment_id String Optional parameter.
    hash String Transaction hash.
    offchain_id String Transaction identifier of external system.
    confirmations Number Current count of confirmations for transaction in network.
    public_comment String Optional parameter.
    error_code String Payout error reason.
    Possible values: INVALID_ADDRESS, INVALID_PAYMENT_ID, BAD_PRECISION
    senders Array of String Senders for this payin transaction. Shown only for payins.

    Meta model consists of:

    Name Type Description
    fiat_to_crypto JSON Attributes of a fiat deposit (for subtype = FIAT):
    id Number Transaction identifier as assigned by provider.
    provider_name String Provider name.
    order_type String Transaction type.
    source_currency String Source currency code.
    target_currency String Destination currency code.
    wallet_address String Wallet address assigned by provider
    tx_hash String Transaction hash.
    target_amount String Amount in the target currency.
    source_amount String Amount in the source currency.
    status String Transaction status.
    Possible values: ACTIVE, INACTIVE
    created_at DateTime Transaction creation date.
    updated_at DateTime Date of transaction last update.
    deleted_at DateTime Date of transactions deletion.
    payment_method_type String Payment system alias.

    Check If Offchain is Available

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/check-offchain-available?currency=ETH&address=0xfaEF4bE10dDF50B68c220c9ab19381e20B8EEB2B"
    
    {
        "result": true
    }
    

    POST /api/3/wallet/crypto/check-offchain-available

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    currency String Currency code.
    address String Address identifier.
    payment_id String Optional parameter.

    Response:

    Name Type Description
    result String true if an offchain transaction is available to the specified address.

    Estimate Withdrawal Fee

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/crypto/fee/estimate?currency=BTC&amount=0.01"
    
    {
        "fee": "0.000625"
    }
    

    GET /api/3/wallet/crypto/fee/estimate

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    currency String Currency code.
    amount Number The amount that will be withdrawn.

    Response:

    Name Type Description
    fee String Estimated withdrawal fee.

    Airdrops

    Get Airdrops

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/airdrops"
    
    [
        {
            "id": 3, 
            "created_at": "2021-07-29T12:07:09.883538Z",  
            "updated_at": "2021-08-04T12:54:59.301077Z",         
            "currency": "BTC",        
            "base_currency": "usd",
            "description": "test airdrop",
            "start_time": "2021-07-19T07:00:00Z",
            "end_time": "2022-07-19T07:00:00Z",
            "amount": "0.1",
            "status": "committed",
            "transaction_id": "85032346-7b90-4bdc-85ee-1f01e2390076"
        }
    ]
    

    GET /api/3/wallet/airdrops

    The request above returns the list of Airdrops.

    Requires the "Payment information" API key Access Right.

    All parameters are optional.

    Parameters:

    Name Type Description
    currency String The code of dropped currency.
    base_currency String The code of base currency (the currency used for dropped currency amount calculation).
    active_at DateTime The request returns Airdrops, active at the specified moment.
    Default value: now
    statuses Array An array of desired Airdrop statuses.
    Accepted values:
    - available — ready for claim
    - claimed — the Airdrop has been requested already
    - pending — the payment is in progress
    - committed — the payment is finished
    transaction_id String Airdrop transaction identifier.

    Response:

    Name Type Description
    id Number Airdrop identifier.
    created_at DateTime The moment when an Airdrop was created.
    updated_at DateTime The moment when an Airdrop was changed.
    currency String The code of dropped currency.
    base_currency String The code of base currency (the currency used for dropped currency amount calculation).
    description String Text note.
    start_time DateTime The moment when an Airdrop claiming became available for the users.
    end_time DateTime The moment when an Airdrop claiming will become unavailable for the users.
    amount String The user's claimed amount.
    status String Airdrop status.
    Possible values:
    - available — ready for claim
    - claimed — the Airdrop has been requested already
    - pending — the payment is in progress
    - committed — the payment is finished
    transaction_id String Optional. Airdrop transaction identifier.

    Claim Airdrop

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/airdrops/3/claim"
    
    {}
    

    POST /api/3/wallet/airdrops/{id}/claim

    Claim an airdrop by its identifier.

    Requires the "Withdraw cryptocurrencies" API key Access Right.

    Parameters:

    Name Type Description
    currency String The code of dropped currency.

    Get Amount Locks

    curl -X POST -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/wallet/amount-locks?currency=USD"
    
    [
        {
            "id": 1,
            "currency": "BTC",
            "amount": "12.023",
            "date_end": "",
            "description": "default",
            "cancelled": false,
            "cancelled_at": null,
            "cancel_description": null,
            "created_at": "2021-07-29T12:07:09.883538Z"
        }
    ]
    

    GET /api/3/wallet/amount-locks

    Returns a list of amount locks.

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    currency String Optional. Currency code.
    active Boolean Optional. Value showing whether the lock is active.
    limit Number Default value: 100
    Accepted range: 0 – 1000
    offset Number Optional. Default value: 0
    Min value: 0
    from DateTime Optional. Interval initial value (inclusive).
    till DateTime Optional. Interval end value (exclusive).

    Response:

    Name Type Description
    id Number Lock identifier.
    currency String Currency code.
    amount String Reserved amount.
    date_end DateTime The date and time of the lock expiration.
    description String Lock text description.
    cancelled Boolean Value showing whether the lock was cancelled.
    cancelled_at DateTime The date and time of the lock was cancelled.
    cancel_description String Text description on cancellation.
    created_at DateTime The date and time of the lock was created.

    Sub-accounts

    Get Sub-accounts List

    curl -X GET -u "apiKey:secretKey" "https://api.pro.changelly.com/api/3/sub-account"
    

    Response:

    {
        "result": [
            {
                "sub_account_id": "179B5D",
                "email": "[email protected]",
                "status": "active"
            },
            {
                "sub_account_id": "179B5E",
                "email": "[email protected]",
                "status": "active"
            },
            {
                "sub_account_id": "179B5F",
                "email": "[email protected]",
                "status": "disable"
            }
        ]
    }
    

    Error response example:

    Failed authorization:

    {
        "error": {
            "code": 1002,
            "message": "Authorization is required or has been failed"
        }
    }
    

    Empty sub-account's list:

    {
        "result": []
    }
    

    GET /api/3/sub-account

    Returns list of sub-accounts per a super account.

    Requires no API key Access Rights.

    Response:

    Name Type Description
    sub_account_id String Unique identifier of a sub-account. Hex number.
    email String Email address of a sub-account.
    status String User status of a sub-account. Possible values: new, active, disable

    Freeze Sub-account

    curl -X POST -u "apiKey:secretKey" "https://api.pro.changelly.com/api/3/sub-account/freeze" \
        -d "sub_account_ids=179B5D,179B5E"
    

    Response:

    {
        "result": true
    }
    

    Error response example:

    Sub-accounts are already frozen or disabled:

    {
        "error": {
            "code": 21004,
            "message": "Sub account is already frozen or disabled"
        }
    }
    

    POST /api/3/sub-account/freeze

    Freezes sub-accounts listed. It implies that the Sub-accounts frozen wouldn't be able to:

    For any sub-account listed, all orders will be canceled and all funds will be transferred form the Trading balance.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    sub_account_ids Array Sub-accounts' identifiers separated by commas (,). Those could be obtained by the GET /api/3/sub-account request.

    Response:

    Name Type Description
    result Boolean Value indicating whether sub-accounts were successfully frozen.

    Activate Sub-account

    curl -X POST -u "apiKey:secretKey" "https://api.pro.changelly.com/api/3/sub-account/activate" \
        -d 'sub_account_ids=179B5D,179B5E'
    

    Response:

    {
        "result": true
    }
    

    Error response example:

    Sub-accounts are disabled, and their functionality can't be restored through activation:

    {
        "result": false
    }
    

    Failed authorization:

    {
        "error": {
            "code": 1002,
            "message": "Authorization is required or has been failed"
        }
    }
    

    Wrong input data format:

    {
        "error": {
            "code": 10001,
            "message": "Validation error"
        }
    }
    

    Sub-accounts listed don't exist:

    {
        "error": {
            "code": 21001,
            "message": "Cannot find sub account"
        }
    }
    

    POST /api/3/sub-account/activate

    Activates sub-accounts listed. It would make sub-accounts active after being frozen.

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    sub_account_ids Array Sub-accounts' identifiers separated by commas (,). Those could be obtained by the GET /api/3/sub-account request.

    Response:

    Name Type Description
    result Boolean Value indicating whether sub-accounts were successfully activated.

    Transfer Funds

    curl -X POST -u "apiKey:secretKey" "https://api.pro.changelly.com/api/3/sub-account/transfer" \
        -d "sub_account_id=179B5D&amount=1&currency=BTC&type=to_sub_account"
    

    Response:

    {
        "result": "ae37e806-0191-45fc-8c49-18137274772c"
    }
    

    Error response example:

    Insufficient permissions:

    {
        "error": {
            "code": 1003,
            "message": "Action is forbidden for this API key"
        }
    }
    

    Sub-account is frozen or disabled:

    {
        "error": {
            "code": 21004,
            "message": "Sub account is already frozen or disabled"
      }
    }
    

    Insufficient funds:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        }
    }
    

    POST /api/3/sub-account/transfer

    Transfers funds from the super-account to a sub-account or from a sub-account to the super-account.

    Requires the "Withdraw cryptocurrencies" API key Access Right.

    Parameters:

    Name Type Description
    sub_account_id Number Identifier of a sub-account to deposit/withdraw funds.
    amount Number Amount of funds to be transferred.
    currency String Name (code) of base currency (e.g., "BTC").
    type String Type of transaction. Accepted values: to_sub_account, from_sub_account

    Response:

    Name Type Description
    result String Identifier of the transaction resulting.

    Get ACL Settings

    curl -X GET -u "apiKey:secretKey" "https://api.pro.changelly.com/api/3/sub-account/acl?sub_account_ids=179B5D,179B5E"
    

    Response:

    {
        "result": [
          {
            "sub_account_id": "179B5E",
            "deposit_address_generation_enabled": true,
            "withdraw_enabled": true,
            "description": "",
            "created_at": "2021-07-30T14:50:08.621Z",
            "updated_at": "2021-07-30T14:50:08.621Z"
          }
        ]
    }
    

    Error response example:

    Insufficient permissions:

    {
        "error": {
            "code": 1003,
            "message": "Action is forbidden for this API key"
        }
    }
    

    Sub-account is frozen or disabled:

    {
        "error": {
            "code": 21004,
            "message": "Sub account is already frozen or disabled"
        }
    }
    

    GET /api/3/sub-account/acl

    Returns a list of withdrawal settings for sub-accounts listed.

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    sub_account_ids Array Optional. Sub-accounts' identifiers separated by commas (,). Those could be obtained by the GET /api/3/sub-account request.

    Response:

    Name Type Description
    sub_account_id String Unique identifier of a sub-account.
    deposit_address_generation_enabled Boolean Value indicating the desired state of deposits.
    withdraw_enabled Boolean Value indicating the desired state of withdrawals.
    description String Textual description. Normally left empty.
    created_at DateTime ACL creation time.
    updated_at DateTime ACL update time.

    Change ACL Settings

    curl -X POST -u "apiKey:secretKey" "https://api.pro.changelly.com/api/3/sub-account/acl?sub_account_ids=179B5E&deposit_address_generation_enabled=true&withdraw_enabled=true"
    

    Response:

    {
        "result": [
          {
            "sub_account_id": "179B5E",
            "deposit_address_generation_enabled": true,
            "withdraw_enabled": true,
            "description": "",
            "created_at": "2021-07-30T14:50:08.621Z",
            "updated_at": "2021-07-30T14:50:08.621Z"
          }
        ]
    }
    

    Error response example:

    Sub-account is frozen or disabled:

    {
        "error": {
            "code": 21004,
            "message": "Sub account is already frozen or disabled"
        }
    }
    

    Insufficient permissions:

    {
        "error": {
            "code": 1003,
            "message": "Action is forbidden for this API key"
        }
    }
    

    POST /api/3/sub-account/acl

    Disables or enables withdrawals for a sub-account.

    Requires the "Payment information" API key Access Right.

    Parameters:

    Name Type Description
    sub_account_ids Array Sub-accounts' identifiers separated by commas (,). Those could be obtained by the GET /api/3/sub-account request.
    deposit_address_generation_enabled Boolean Value indicating the desired state of deposits.
    withdraw_enabled Boolean Value indicating the desired state of withdrawals.
    description String Textual description. Normally left empty.
    created_at DateTime ACL creation time.
    updated_at DateTime ACL update time.

    Response:

    Name Type Description
    sub_account_id String Unique identifier of a sub-account.
    deposit_address_generation_enabled Boolean Value indicating the desired state of deposits.
    withdraw_enabled Boolean Value indicating the desired state of withdrawals.
    description String Textual description. Normally left empty.
    created_at DateTime ACL creation time.
    updated_at DateTime ACL update time.

    Get Sub-account Balance

    curl -X GET -u "apiKey:secretKey" "https://api.pro.changelly.com/api/3/sub-account/balance/179B5E"
    

    Response:

    {
        "result": {
            "wallet": [
              {
                "currency": "1ST",
                "available": "0.0",
                "reserved": "0.0"
              }
            ],
            "derivatives": [
              {
                "currency": "1ST",
                "available": "0",
                "reserved": "0"
              }
            ],
            "spot": [
              {
                "currency": "1ST",
                "available": "0",
                "reserved": "0",
                "reserved_margin": "0"
              }
            ]
        }
    }
    

    Error response example:

    Insufficient permissions:

    {
        "error": {
            "code": 1003,
            "message": "Action is forbidden for this API key"
        }
    }
    

    GET /api/3/sub-account/balance/{subAccID}

    Returns non-zero balance values by sub-account identifier specified. Report will include the wallet and Trading balances for each currency. It is functional with no regard to the state of a sub-account. All account types are optional and appears only in case of non-zero balance.

    Requires the "Payment information" API key Access Right.

    Get Sub-account Crypto Address

    curl -X GET -u "apiKey:secretKey" \
        "https://api.pro.changelly.com/api/3/sub-account/crypto/address/179B5E/BTC"
    

    Response:

    {
        "result": {
            "address": "3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv"
        }
    }
    

    GET /api/3/sub-account/crypto/address/{subAccID}/{currency}

    Returns sub-account crypto address for currency.

    Requires the "Payment information" API key Access Right.

    Response:

    Name Type Description
    address String Address for deposit.
    payment_id String Optional. If this parameter is returned for specific currency, it is required for deposit.
    public_key String Optional. If this parameter is returned for specific currency, it is required for deposit.

    Socket API Reference

    Request Object

    Request

    {
        "method": "spot_new_order",
        "params": {
            "client_order_id": "57d5525562c945448e3cbd559bd068c4",
            "symbol": "ETHBTC",
            "side": "sell",
            "price": "0.059837",
            "quantity": "0.015"
        },
        "id": 123
    }
    

    An RPC call is represented by sending a Request object to a Server.

    The Request object has the following members:

    Notification

    Notification

    {
        "ch": "trades",
        "update": {
            "BTCUSDT": [{
                "t": 1626861123552,
                "i": 1626861123552,
                "p": "30877.68",
                "q": "0.00006",
                "s": "sell"
            }]
        }
    }
    

    A Notification is a Request object without an id member. A Request object (a Notification) signifies the lack of the Client's interest in the corresponding Response object. Therefore, no Response objects need to be returned to the Client.

    The Notification object has the following members:

    Response Object

    When a RPC call is made, the Server MUST reply with a Response, except for Notifications cases.

    Response on success subscription is true. Example:

    Response

    {
        "result": true,
        "id": 123
    }
    

    Response error

    {
        "error": {
            "code": 2001,
            "message": "Symbol not found",
            "description": "Symbol not found"
        },
        "id": 123
    }
    

    The Response is represented as a single JSON Object, with the following members:

    Socket Market Data

    In order to access market data via WebSocket interface, connect to the endpoint:

    wscat -c wss://api.pro.changelly.com/api/3/ws/public
    

    Request

    {
        "method": "subscribe",
        "ch": "orderbook/top/1000ms",           // Channel
        "params": {
            "symbols": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    From that point on, you will be able to send request messages in JSON format with the following parameters:

    Name Type Description
    method String The name of the method to be invoked.
    Accepted values: subscribe, unsubscribe, subscriptions
    ch String Channel name.
    params JSON Parameter values to be used during the method invocation. The set of parameters may vary depending on the channel chosen.
    id String Optional. Request identifier as assigned by sender.

    Response

    {
        "result": {
            "ch": "orderbook/top/1000ms",       // Channel
            "subscriptions": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Any valid and successfully processed request will result in a JSON-formatted response message containing the following fields:

    Name Type Description
    result Result Details about resulting subscription status.
    id String Optional. Request identifier as assigned by sender.

    Result model consists of:

    Name Type Description
    ch String Channel name.
    subscriptions Array of String List of active subscriptions.

    Subscriptions

    In case of a successful subscriptions, the server will send:

    In the second case, the first snapshot comes right after the response if the limit parameter is greater than 0. Snapshot gives a full account of the market within the defined scope, and an update contains only recent changes which are being sent immediately.

    Batch Notifications

    If a market data request includes a number subscriptions, your choice of channel will determine the distribution of updates over incoming notifications.

    In the basic scenario, a single notification will contain data on a particular symbol only. Subscription to "batch" channels (ones ending with /batch) allows notifying via combined updates per multiple symbols.

    Get Active Subscriptions

    Request

    {
        "method": "subscriptions",
        "ch": "trades",                         // Channel
        "params": {},
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "trades",                     // Channel
            "subscriptions": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Method: subscriptions

    Returns the list of all active subscriptions on a channel.

    Subscribe to Trades

    Request

    {
        "method": "subscribe",
        "ch": "trades",                         // Channel
        "params": {
            "symbols": ["ETHBTC", "BTCUSDT"],
            "limit": 1
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "trades",                     // Channel
            "subscriptions": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Notification snapshot

    {
        "ch": "trades",                         // Channel
        "snapshot": {
            "BTCUSDT": [{
                "t": 1626861109494,             // Timestamp in milliseconds
                "i": 1626861109494,             // Trade identifier
                "p": "30881.96",                // Price
                "q": "12.66828",                // Quantity
                "s": "buy"                      // Side
            }]
        }
    }
    

    Notification update

    {
        "ch": "trades",
        "update": {
            "BTCUSDT": [{
                "t": 1626861123552,
                "i": 1626861123552,
                "p": "30877.68",
                "q": "0.00006",
                "s": "sell"
            }]
        }
    }
    

    Channel: trades

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes.
    limit Number Optional. Limit to returned entries.
    Accepted values: 0 – 1000
    Default value: 0 (no history returned)

    Subscribe to Candles

    Request

    {
        "method": "subscribe",
        "ch": "candles/M1",                     // Channel
        "params": {
            "symbols": ["BTCUSDT"],
            "limit": 10
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "candles/M1",
            "subscriptions": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Notification snapshot

    {
        "ch": "candles/M1",                     // Channel
        "snapshot": {
            "BTCUSDT": [{
                "t": 1626860340000,             // Message timestamp
                "o": "30881.95",                // Open price
                "c": "30890.96",                // Last price
                "h": "30900.8",                 // High price
                "l": "30861.27",                // Low price
                "v": "1.27852",                 // Base asset volume
                "q": "39493.9021811"            // Quote asset volume
            }, {
                "t": 1626860400000,
                "o": "30888.33",
                "c": "30860.52",
                "h": "30889.53",
                "l": "30860.31",
                "v": "3.80019",
                "q": "117283.0686182"
            }, {
                "t": 1626860460000,
                "o": "30858.39",
                "c": "30863.56",
                "h": "30864.89",
                "l": "30853.83",
                "v": "53.04288",
                "q": "1636858.7119248"
            }]
        }
    }
    

    Notification update

    {
        "ch": "candles/M1",
        "update": {
            "ETHBTC": [{
                "t": 1626860880000,
                "o": "0.060711",
                "c": "0.060749",
                "h": "0.060749",
                "l": "0.060711",
                "v": "12.2800",
                "q": "0.7455339675"
          }]
        }
    }
    

    Channel: candles/{period}

    Supported periods: M1 (one minute), M3, M5, M15, M30, H1 (one hour), H4, D1 (one day), D7, 1M (one month)

    Requires no API key Access Rights.

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes.
    limit Number Optional. Limit to returned entries.
    Accepted values: 0 – 1000
    Default value: 0 (no history returned)

    Subscribe to Mini Ticker

    Request

    {
        "method": "subscribe",
        "ch": "ticker/price/1s",                // Channel
        "params": {
            "symbols": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "ticker/price/1s",            // Channel
            "subscriptions": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "ticker/price/1s",
        "data": {
            "ETHBTC": {
                "t": 1614815872000,             // Timestamp in milliseconds
                "o": "0.030781",                // Open price
                "c": "0.060043",                // Last price
                "h": "0.031788",                // High price
                "l": "0.030733",                // Low price
                "v": "62.587",                  // Base asset volume
                "q": "1.951420577"              // Quote asset volume
            }
        }
    }
    
    {
        "ch": "ticker/price/1s",
        "data": {
            "BTCUSDT": {
                "t": 1614815872030,
                "o": "32636.79",
                "c": "32085.51",
                "h": "33379.92",
                "l": "30683.28",
                "v": "11.90667",
                "q": "384081.1955629"
            }
        }
    }
    

    Channel: ticker/price/{speed}

    Supported speed: 1s, 3s

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Mini Ticker in Batches

    Request

    {
        "method": "subscribe",
        "ch": "ticker/price/1s/batch",          // Channel
        "params": {
            "symbols": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "ticker/price/1s/batch",      // Channel
            "subscriptions": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "ticker/price/1s/batch",
        "data": {
            "ETHBTC": {
                "t": 1614815872000,             // Timestamp in milliseconds
                "o": "0.030781",                // Open price
                "c": "0.060043",                // Last price
                "h": "0.031788",                // High price
                "l": "0.030733",                // Low price
                "v": "62.587",                  // Base asset volume
                "q": "1.951420577"              // Quote asset volume
            },
            "BTCUSDT": {
                "t": 1614815872030,
                "o": "32636.79",
                "c": "32085.51",
                "h": "33379.92",
                "l": "30683.28",
                "v": "11.90667",
                "q": "384081.1955629"
            }
        }
    }
    

    Channel: ticker/price/{speed}/batch

    Supported speed: 1s, 3s

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Ticker

    Request

    {
        "method": "subscribe",
        "ch": "ticker/1s",                      // Channel
        "params": {
            "symbols": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "ticker/1s",                  // Channel
            "subscriptions": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "ticker/1s",
        "data": {
            "ETHBTC": {
                "t": 1614815872000,             // Timestamp in milliseconds
                "a": "0.031175",                // Best ask
                "A": "0.03329",                 // Best ask quantity
                "b": "0.031148",                // Best bid
                "B": "0.10565",                 // Best bid quantity
                "c": "0.031210",                // Last price
                "o": "0.030781",                // Open price
                "h": "0.031788",                // High price
                "l": "0.030733",                // Low price
                "v": "62.587",                  // Base asset volume
                "q": "1.951420577",             // Quote asset volume
                "p": "0.000429",                // Price change
                "P": "1.39",                    // Price change percent
                "L": 1182694927                 // Last trade identifier
          }
        }
    }
    
    {
        "ch": "ticker/1s",
        "data": {
          "BTCUSDT": {
                "t": 1614815872050,
                "a": "32289.55",
                "A": "0.41210",
                "b": "32286.67",
                "B": "1.70049",
                "c": "0.057069",
                "o": "0.030545",
                "h": "0.029653",
                "l": "0.031804",
                "v": "11.90667",
                "q": "384081.1955629",
                "p": "0.003131",
                "P": "2.77",
                "L": 1182694927
          }
        }
    }
    

    Channel: ticker/{speed}

    Supported speed: 1s, 3s

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Ticker in Batches

    Request

    {
        "method": "subscribe",
        "ch": "ticker/1s/batch",                // Channel
        "params": {
            "symbols": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "ticker/1s/batch",            // Channel
            "subscriptions": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "ticker/1s/batch",
        "data": {
            "ETHBTC": {
                "t": 1614815872000,             // Timestamp in milliseconds
                "a": "0.031175",                // Best ask
                "A": "0.03329",                 // Best ask quantity
                "b": "0.031148",                // Best bid
                "B": "0.10565",                 // Best bid quantity
                "c": "0.031210",                // Last price
                "o": "0.030781",                // Open price
                "h": "0.031788",                // High price
                "l": "0.030733",                // Low price
                "v": "62.587",                  // Base asset volume
                "q": "1.951420577",             // Quote asset volume
                "p": "0.000429",                // Price change
                "P": "1.39",                    // Price change percent
                "L": 1182694927                 // Last trade identifier
          },
          "BTCUSDT": {
                "t": 1614815872050,
                "a": "32289.55",
                "A": "0.41210",
                "b": "32286.67",
                "B": "1.70049",
                "c": "0.057069",
                "o": "0.030545",
                "h": "0.029653",
                "l": "0.031804",
                "v": "11.90667",
                "q": "384081.1955629",
                "p": "0.003131",
                "P": "2.77",
                "L": 1182694927
          }
        }
    }
    

    Channel: ticker/{speed}/batch

    Supported speed: 1s, 3s

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Full Order Book

    Request

    {
        "method": "subscribe",
        "ch": "orderbook/full",                 // Channel
        "params": {
            "symbols": ["ETHBTC"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "orderbook/full",             // Channel
            "subscriptions": ["ETHBTC"]
        },
        "id": 123
    }
    

    Notification snapshot

    {
        "ch": "orderbook/full",                 // Channel
        "snapshot": {
            "ETHBTC": {
                "t": 1626866578796,             // Timestamp in milliseconds
                "s": 27617207,                  // Sequence number  
                "a": [                          // Asks
                    ["0.060506", "0"],
                    ["0.060549", "12.6431"],
                    ["0.060570", "0"],
                    ["0.060612", "0"]
                ],
                "b": [                          // Bids
                    ["0.060439", "4.4095"],
                    ["0.060414", "0"],
                    ["0.060407", "7.3349"],
                    ["0.060390", "0"]
                ]
            }
        }
    }
    

    Notification update

    {
        "ch": "orderbook/full",
        "update": {
            "ETHBTC": {
                "t": 1626866578902,
                "s": 27617208,
                "a": [
                    ["0.060508", "0"],
                    ["0.060509", "2.5486"]
                ],
                "b": [
                    ["0.060501", "3.9000"],
                    ["0.060500", "3.0459"]
                ]
            }
        }
    }
    

    Channel: orderbook/full

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes.

    Subscribe to Partial Order Book

    Request

    {
        "method": "subscribe",
        "ch": "orderbook/D5/100ms",             // Channel
        "params": {
            "symbols": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "orderbook/D5/100ms",         // Channel
            "subscriptions": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "orderbook/D5/100ms",             // Channel
        "data": {
            "BTCUSDT": {
                "t": 1626958488996,             // Timestamp in milliseconds  
                "s": 29472321,                  // Sequence number
                "a": [                          // Asks
                    ["32091.84", "0.01016"],
                    ["32091.85", "0.41484"],
                    ["32095.82", "0.00705"],
                    ["32095.95", "0.52001"],
                    ["32097.04", "0.20518"]
                ],
                "b": [                          // Bids
                    ["32089.29", "0.00228"],
                    ["32088.70", "0.40315"],
                    ["32084.29", "0.00616"],
                    ["32084.27", "0.53169"],
                    ["32078.89", "0.01016"]
                ]
            },
            "ETHBTC": {
                "t": 1626958488990,
                "s": 28438797,
                "a": [
                    ["0.061873", "4.8257"],
                    ["0.061887", "1.9938"],
                    ["0.061912", "0.5427"],
                    ["0.061913", "0.1696"],
                    ["0.061914", "0.1575"]
                ],
                "b": [
                    ["0.061867", "0.9868"],
                    ["0.061858", "0.1598"],
                    ["0.061854", "1.8327"],
                    ["0.061850", "0.8125"],
                    ["0.061842", "0.1763"]
                ]
            }
        }
    }
    

    Channel: orderbook/{depth}/{speed}

    Supported depth: D5, D10, D20

    Supported speed: 100ms, 500ms, 1000ms

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Partial Order Book in Batches

    Request

    {
        "method": "subscribe",
        "ch": "orderbook/D5/1000ms/batch",      // Channel
        "params": {
            "symbols": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "orderbook/D5/1000ms/batch",  // Channel
            "subscriptions": ["ETHBTC","BTCUSDT"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "orderbook/D5/1000ms/batch",      // Channel
        "data": {
            "BTCUSDT": {
                "t": 1626958488996,             // Timestamp in milliseconds  
                "s": 29472321,                  // Sequence number
                "a": [                          // Asks
                    ["32091.84", "0.01016"],
                    ["32091.85", "0.41484"],
                    ["32095.82", "0.00705"],
                    ["32095.95", "0.52001"],
                    ["32097.04", "0.20518"]
                ],
                "b": [                          // Bids
                    ["32089.29", "0.00228"],
                    ["32088.70", "0.40315"],
                    ["32084.29", "0.00616"],
                    ["32084.27", "0.53169"],
                    ["32078.89", "0.01016"]
                ]
            },
            "ETHBTC": {
                "t": 1626958488990,
                "s": 28438797,
                "a": [
                    ["0.061873", "4.8257"],
                    ["0.061887", "1.9938"],
                    ["0.061912", "0.5427"],
                    ["0.061913", "0.1696"],
                    ["0.061914", "0.1575"]
                ],
                "b": [
                    ["0.061867", "0.9868"],
                    ["0.061858", "0.1598"],
                    ["0.061854", "1.8327"],
                    ["0.061850", "0.8125"],
                    ["0.061842", "0.1763"]
                ]
            }
        }
    }
    

    Channel: orderbook/{depth}/{speed}/batch

    Supported depth: D5, D10, D20

    Supported speed: 100ms, 500ms, 1000ms

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Top of Book

    Request

    {
        "method": "subscribe",
        "ch": "orderbook/top/1000ms",           // Channel
        "params": {
            "symbols": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "orderbook/top/1000ms",       // Channel
            "subscriptions": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Data notifications

    {
        "ch": "orderbook/top/1000ms",
        "data": {
            "ETHBTC": {
                "t": 1626954648761,             // Timestamp in milliseconds
                "a": "0.062135",                // Best ask
                "A": "4.1591",                  // Best ask quantity
                "b": "0.062124",                // Best bid
                "B": "0.9877"                   // Best bid quantity
            }
        }
    }
    
    {
        "ch": "orderbook/top/1000ms",
        "data": {
            "BTCUSDT": {
                "t": 1626954648863,
                "a": "31936.09",
                "A": "1.30000",
                "b": "31933.40",
                "B": "0.00058"
            }
        }
    }
    

    Channel: orderbook/top/{speed}

    Supported speed: 100ms, 500ms, 1000ms

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Top of Book in Batches

    Request

    {
        "method": "subscribe",
        "ch": "orderbook/top/100ms/batch",      // Channel
        "params": {
            "symbols": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "orderbook/top/100ms/batch",  // Channel
            "subscriptions": ["ETHBTC", "BTCUSDT"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "orderbook/top/100ms/batch",
        "data": {
            "ETHBTC": {
                "t": 1614815872000              // Timestamp in milliseconds
                "a": "0.031175",                // Best ask
                "A": "0.4033",                  // Best ask quantity
                "b": "0.031148",                // Best bid
                "B": "0.3649",                  // Best bid quantity
            },
            "BTCUSDT": {
                "t": 1614815872005
                "a": "0.031175",
                "A": "0.4033",
                "b": "0.031148",
                "B": "0.3649",
            }
        }
    }
    

    Channel: orderbook/top/{speed}/batch

    Supported speed: 100ms, 500ms, 1000ms

    Parameters:

    Name Type Description
    symbols Array of String List of symbol codes. Value ["*"] means all symbols are selected.

    Subscribe to Futures Information

    Request

    {
        "method": "subscribe",
        "ch": "futures/info",                   // Channel
        "params": {
            "symbols": ["*"]
        },
        "id": 123
    }
    

    Response

    {
        "result": {
            "ch": "futures/info",               // Channel
            "subscriptions": ["BTCUSDT_PERP"]
        },
        "id": 123
    }
    

    Data notification

    {
        "ch": "futures/info",
        "data": {
            "BTCUSDT_PERP": {
                "t": 1626861214235,             // Timestamp in milliseconds
                "m": "30873.48",                // Mark price
                "i": "30871.12",                // Index price
                "p": "0.000045936718467837",    // Premium index
                "P": "0.000087063368020112",    // Average premium index
                "o": "93.7128",                 // Open interest
                "r": "0.0001",                  // Funding rate
                "R": "0.0001",                  // Indicative funding rate
                "I": "0.0001",                  // Contract interest rate for one funding period
                "T": 1626883200000              // Next funding date
            }
        }
    }
    

    Channel: futures/info

    Parameters:

    Name Type Description
    symbols Array of String List of contract codes. Value ["*"] means all symbols are selected.

    Socket Session Authentication

    Example with Basic algorithm:

    
    wscat -c wss://api.pro.changelly.com/api/3/ws/trading
    
    {
        "method": "login",
        "params": {
            "type": "Basic",
            "api_key": "3ef4a9f8c8bf04bd8f09884b98403eae",
            "secret_key": "2deb570ab58fd553a4ed3ee249fd2d51"
        }
    }
    

    Example with HS256 algorithm:

    
    wscat -c wss://api.pro.changelly.com/api/3/ws/trading
    
    {
        "method": "login",
        "params": {
            "type": "HS256",
            "api_key": "3ef4a9f8c8bf04bd8f09884b98403eae",
            "timestamp": 1626861109494,
            "signature": "b1c0ae399c2d341866a214f7d3ed755b821c1c36fc6f17083ef05fbb55b7f986"
        }
    }
    

    Signature generation example

    from websocket import create_connection
    import websocket
    import json
    from hashlib import sha256
    from hmac import HMAC
    from time import time
    
    timestamp = int(time() * 1000)
    api_key = "3ef4a9f8c8bf04bd8f09884b98403eae"
    secret = "2deb570ab58fd553a4ed3ee249fd2d51"
    window = 10000
    message = str(timestamp)
    
    if window:
         message += str(window)
    
    ws = create_connection('wss://api.pro.changelly.com/api/3/ws/trading')
    sign = HMAC(key=secret.encode(),
                msg=message.encode(),
                digestmod=sha256).hexdigest()
    res = ws.send(json.dumps({"method": "login", "params": {"type": "HS256", "api_key": api_key, "timestamp": timestamp, "window": window, "signature": sign}}))
    print(ws.recv())
    

    Request method: login

    Parameters:

    Name Type Description
    type String Encryption algorithm.
    Accepted values: Basic, HS256
    api_key String API public key.
    secret_key String API secret key, required on Basic algorithm.
    timestamp Number Timestamp in milliseconds, required on HS256 algorithm.
    window Number Optional. Maximum difference between timestamp and the moment of request processing in seconds. Specified only on the HS256 algorithm.
    Accepted range: 0 – 60000
    Default value: 10000
    signature String HMAC SHA256 sign with API secret key, required on HS256 algorithm.

    Socket Trading

    Trade via socket has some major differences compared to REST:

    Socket Spot Trading

    Subscribe to Reports

    Request

    wscat -c wss://api.pro.changelly.com/api/3/ws/trading
    
    {
        "method": "spot_subscribe",
        "params": {},
        "id": 123
    }
    

    Subscription result:

    {
        "jsonrpc": "2.0",
        "result":true,
        "id": 1234
    }
    

    Notification Spot orders snapshot

    {
        "jsonrpc": "2.0",
        "method": "spot_orders",
        "params": [
          {
            "id": 584244931496,
            "client_order_id": "b5acd79c0a854b01b558665bcf379456",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.01000",
            "quantity_cumulative": "0",
            "price": "0.01",
            "post_only": false,
            "created_at": "2021-07-02T22:52:32.864Z",
            "updated_at": "2021-07-02T22:52:32.864Z",
            "report_type": "status"
          },
          {
            "id": 584246978340,
            "client_order_id": "eeb7d144eca545cd93d83078bc60b7f4",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.01000",
            "quantity_cumulative": "0",
            "price": "0.02",
            "post_only": false,
            "created_at": "2021-07-02T22:56:43.588Z",
            "updated_at": "2021-07-02T22:56:43.588Z",
            "report_type": "status"
          }
        ]
    }
    

    Notification Spot order update

    {
        "jsonrpc": "2.0",
        "method": "spot_order",
        "params": {
            "id": 584244931496,
            "client_order_id": "b5acd79c0a854b01b558665bcf379456",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.01000",
            "quantity_cumulative": "0",
            "price": "0.01",
            "post_only": false,
            "created_at": "2021-07-02T22:52:32.864Z",
            "updated_at": "2021-07-02T22:52:32.864Z",
            "report_type": "new"
        }
    }
    

    Notification Spot trade

    {
        "jsonrpc": "2.0",
        "method": "spot_order",
        "params": {
            "id": 626857425737,
            "client_order_id": "rqq6qnVTWvHa5YYG-7RviHLyA8JBu6Gj",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "filled",
            "type": "market",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0.00001",
            "post_only": false,
            "created_at": "2021-08-23T16:29:24.006Z",
            "updated_at": "2021-08-23T16:29:24.006Z",
            "trade_id": 1361977606,
            "trade_quantity": "0.00001",
            "trade_price": "49595.04",
            "trade_fee": "0.001239876000",
            "trade_taker": true,
            "report_type": "trade"
        }
    }
    

    Method: spot_subscribe, spot_unsubscribe

    Income methods: spot_order, spot_orders

    Subscribes to execution reports of user's orders

    Response:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader.
    symbol String Symbol code.
    side String Trade side.
    Accepted values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    price Number Order price.
    cum_quantity Number Cumulative executed quantity.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    created_at DateTime Report creation date.
    updated_at DateTime Date of the report's last update.
    stop_price Number Required for stop-limit and stop-market orders.
    expire_time DateTime Date of order expiration for time_in_force = GTD.
    original_client_order_id String Identifier of replaced order.
    trade_id Number Trade identifier. Required for report_type = trade.
    trade_quantity Number Quantity of trade. Required for report_type = trade.
    trade_price Number Trade price. Required for report_type = trade.
    trade_fee Number Fee paid for trade. Required for report_type = trade.
    trade_taker Boolean Liquidity indicator. Required for report_type = trade.
    report_type String Report type.
    Possible values: status, new, suspended, canceled, rejected, expired, replaced, trade

    Get Active Spot Orders

    Notification report

    {
        "jsonrpc": "2.0",
        "result": [
          {
            "id": 583502239480,
            "client_order_id": "9be4d950d3c04485854ec5d7f260b1e8",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.01000",
            "quantity_cumulative": "0",
            "price": "0.01",
            "post_only": false,
            "created_at": "2021-07-01T23:04:04.048Z",
            "updated_at": "2021-07-01T23:04:04.048Z",
            "report_type": "status"
          }
        ],
        "id": 123
    }
    

    Method: spot_get_orders

    Returns active orders.

    Place New Spot Order

    Request:

    {
        "method": "spot_new_order",
        "params": {
            "client_order_id": "57d5525562c945448e3cbd559bd068c4",
            "symbol": "ETHBTC",
            "side": "sell",
            "type": "limit",
            "quantity": "0.015",
            "price": "0.059837"
        },
        "id": 123
    }
    

    Success response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583565960004,
            "client_order_id": "57d5525562c945448e3cbd559bd06211",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "market",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "post_only": false,
            "created_at": "2021-07-02T00:58:05.307Z",
            "updated_at": "2021-07-02T00:58:05.307Z",
            "report_type": "new"
        },
        "id": 123
    }
    

    Example error response:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        },
        "id": 123
    }
    

    Method: spot_new_order

    Creates a new spot order.

    Parameters:

    Name Type Description
    client_order_id String Optional. Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Symbol code.
    side String Trade side.
    Accepted values: sell, buy
    type String Optional. Order type.
    Accepted values: limit, market, stopLimit, stopMarket
    Default value: limit
    time_in_force String Optional. Order type.
    Accepted values: GTC, IOC, FOK, Day, GTD
    Default value: GTC
    quantity Number Order quantity.
    price Number Order price. Required for limit types.
    stop_price Number Required for stop-limit and stop-market orders.
    expire_time DateTime Required for time_in_force = GTD.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol's tick size and quantity step. See the symbol's tick_size and quantity_increment.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    take_rate Number Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.
    make_rate Number Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

    Cancel Spot Order

    Request:

    {
        "method": "spot_cancel_order",
        "params": {
            "client_order_id": "57d5525562c945448e3cbd559bd068c4"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583569472521,
            "client_order_id": "8a97337322774d8ea56448290fbc87b3",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "canceled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "0.01",
            "post_only": false,
            "created_at": "2021-07-02T01:03:56.625Z",
            "updated_at": "2021-07-02T01:05:41.84Z",
            "report_type": "canceled"
        },
        "id": 123
    }
    

    Method: spot_cancel_order

    Cancels an existing order.

    Cancel/Replace Spot Order

    Request:

    {
        "method": "spot_replace_order",
        "params": {
            "client_order_id": "d6b645556af740b1bd1683400fd9cbce",
            "new_client_order_id": "d6b645556af740b1bd1683400fd9cbcf",
            "quantity": "0.00001",
            "price": "0.02"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583572753114,
            "client_order_id": "d6b645556af740b1bd1683400fd9cbcf",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "0.02",
            "post_only": false,
            "created_at": "2021-07-02T01:10:06.976Z",
            "updated_at": "2021-07-02T01:11:18.238Z",
            "original_client_order_id": "d6b645556af740b1bd1683400fd9cbce",
            "report_type": "replaced"
        }
    }
    

    The Cancel/Replace request is used to change the parameters of an existing order and to change the quantity or price attribute of an open order.

    Do not use this request to cancel the quantity remaining in an outstanding order. Use the Cancel request message for this purpose.

    It is stipulated that a newly entered order cancels a prior order that has been entered but not yet executed.

    Method: spot_replace_order

    Parameters:

    Name Type Description
    client_order_id String Required. Identifier of the order being replaced.
    new_client_order_id String Required. client_order_id for a new order. Uniqueness must be guaranteed within a single trading day, including all active orders.
    quantity Number New order quantity.
    price Number New order price.
    strict_validate Boolean Price and quantity will be checked for the incrementation within tick size and quantity step. See symbol's tick_size and quantity_increment.

    Cancel Spot Orders

    Request:

    {
        "method": "spot_cancel_orders",
        "params": {},
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
          {
            "id": 583572753114,
            "client_order_id": "d6b645556af740b1bd1683400fd9cbcf",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "0.02",
            "post_only": false,
            "created_at": "2021-07-02T01:10:06.976Z",
            "updated_at": "2021-07-02T01:11:18.238Z",
            "report_type": "canceled"
          }
        ]
    }
    

    Method: spot_cancel_orders

    Cancels all user's active orders and returns the ones which could not be cancelled.

    Get Spot Trading Balances

    Request:

    {
        "method": "spot_balances",
        "params": {},
        "id": 123
    }
    

    Response:

    {
        "jsonrpc":"2.0",
        "result": [
          {
            "currency": "BCN",
            "available": "100.000000000000",
            "reserved": "0",
            "reserved_margin": "0"
          },
          {
            "currency": "BTC",
            "available": "0.013634021",
            "reserved": "0",
            "reserved_margin": "0"
          },
          {
            "currency": "ETH",
            "available": "0",
            "reserved": "0.00200000",
            "reserved_margin": "0"
          }
        ],
        "id": 123
    }
    

    Method: spot_balances

    Returns all non-zero trading balances.

    Get Spot Trading Balance

    Request:

    {
        "method": "spot_balance",
        "params": {
            "currency": "BTC"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc":"2.0",
        "result": {
            "currency": "BTC",
            "available": "0.013634021",
            "reserved": "0",
            "reserved_margin": "0"
        },
        "id": 123
    }
    

    Method: spot_balance

    Returns trading balance for a single currency.

    Get Spot Fees

    Request:

    {
        "method": "spot_fees",
        "params": {},
        "id": 123
    }
    

    Response:

    {
        "jsonrpc":"2.0",
        "result": [
        {
            "symbol": "BTCUSDT",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        },
        {
            "symbol": "ETHBTC",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        }
        ],
        "id": 123
    }
    

    Method: spot_fees

    Returns fees for all available symbols.

    Get Spot Fee

    Request:

    {
        "jsonrpc":"2.0",
        "method": "spot_fee",
        "params": {
            "symbol": "BTCUSDT"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc":"2.0",
        "result":
        {
            "symbol": "BTCUSDT",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        },
        "id": 123
    }
    

    Method: spot_fee

    Returns fees for the symbol specified.

    Socket Margin Trading

    Description

    API provides the following tools to manage margin trading:

    Subscribe to Reports

    Request

    wscat -c wss://api.pro.changelly.com/api/3/ws/trading
    
    {
        "method": "margin_subscribe",
        "params": {},
        "id": 123
    }
    

    Subscription result:

    {
        "jsonrpc": "2.0",
        "result":true,
        "id": 1234
    }
    

    Notification. Margin Orders snapshot:

    {
        "jsonrpc": "2.0",
        "method": "margin_orders",
        "params": [
          {
            "id": 584244931496,
            "client_order_id": "b5acd79c0a854b01b558665bcf379456",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.01000",
            "quantity_cumulative": "0",
            "price": "0.01",
            "post_only": false,
            "created_at": "2021-07-02T22:52:32.864Z",
            "updated_at": "2021-07-02T22:52:32.864Z",
            "report_type": "status"
          },
          {
            "id": 584246978340,
            "client_order_id": "eeb7d144eca545cd93d83078bc60b7f4",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.01000",
            "quantity_cumulative": "0",
            "price": "0.02",
            "post_only": false,
            "created_at": "2021-07-02T22:56:43.588Z",
            "updated_at": "2021-07-02T22:56:43.588Z",
            "report_type": "status"
          }
        ]
    }
    

    Notification. Margin Order update:

    {
        "jsonrpc": "2.0",
        "method": "margin_order",
        "params": {
            "id": 583583708580,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01386",
            "symbol": "BTCUSDT",
            "side": "sell",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "report_type": "new"
        }
    }
    

    Notification. Margin trade:

    {
        "jsonrpc": "2.0",
        "method": "margin_order",
        "params": {
            "id": 583583708580,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01386",
            "symbol": "BTCUSDT",
            "side": "sell",
            "status": "filled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0.00001",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "trade_id": 1361988214,
            "trade_quantity": "0.00001",
            "trade_price": "49509.81",
            "trade_fee": "0.001237745250",
            "trade_position_id": 485308,
            "report_type": "trade"
        }
    }
    

    Notification. Margin Accounts snapshot:

    {
        "jsonrpc": "2.0",
        "method": "margin_accounts",
        "params": [
          {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T00:54:28.591Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0",
                "reserved_positions": "0.029630234750"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "27269.85",
                "price_liquidation": "26721.57",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T00:54:28.591Z"
              }
            ],
            "report_type": "status",
            "report_reason": "status"
          },
          {
            "symbol": "ETHUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:20:25.118Z",
            "updated_at": "2021-07-01T21:20:25.118Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.002000000000",
                "reserved_orders": "0",
                "reserved_positions": "0"
              }
            ],
            "positions": null,
            "report_type": "status",
            "report_reason": "status"
          }
        ]
    }
    

    Notification. Margin Account update:

    {
        "jsonrpc": "2.0",
        "method": "margin_account",
        "params": {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T00:54:28.591Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0",
                "reserved_positions": "0.029630234750"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "27269.85",
                "price_liquidation": "26721.57",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T00:54:28.591Z"
              }
            ],
            "report_type": "status",
            "report_reason": "status"
        }
    }
    

    Method: margin_subscribe, margin_unsubscribe

    Income method: margin_order, margin_orders

    Fields:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader.
    symbol String Symbol code.
    side String Trade side.
    Accepted values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    price Number Order price.
    cum_quantity Number Cumulative executed quantity.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    created_at DateTime Report creation date.
    updated_at DateTime Date of the report's last update.
    stop_price Number Required for stop-limit and stop-market orders.
    expire_time DateTime Date of order expiration for time_in_force = GTD.
    original_client_order_id String Identifier of replaced order.
    trade_id Number Trade identifier. Required for report_type = trade.
    trade_quantity Number Quantity of trade. Required for report_type = trade.
    trade_price Number Trade price. Required for report_type = trade.
    trade_fee Number Fee paid for trade. Required for report_type = trade.
    trade_taker Boolean Liquidity indicator. Required for report_type = trade.
    trade_position_id Number Position identifier of the trade.
    report_type String Report type.
    Possible values: status, new, suspended, canceled, rejected, expired, replaced, trade

    Income method: margin_account, margin_accounts

    Fields:

    Name Type Description
    symbol String Trading symbol. Where base currency is the currency of funds reserved on the trading account for positions and quote currency is the currency of funds reserved on a margin account (e.g., "BTCUSDT").
    type String Type of margin. Only isolated.
    leverage Number Margin leverage. The ratio of the trader's own funds to funds borrowed from the platform.
    created_at DateTime Account creation date and time.
    updated_at DateTime Account last update date and time.
    currencies Currency Amount of funds on Margin Account.
    positions Position Optional. Open positions of the Margin Account.
    report_type String Report type.
    Possible values:
    status — status of margin account requested, e.g., subscription report with a list of current margin accounts.
    created — new margin account created or position, e.g., new margin account requested or flipTrade occurs with position.
    updated — margin account or position updated.
    closed — margin account closed.
    report_reason String Report reason.
    Possible values: status, created, updated, marginChanged, openTrade, closeTrade, flipTrade, closed, reopened, liquidated, interestTaken, liquidationTrade

    Currency model consists of:

    Name Type Description
    code String Currency code.
    margin_balance Number Total quantity of contracts on the user's trading account.
    reserved_orders Number Margin reserved for open orders. These funds are unavailable for withdrawal.
    reserved_positions Number Margin reserved for open position. These funds are unavailable for withdrawal.

    Report type values:

    Status Description
    status Status of margin account requested, e.g., get accounts or subscription report with a list of current margin accounts.
    created A new margin account created, e.g., new margin account has been created or recreated as a result of flip trade occurs with the position.
    updated Margin account or position has been updated.
    closed Margin account has been closed.

    Report reason values:

    Status Description
    status Response to an account information request.
    created Position has been created.
    updated Position has been changed as a result of any order report, e.g., new, canceled, filled, and so on.
    marginChanged Margin account has been changed as a result of any requested change of the margin_balance.
    openTrade Opening trade has been executed.
    closeTrade Closing trade has been executed.
    flipTrade The position has been flipped as a result of opposite order execution with a quantity exceeding the position quantity (quantity has changed sign).
    closed The position quantity has been set to 0 (zero) as a result of close trade.
    liquidated The position has been liquidated.
    interestTaken The interest rate has been paid.
    liquidationTrade Liquidation order has been placed.

    Get Margin Orders

    Request:

    {
        "method": "margin_get_orders",
        "params": {},
        "id": 1234
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
          {
            "id": 583583708580,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01386",
            "symbol": "BTCUSDT",
            "side": "sell",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "report_type": "status"
          }
        ],
        "id": 1234
    }
    

    Method: margin_get_orders

    Returns all active margin orders.

    Place New Margin Order

    Request:

    {
      "method": "margin_new_order",
      "params": {
        "symbol": "BTCUSDT",
        "side": "buy",
        "quantity": "0.00001",
        "price": "30000",
        "client_order_id": "2d42e072e4f34846954509c955303e11"
      },
      "id": 1238
    }
    

    Notification. Order report:

    {
        "jsonrpc": "2.0",
        "method": "margin_order",
        "params": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:41:07.18Z",
            "report_type": "new"
        }
    }
    

    Notification. Account report:

    {
        "jsonrpc": "2.0",
        "method": "margin_account",
        "params": {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:41:07.18Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0.027375000000",
                "reserved_positions": "0.049647514286"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "30218.68",
                "price_liquidation": "29611.12",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:41:07.18Z"
              }
            ],
            "report_type": "updated",
            "report_reason": "updated"
        }
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:41:07.18Z",
            "report_type": "new"
        },
        "id": 1238
    }
    

    Method: margin_new_order

    Places a new margin order.

    Parameters:

    Name Type Description
    client_order_id String Optional. Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Symbol code.
    side String Trade side.
    Accepted values: sell, buy
    type String Optional. Order type.
    Accepted values: limit, market, stopLimit, stopMarket
    Default value: limit
    time_in_force String Optional.
    Accepted values: GTC, IOC, FOK, Day, GTD
    Default value: GTC
    quantity Number Order quantity.
    price Number Order price. Required for limit types.
    stop_price Number Required for stop-limit and stop-market orders.
    expire_time DateTime Required for time_in_force = GTD.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol's tick size and quantity step. See the symbol's tick_size and quantity_increment.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    take_rate Number Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.
    make_rate Number Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

    Cancel Margin Order

    Request:

    {
        "method": "margin_cancel_order",
        "params": {
            "client_order_id": "2d42e072e4f34846954509c955303e11"
        },
        "id": 1240
    }
    

    Notification. Order report:

    {
        "jsonrpc": "2.0",
        "method": "margin_order",
        "params": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "canceled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:46:06.016Z",
            "report_type": "canceled"
        }
    }
    

    Notification. Account report:

    {
        "jsonrpc": "2.0",
        "method": "margin_account",
        "params": {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:46:06.016Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0",
                "reserved_positions": "0.029822235125"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "27269.85",
                "price_liquidation": "26721.57",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:46:06.016Z"
              }
            ],
            "report_type": "updated",
            "report_reason": "updated"
        }
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "canceled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:46:06.016Z",
            "report_type": "canceled"
        },
        "id": 1240
    }
    

    Method: margin_cancel_order

    Cancels an active margin order.

    Parameters:

    Name Type Description
    client_order_id String Required. Uniqueness must be guaranteed within a single trading day, including all active orders.

    Cancel/Replace Margin Order

    Request:

    {
        "method": "margin_replace_order",
        "params": {
            "quantity": "0.00001",
            "price": "32000",
            "client_order_id": "2d42e072e4f34846954509c955303e12",
            "new_client_order_id": "2d42e072e4f34846954509c955303e13"
        },
        "id": 1239
    }
    

    Notification. Margin Order report:

    {
        "jsonrpc": "2.0",
        "method": "margin_order",
        "params": {
            "id": 583593326663,
            "client_order_id": "2d42e072e4f34846954509c955303e13",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "32000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:48:21.882Z",
            "updated_at": "2021-07-02T01:49:51.003Z",
            "original_client_order_id": "2d42e072e4f34846954509c955303e12",
            "report_type": "replaced"
        }
    }
    

    Notification. Margin Account report:

    {
        "jsonrpc": "2.0",
        "method": "margin_account",
        "params": {
          "symbol": "BTCUSDT",
          "type": "isolated",
          "leverage": "12.00",
          "created_at": "2021-07-01T21:43:19.727Z",
          "updated_at": "2021-07-02T01:49:51.003Z",
          "currencies": [
            {
              "code": "USDT",
              "margin_balance": "0.080706742356",
              "reserved_orders": "0.029200000000",
              "reserved_positions": "0.030699895239"
            }
          ],
          "positions": [
            {
              "id": 485264,
              "symbol": "BTCUSDT",
              "quantity": "0.00001",
              "price_entry": "33386.18",
              "price_margin_call": "30415.27",
              "price_liquidation": "29803.76",
              "pnl": "0",
              "created_at": "2021-07-01T21:43:19.727Z",
              "updated_at": "2021-07-02T01:49:51.003Z"
            }
          ],
          "report_type": "updated",
          "report_reason": "updated"
        }
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583593326663,
            "client_order_id": "2d42e072e4f34846954509c955303e13",
            "symbol": "BTCUSDT",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "32000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:48:21.882Z",
            "updated_at": "2021-07-02T01:49:51.003Z",
            "original_client_order_id": "2d42e072e4f34846954509c955303e12",
            "report_type": "replaced"
        },
        "id": 1239
    }
    

    Method: margin_replace_order

    Changes the parameters of an existing margin order.

    Parameters:

    Name Type Description
    client_order_id String Required. Identifier of the order being replaced.
    new_client_order_id String Required. client_order_id for a new order. Uniqueness must be guaranteed within a single trading day, including all active orders.
    quantity Number New order quantity.
    price Number New order price.
    strict_validate Boolean Price and quantity will be checked for the incrementation within tick size and quantity step. See symbol's tick_size and quantity_increment.

    Get Margin Accounts

    Request:

    {
        "method": "margin_get_accounts",
        "params": {},
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
          {
            "symbol": "ETHUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:20:25.118Z",
            "updated_at": "2021-07-01T21:20:25.118Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.002000000000",
                "reserved_orders": "0",
                "reserved_positions": "0"
              }
            ],
            "positions": null,
            "report_type": "status",
            "report_reason": "status"
          },
          {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:49:51.003Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0.029200000000",
                "reserved_positions": "0.030699895239"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "30415.27",
                "price_liquidation": "29803.76",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:49:51.003Z"
              }
            ],
            "report_type": "status",
            "report_reason": "status"
          }
        ]
    }
    

    Method: margin_get_accounts

    Returns a list of Margin Accounts with details about open positions.

    Create/Update Margin Account

    Request:

    {
        "method": "margin_set_account",
        "params": {
            "margin_balance": "0.07",
            "symbol": "BTCUSDT"
        },
        "id": 1234
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:54:46.636Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.070000000000",
                "reserved_orders": "0.029200000000",
                "reserved_positions": "0.030699895239"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "31568.60",
                "price_liquidation": "30933.90",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:54:46.636Z"
              }
          ],
          "report_type": "updated",
          "report_reason": "marginChanged"
        },
        "id": 1234
    }
    

    Notification:

    {
        "jsonrpc": "2.0",
        "method": "margin_account",
        "params": {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:54:46.636Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.070000000000",
                "reserved_orders": "0.029200000000",
                "reserved_positions": "0.030699895239"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "31568.60",
                "price_liquidation": "30933.90",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:54:46.636Z"
              }
            ],
            "report_type": "updated",
            "report_reason": "marginChanged"
        }
    }
    

    Method: margin_set_account

    Adds a margin for the specified symbol meaning creating the corresponding position of the entire margin value.

    Setting margin balance to zero will lead to closing margin account and return of all formerly reserved funds to the trading account.

    Parameters:

    Name Type Description
    symbol String Symbol code. Where base currency is the currency of funds reserved on the trading account for positions and quote currency is the currency of funds reserved on a margin account (e.g., "BTCUSDT").
    margin_balance Number Amount of currency reserved.
    strict_validate Boolean The value indicating whether the margin_balance is going to be checked for correct non-exponential format and currency precision.

    Close Margin Position

    Request:

    {
        "method": "margin_close_position",
        "params": {
            "symbol": "BTCUSDT"
        },
        "id": 1243
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:57:21.752Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.070000000000",
                "reserved_orders": "0",
                "reserved_positions": "0.030741868625"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "28423.18",
                "price_liquidation": "27851.72",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:57:21.752Z"
              }
            ],
            "report_type": "updated",
            "report_reason": "updated"
        },
        "id": 1243
    }
    

    Notification:

    {
        "jsonrpc": "2.0",
        "method": "margin_account",
        "params": {
            "symbol": "BTCUSDT",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:57:21.752Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.067915777250",
                "reserved_orders": "0",
                "reserved_positions": "0"
              }
          ],
            "positions": null,
            "report_type": "closed",
            "report_reason": "closed"
        }
    }
    

    Method: margin_close_position

    Closes a position for the specified symbol. This will result in cancelling all open orders within the position.

    Socket Futures Trading

    Description

    API provides the following tools to manage margin trading:

    Subscribe to Reports

    Request

    wscat -c wss://api.pro.changelly.com/api/3/ws/trading
    
    {
        "method": "futures_subscribe",
        "params": {},
        "id": 123
    }
    

    Subscription result:

    {
        "jsonrpc": "2.0",
        "result":true,
        "id": 1234
    }
    

    Notification. Futures orders snapshot:

    {
        "jsonrpc": "2.0",
        "method": "futures_orders",
        "params": [
          {
            "id": 583583708580,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01386",
            "symbol": "BTCUSDT_PERP",
            "side": "sell",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "report_type": "status"
          },
          {
            "id": 583583708581,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01387",
            "symbol": "BTCUSDT_PERP",
            "side": "sell",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "report_type": "status"
          }
        ]
    }
    

    Notification. Futures order update:

    {
        "jsonrpc": "2.0",
        "method": "futures_order",
        "params": {
            "id": 583583708580,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01386",
            "symbol": "BTCUSDT_PERP",
            "side": "sell",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "report_type": "new"
        }
    }
    

    Notification. Futures trade:

    {
        "jsonrpc": "2.0",
        "method": "futures_order",
        "params": {
            "id": 583583708580,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01386",
            "symbol": "BTCUSDT",
            "side": "sell",
            "status": "filled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0.00001",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "trade_id": 1361988214,
            "trade_quantity": "0.00001",
            "trade_price": "49509.81",
            "trade_fee": "0.001237745250",
            "trade_position_id": 485308,
            "report_type": "trade"
        }
    }
    

    Notification. Futures accounts snapshot:

    {
        "jsonrpc": "2.0",
        "method": "futures_accounts",
        "params": [
          {
            "symbol": "BTCUSDT_PERP",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T00:54:28.591Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0",
                "reserved_positions": "0.029630234750"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT_PERP",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "27269.85",
                "price_liquidation": "26721.57",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T00:54:28.591Z"
              }
            ],
            "report_type": "status",
            "report_reason": "status"
          },
          {
            "symbol": "ETHUSDT_PERP",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T00:54:28.591Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0",
                "reserved_positions": "0.029630234750"
              }
            ],
            "positions": null,
            "report_type": "status",
            "report_reason": "status"
          }
        ]
    }
    

    Method: futures_subscribe, futures_unsubscribe

    Income method: futures_order, futures_orders

    Fields:

    Name Type Description
    id Number Order unique identifier as assigned by exchange.
    client_order_id String Order unique identifier as assigned by trader.
    symbol String Contract code.
    side String Trade side.
    Accepted values: sell, buy
    status String Order state.
    Possible values: new, suspended, partiallyFilled, filled, canceled, expired
    type String Order type.
    Possible values: limit, market, stopLimit, stopMarket
    time_in_force String Time in Force is a special instruction used when placing an order to indicate how long it will remain active before it is executed or expired.
    GTC — "Good-Till-Cancelled" order won't be closed until it is filled.
    IOC — "Immediate-Or-Cancel" order must be executed immediately. Any part of an IOC order that cannot be filled immediately will be cancelled.
    FOK — "Fill-Or-Kill" order must be executed immediately and completely or not executed at all.
    Day — keeps the order active until the end of the trading day (UTC).
    GTD — "Good-Till-Date" order may remain active until the end of the day specified in expire_time.
    quantity Number Order quantity.
    price Number Order price.
    cum_quantity Number Cumulative executed quantity.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    created_at DateTime Report creation date.
    updated_at DateTime Date of the report's last update.
    stop_price Number Required for stop-limit and stop-market orders.
    expire_time DateTime Date of order expiration for time_in_force = GTD.
    original_client_order_id String Identifier of replaced order.
    trade_id Number Trade identifier. Required for report_type = trade.
    trade_quantity Number Quantity of trade. Required for report_type = trade.
    trade_price Number Trade price. Required for report_type = trade.
    trade_fee Number Fee paid for trade. Required for report_type = trade.
    trade_taker Boolean Liquidity indicator. Required for report_type = trade.
    trade_position_id Number Position identifier of the trade.
    report_type String Report type.
    Possible values: status, new, suspended, canceled, rejected, expired, replaced, trade

    Income method: futures_account, futures_accounts

    Fields:

    Name Type Description
    symbol String Contract code (e.g., "BTCUSDT_PERP").
    type String Type of margin. Only isolated.
    leverage Number Margin leverage. The ratio of the trader's own funds to funds borrowed from the platform.
    created_at DateTime Account creation date and time.
    updated_at DateTime Account last update date and time.
    currencies Currency Amount of funds on Margin Account.
    positions Position Optional. Open positions of the Margin Account.
    report_type String Report type.
    Possible values:
    status — status of margin account requested, e.g., subscription report with a list of current margin accounts.
    created — new margin account created or position, e.g., new margin account requested or flipTrade occurs with position.
    updated — margin account or position updated.
    closed — margin account closed.
    report_reason String Report reason. Possible values: status, created, updated, marginChanged, openTrade, closeTrade, flipTrade, closed, reopened, liquidated, liquidationTrade, interestTaken, fundingTaken, deleveraged.

    Currency model consists of:

    Name Type Description
    code String Currency code.
    margin_balance Number Total quantity of contracts on the user's trading account.
    reserved_orders Number Margin reserved for open orders. These funds are unavailable for withdrawal.
    reserved_positions Number Margin reserved for open position. These funds are unavailable for withdrawal.

    Report type values:

    Status Description
    status Status of futures account requested, e.g., get accounts or subscription report with a list of current futures accounts.
    created A new futures account created, e.g., new futures account has been created or recreated as a result of flip trade occurs with the position.
    updated Futures account or position has been updated.
    closed Futures account has been closed.

    Report reason values:

    Status Description
    status Response to an account information request.
    created Position has been created.
    updated Position account has been changed as a result of any order report, e.g., new, canceled, filled, and so on.
    marginChanged Futures account has been changed as a result of any requested change of the margin_balance.
    openTrade Opening trade has been executed.
    closeTrade Closing trade has been executed.
    flipTrade The position has been flipped as a result of the opposite order execution with a quantity exceeding the position quantity (quantity has changed sign).
    closed The position quantity has been set to 0 (zero) as a result of the closing trade.
    liquidated The position has been liquidated.
    liquidationTrade Liquidation order has been placed.
    fundingTaken The interest rate has been paid.
    deleveraged The position has changed because of ADL activation.

    Get Active Futures Orders

    Notification report

    {
        "jsonrpc": "2.0",
        "result": [
          {
            "id": 583583708580,
            "client_order_id": "5c8c50cbf326488cb1d3415cd3e01386",
            "symbol": "BTCUSDT_PERP",
            "side": "sell",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "80000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:32:15.732Z",
            "updated_at": "2021-07-02T01:32:15.732Z",
            "report_type": "status"
          }
        ],
        "id": 1234
    }
    

    Method: futures_get_orders

    Returns user's active orders.

    Place New Futures Order

    Request:

    {
        "method": "futures_new_order",
        "params": {
            "symbol": "BTCUSDT_PERP",
            "side": "buy",
            "quantity": "0.00001",
            "price": "30000",
            "client_order_id": "2d42e072e4f34846954509c955303e11"
        },
        "id": 1238
    }
    

    Notification. Futures Order report:

    {
        "jsonrpc": "2.0",
        "method": "futures_order",
        "params": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT_PERP",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:41:07.18Z",
            "report_type": "new"
        }
    }
    

    Notification. Futures Account report:

    {
        "jsonrpc": "2.0",
        "method": "futures_account",
        "params": {
            "symbol": "BTCUSDT_PERP",
            "type": "isolated",
            "leverage": "12.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:41:07.18Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.080706742356",
                "reserved_orders": "0.027375000000",
                "reserved_positions": "0.049647514286"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT_PERP",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "30218.68",
                "price_liquidation": "29611.12",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:41:07.18Z"
              }
          ],
          "report_type": "updated",
          "report_reason": "updated"
        }
    }
    

    Success response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT_PERP",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:41:07.18Z",
            "report_type": "new"
        },
        "id": 1238
    }
    

    Example error response:

    {
        "error": {
            "code": 20001,
            "message": "Insufficient funds",
            "description": "Check that the funds are sufficient, given commissions"
        },
        "id": 123
    }
    

    Method: futures_new_order

    Creates a new Futures order.

    Parameters:

    Name Type Description
    client_order_id String Optional. Order unique identifier as assigned by trader. Uniqueness must be guaranteed within a single trading day, including all active orders.
    symbol String Contract code.
    side String Trade side.
    Accepted values: sell, buy
    type String Optional. Order type.
    Accepted values: limit, market, stopLimit, stopMarket
    Default value: limit
    time_in_force String Optional.
    Accepted values: GTC, IOC, FOK, Day, GTD
    Default value: GTC
    quantity Number Order quantity.
    price Number Order price. Required for limit types.
    stop_price Number Required for stop-limit and stop-market orders.
    expire_time DateTime Required for time_in_force = GTD.
    strict_validate Boolean Price and quantity will be checked for incrementation within the symbol's tick size and quantity step. See the symbol's tick_size and quantity_increment.
    post_only Boolean A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then the order will be cancelled.
    take_rate Number Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.
    make_rate Number Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

    Cancel Futures Order

    Request:

    {
        "method": "futures_cancel_order",
        "params": {
            "client_order_id": "2d42e072e4f34846954509c955303e11"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT_PERP",
            "side": "buy",
            "status": "canceled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:46:06.016Z",
            "report_type": "canceled"
        },
        "id": 1240
    }
    

    Method: futures_cancel_order

    Cancels an existing order.

    Cancel/Replace a Futures Order

    Request:

    {
        "method": "futures_replace_order",
        "params": {
            "quantity": "0.00001",
            "price": "32000",
            "client_order_id": "2d42e072e4f34846954509c955303e12",
            "new_client_order_id": "2d42e072e4f34846954509c955303e13"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "id": 583593326663,
            "client_order_id": "2d42e072e4f34846954509c955303e13",
            "symbol": "BTCUSDT_PERP",
            "side": "buy",
            "status": "new",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "32000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:48:21.882Z",
            "updated_at": "2021-07-02T01:49:51.003Z",
            "original_client_order_id": "2d42e072e4f34846954509c955303e12",
            "report_type": "replaced"
        },
        "id": 1239
    }
    

    The Cancel/Replace request is used to change the parameters of an existing order or to revise the quantity or price attribute of an open order.

    Do not use this request to cancel the quantity remaining in an outstanding order. Use the Cancel request message for this purpose.

    It is stipulated that a newly entered order cancels a prior order that has been entered but not yet executed.

    Method: futures_replace_order

    Parameters:

    Name Type Description
    client_order_id String Required. Identifier of the order being replaced.
    new_client_order_id String Required. client_order_id for a new order. Uniqueness must be guaranteed within a single trading day, including all active orders.
    quantity Number New order quantity.
    price Number New order price.
    strict_validate Boolean Price and quantity will be checked for the incrementation within tick size and quantity step. See symbol's tick_size and quantity_increment.

    Cancel Futures Order

    Request:

    {
        "method": "futures_cancel_order",
        "client_order_id": "2d42e072e4f34846954509c955303e11",
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "method": "margin_order",
        "params": {
            "id": 583588368047,
            "client_order_id": "2d42e072e4f34846954509c955303e11",
            "symbol": "BTCUSDT_PERP",
            "side": "buy",
            "status": "canceled",
            "type": "limit",
            "time_in_force": "GTC",
            "quantity": "0.00001",
            "quantity_cumulative": "0",
            "price": "30000.00",
            "post_only": false,
            "created_at": "2021-07-02T01:41:07.18Z",
            "updated_at": "2021-07-02T01:46:06.016Z",
            "report_type": "canceled"
        }
    }
    

    Method: futures_cancel_order

    Cancels an active futures order.

    Get Futures Accounts

    Request:

    {
        "method": "futures_get_accounts",
        "params": {},
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
            {
                "symbol": "ETHUSDT_PERP",
                "type": "isolated",
                "leverage": "12.00",
                "created_at": "2021-07-01T21:20:25.118Z",
                "updated_at": "2021-07-01T21:20:25.118Z",
                "currencies": [
                  {
                    "code": "USDT",
                    "margin_balance": "0.002000000000",
                    "reserved_orders": "0",
                    "reserved_positions": "0"
                  }
                ],
                "positions": null,
                "report_type": "status",
                "report_reason": "status"
              },
              {
                "symbol": "BTCUSDT_PERP",
                "type": "isolated",
                "leverage": "12.00",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:49:51.003Z",
                "currencies": [
                  {
                    "code": "USDT",
                    "margin_balance": "0.080706742356",
                    "reserved_orders": "0.029200000000",
                    "reserved_positions": "0.030699895239"
                  }
                ],
                "positions": [
                  {
                    "id": 485264,
                    "symbol": "BTCUSDT_PERP",
                    "quantity": "0.00001",
                    "price_entry": "33386.18",
                    "price_margin_call": "30415.27",
                    "price_liquidation": "29803.76",
                    "pnl": "0",
                    "created_at": "2021-07-01T21:43:19.727Z",
                    "updated_at": "2021-07-02T01:49:51.003Z"
                  }
                ],
                "report_type": "status",
                "report_reason": "status"
            }
        ]
    }
    

    Method: futures_get_accounts

    Returns a list of futures accounts with details about open positions.

    Create/Update Futures Account

    Request:

    {
        "method": "futures_set_account",
        "params": {
            "margin_balance": "10.00",
            "symbol": "BTCUSDT_PERP",
            "leverage": "100"
        },
        "id": 1234
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "symbol": "BTCUSDT_PERP",
            "type": "isolated",
            "leverage": "100.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:54:46.636Z",
            "currencies": [
              {
                "code": "USDT",
                "margin_balance": "0.070000000000",
                "reserved_orders": "0.029200000000",
                "reserved_positions": "0.030699895239"
              }
            ],
            "positions": [
              {
                "id": 485264,
                "symbol": "BTCUSDT_PERP",
                "quantity": "0.00001",
                "price_entry": "33386.18",
                "price_margin_call": "31568.60",
                "price_liquidation": "30933.90",
                "pnl": "0",
                "created_at": "2021-07-01T21:43:19.727Z",
                "updated_at": "2021-07-02T01:54:46.636Z"
              }
          ],
          "report_type": "updated",
          "report_reason": "marginChanged"
        },
        "id": 1234
    }
    

    Method: futures_set_account

    Adds a margin for the specified symbol meaning creating the corresponding position of the entire margin value.

    Setting margin balance to zero will lead to closing the futures account and return of all formerly reserved funds to the trading account.

    Parameters:

    Name Type Description
    symbol String Contract code (e.g., "BTCUSDT_PERP").
    margin_balance Number Amount of currency reserved.
    leverage Number The ratio of borrowed funds to trader's initial margin.
    strict_validate Boolean The value indicating whether the margin_balance is going to be checked for correct non-exponential format and currency precision.

    Close Futures Position

    Request:

    {
        "method": "futures_close_position",
        "params": {
            "symbol": "BTCUSDT_PERP"
        },
        "id": 1243
    }
    

    Notification:

    {
        "jsonrpc": "2.0",
        "method": "futures_account",
        "params": {
            "symbol": "BTCUSDT_PERP",
            "type": "isolated",
            "leverage": "100.00",
            "created_at": "2021-07-01T21:43:19.727Z",
            "updated_at": "2021-07-02T01:57:21.752Z",
            "currencies": [
                {
                    "code": "USDT",
                    "margin_balance": "0.067915777250",
                    "reserved_orders": "0",
                    "reserved_positions": "0"
                }
            ],
            "positions": null,
            "report_type": "closed",
            "report_reason": "closed"
        }
      }
    

    Method: futures_close_position

    Closes a position for the specified symbol. This will result in cancelling all open orders within the position.

    Get Futures Trading Balances

    Request:

    {
        "method": "futures_balances",
        "params": {},
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
            {
                "currency": "BCN",
                "available": "100.000000000",
                "reserved": "0",
                "reserved_margin": "0"
            },
            {
                "currency": "BTC",
                "available": "0.013634021",
                "reserved": "0",
                "reserved_margin": "0"
            },
            {
                "currency": "ETH",
                "available": "0",
                "reserved": "0.00200000",
                "reserved_margin": "0"
            }
        ],
        "id": 123
    }
    

    Method: futures_balances

    Returns all non-zero trading balances.

    Get Futures Trading Balance

    Request:

    {
        "method": "futures_balance",
        "params": {
            "currency": "USDT"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "currency": "USDT",
            "available": "100.000000000",
            "reserved": "0",
            "reserved_margin": "0"
        },
        "id": 123
    }
    

    Method: futures_balance

    Returns trading balance for a single currency.

    Get Futures Fees

    Request:

    {
        "method": "futures_fees",
        "params": {},
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
        {
            "symbol": "BTCUSDT_PERP",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        },
        {
            "symbol": "ETHBTC_PERP",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        }
        ],
        "id": 123
    }
    

    Method: futures_fees

    Returns fees for all available symbols.

    Get Futures Fee

    Request:

    {
        "method": "futures_fee",
        "params": {
            "symbol": "BTCUSDT_PERP"
        },
        "id": 123
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
        {
            "symbol": "BTCUSDT_PERP",
            "take_rate": "0.001",
            "make_rate": "-0.0001"
        }
        ],
        "id": 123
    }
    

    Method: futures_fee

    Returns fee for the contract specified.

    Socket Wallet Management

    Description

    WebSocket Account API uses the same authorization approach as described in the Socket Session Authentication section.

    API provides the following tools to manage a general account:

    Subscribe to Transactions

    Method: subscribe_transactions and the corresponding unsubscription method: unsubscribe_transactions

    Income method: transaction_update

    A full transaction model description can be found in the "Get Transactions History" section.

    A subscription to the transactions has to be used rather than the transaction polling.

    A transaction notification occurs each time the transaction has been changed, such as creating a transaction, updating the pending state (e.g., the hash assigned) or completing a transaction. This is the easiest way to track deposits or develop real-time asset monitoring.

    Subscription request:

    {
        "method": "subscribe_transactions",
        "params": {},
        "id": 7652
    }
    

    Subscription result:

    {
        "result":true,
        "id": 7652
    }
    

    Notification. Updated Transaction:

    {
      "method": "transaction_update",
      "params": {
        {
          "id": 50844835,
          "created_at": "2021-06-22T21:03:04.111Z",
          "updated_at": "2021-06-22T21:04:41.487Z",
          "status": "SUCCESS",
          "type": "WITHDRAW",
          "subtype": "BLOCKCHAIN",
          "native": {
            "tx_id": "27fa7f14-ca49-42fd-834a-4ce630d069d2",
            "index": 1071885589,
            "currency": "ETH",
            "amount": "0.01042",
            "fee": "0.00958",
            "hash": "0xfb0ba568213d11230cd34d62fddd1cc1fe11fdc173l4f2007b0e47a06ad73d20",
            "address": "0xd959463c3fcb222124bb7bb642d6a6573a6c5aba",
            "confirmations": 20
         }
      }
    }
    

    Subscribe to Wallet Balance

    Method: subscribe_wallet_balances and the corresponding unsubscription method: unsubscribe_wallet_balances

    Income methods: wallet_balances, wallet_balance_update

    This subscription aims to provide an easy way to be informed of the current balance state. If the state has been changed or potentially changed, the wallet_balance_update event will come with the actual state. Please be aware that only non-zero values are present.

    Event wallet_balances arrives after each successful subscription.

    Subscription request:

    {
        "method": "subscribe_wallet_balances",
        "params": {},
        "id": 7653
    }
    

    Subscription result:

    {
        "jsonrpc": "2.0",
        "result":true,
        "id": 7653
    }
    

    Notification. Balance snapshot:

    {
        "jsonrpc": "2.0",
        "method": "wallet_balances",
        "params": [
            {
                "currency": "BTC",
                "available": "0.00005821",
                "reserved": "0"
            },
            {
                "currency": "ETH",
                "available": "11",
                "reserved": "0"
            }
        ]
    }
    

    Notification. Balance update:

    {
        "jsonrpc": "2.0",
        "method": "wallet_balance_update",
        "params": {
            "currency": "BTC",
            "available": "0.10005821",
            "reserved": "0"
        }
    }
    

    Request Wallet Balance

    Request:

    {
        "method": "wallet_balances",
        "params": {},
        "id": 5543
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": [
            {
                "currency": "BTC",
                "available": "0.00005821",
                "reserved": "0"
            },
            {
                "currency": "ETH",
                "available": "11",
                "reserved": "0"
            }
        ],
        "id": 5543
    }
    

    Request:

    {
        "method": "wallet_balance",
        "params": {
            "currency": "BTC"
        },
        "id": 5543
    }
    

    Response:

    {
        "jsonrpc": "2.0",
        "result": {
            "currency": "BTC",
            "available": "0.00005821",
            "reserved": "0"
        },
        "id": 5543
    }
    

    Methods: wallet_balances, wallet_balance

    Get all wallet balances or balance for a single asset.

    Please note that the method returns non-zero balances only.

    Get Transactions

    Request:

    {
        "method": "get_transactions",
        "params": {
            "limit": 10,
            "offset": 0,
            "order": "desc",
            "from": "2020-01-31T00:00:00.000Z",
            "till": "2021-07-31T22:33:00.555Z",
            "statuses": "SUCCESS",
            "currencies": "ETH,BTC"
            },
        "id": 7655
    }
    

    Response:

    {
      "result": [
        {
          "id": 50844835,
          "created_at": "2021-06-22T21:03:04.111Z",
          "updated_at": "2021-06-22T21:04:41.487Z",
          "status": "SUCCESS",
          "type": "WITHDRAW",
          "subtype": "BLOCKCHAIN",
          "native": {
            "tx_id": "27fa7f14-ca49-42fd-834a-4ce630d069d2",
            "index": 1071885589,
            "currency": "ETH",
            "amount": "0.01042",
            "fee": "0.00958",
            "hash": "0xfb0ba568213d11230cd34d62fddd1cc1fe11fdc173l4f2007b0e47a06ad73d20",
            "address": "0xd959463c3fcb222124bb7bb642d6a6573a6c5aba",
            "confirmations": 20
          }
        },
        {
          "id": 36896428,
          "created_at": "2020-11-12T10:27:26.135Z",
          "updated_at": "2020-11-12T10:42:29.065Z",
          "status": "SUCCESS",
          "type": "DEPOSIT",
          "subtype": "BLOCKCHAIN",
          "native": {
            "tx_id": "a271ad64-5f34-4115-a63e-1cb5bbe4f67e",
            "index": 429625504,
            "currency": "BTC",
            "amount": "0.04836614",
            "hash": "4d7ae7c9d6fe84405ae167b3f0beacx8c68eb5a9d5189bckeb65d5e306427oe6",
            "address": "3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv",
            "confirmations": 2
          }
        }
      ],
      "id": 7655
    }
    

    Method: get_transactions

    All parameters are optional.

    Parameters:

    Name Type Description
    from DateTime Interval initial value (inclusive).
    till DateTime Interval end value (inclusive).
    type String Transaction type. The list of supported types may be expanded in future versions.
    Possible values: DEPOSIT, WITHDRAW, TRANSFER, SWAP
    subtype String Transaction subtype. Some subtypes are reserved for future use and do not purport to provide any functionality on the platform. The list of supported subtypes may be expanded in future versions.
    Possible values: UNCLASSIFIED, BLOCKCHAIN, AIRDROP, AFFILIATE, STAKING, BUY_CRYPTO, OFFCHAIN, FIAT, SUB_ACCOUNT, WALLET_TO_SPOT, SPOT_TO_WALLET, WALLET_TO_DERIVATIVES, DERIVATIVES_TO_WALLET, CHAIN_SWITCH_FROM, CHAIN_SWITCH_TO, INSTANT_EXCHANGE
    statuses String Comma-separated transaction statuses.
    Accepted values: CREATED, PENDING, FAILED, SUCCESS, ROLLED_BACK
    currencies String Comma-separated currency codes.
    id_from Number Index interval initial value.
    Accepted values: 0 or greater
    id_till Number Index interval end value.
    Accepted values: 0 or greater
    tx_ids String Comma-separated transaction identifiers.
    order_by String Defines order type.
    Accepted values: created_at, id
    Default value: created_at
    sort String Sort direction.
    Accepted values: DESC, ASC
    Default value: DESC
    limit Number Default value: 100
    Max value: 1000
    offset Number Default value: 0
    Max value: 100000

    Errors

    The ChangellyPRO API uses the following error codes:

    Error code HTTP Status Code Message Note
    429 429 Too many requests Action is being rate limited for the account.
    500 500 Internal Server Error
    503 503 Service Unavailable Try it again later.
    504 504 Gateway Timeout Check the result of your request later.
    600 400 Action not allowed
    800 404 Resource Not Found
    1002 401 Authorization required or has been failed Check that authorization data were provided.
    1003 403 Action forbidden for this API key Check permissions for API key, whitelists, or any security feature that might block this request.
    1004 401 Unsupported authorization method Use Basic authentication.
    1005 401 Authorization is invalid
    2001 400 Symbol not found
    2002 400 Currency not found
    2003 400 Unknown channel
    2010 400 Quantity not a valid number
    2011 400 Quantity too low
    2012 400 Bad quantity
    2020 400 Price not a valid number
    2022 400 Bad price
    10001 400 Validation error Input is not valid, see more in message field.
    10021 400 User disabled
    10022 400 Bad fee markup
    20001 400 Insufficient funds Insufficient funds for creating an order or any account operations. Check that the funds are sufficient, given commissions.
    20002 400 Order not found Attempt to get an active order that does not exist or is filled, canceled, expired. Attempt to cancel a non-existing order. Attempt to cancel an already filled or expired order.
    20003 400 Limit exceeded
    20004 400 Transaction not found Requested transaction was not found.
    20005 400 Payout not found
    20006 400 Payout already committed
    20007 400 Payout already rolled back
    20008 400 Duplicate clientOrderId
    20009 400 Price and quantity not changed
    20010 400 Exchange temporary closed Exchange market is temporary closed on the symbol.
    20011 400 Payout address is invalid
    20012 400 Payout payment address is invalid
    20014 400 Payout offchain unavailable Address does not belong to exchange, belongs to the same user, or is unavailable for currency.
    20016 400 Payout fee level invalid
    20031 400 Margin account already exist
    20032 400 Margin account or position not found Margin account for requested symbol was not found.
    20033 400 Position not changed Existing margin_balance is equal to the requested value.
    20034 400 Position in close only state
    20040 400 Margin trading forbidden
    20041 400 Worse liquidation price Price of a new order is worse than the liquidation price.
    20042 400 Worse liquidation price Price of an existing order is worse than the liquidation price.
    20043 400 Duplicate request
    20044 400 Trading operation not allowed
    20045 400 Fat finger limit exceeded
    20080 400 Internal order execution deadline exceeded Order was not placed.
    21001 404 Cannot find sub account
    21003 400 Sub account is already frozen
    21004 400 Sub account is already frozen or disabled