NAV
json

X10 API Documentation

By using the X10 API, you agree to the X10 Terms & Privacy Policy. If you do not agree to the foregoing terms, do not use the X10 API.

Introduction

Welcome to the X10 API Documentation! This guide is designed to assist traders and developers in integrating with our hybrid perpetuals exchange.

X10 operates as a hybrid Central Limit Order Book (CLOB) exchange. While order processing, matching, position risk assessment, and transaction sequencing are handled off-chain, trade settlement occurs on-chain through the StarkEx Layer 2 engine.

StarkEx, built by Starkware, is a battle-tested scalability solution that brings lightning-fast transaction processing to the forefront, guaranteeing an unparalleled trading experience. This is achieved while preserving complete trustlessness and transparency through three key mechanisms embedded into StarkEx:

  1. On-chain validations of the trading logic ensure that fraudulent or incorrect transactions, including liquidations, contrary to the on-chain trading logic are never permitted.

  2. The mark prices, which determine the liquidability of positions, are obtained from multiple independent oracle providers to prevent potential price manipulation and ensure fair and accurate asset valuation within our ecosystem. X10 utilizes 5 Stork nodes to define the median mark price.

  3. Publication of zero-knowledge (ZK) proofs on the Ethereum Layer 1 blockchain validates Layer 2 transactions, ensuring both their integrity and security.

For deeper insights on X10 Exchange, please refer to the blogs X10 Vision and Architecture.

To optimize high-frequency trading performance, the X10 API operates asynchronously. This means that when you place an order, it immediately returns an order ID, even before the order is officially recorded in the book. To track your order status in real time, it's essential to subscribe to the Order WebSocket stream. This stream delivers instant updates about any changes to your orders, including confirmations, cancellations, and rejections, enabling you to manage your trading strategies effectively.

Python SDK

To enhance your algorithmic trading experience, X10 has released the beta version of our Python SDK.

Getting Started:

Supported Features:

We are committed to enhancing the SDK with more functionalities based on user feedback and evolving market needs.

Testnet

Our Testnet is running on Sepolia.

On the testnet, users can claim $100,000 worth of test USDC per day for each L1 wallet. This can be done by clicking the 'Claim Funds' button in the 'Account' section, located at the bottom right of the X10 Trade screen.

Allowed HTTP Verbs

GET: Retrieves a resource or list of resources.

POST: Creates a resource.

PATCH: Updates a resource.

DELETE: Deletes a resource.

Authentication

Due to the trustless and self-custody nature of the X10 exchange, transactions involving user funds require not only an API Key but also a valid Stark signature.

For order management, both an API Key and Stark signatures are necessary. For other endpoints, only the API Key signature is required. Stark signatures are generated using a private Stark key.

Account Creation, API and Stark Key Management

Currently, accounts can only be created through the User Interface. To create an account, connect your wallet on X10.exchange, and your first X10 account will be created.

You can create up to ten X10 sub-accounts per one L1 wallet address. You can add and manage all sub-accounts associated with your connected L1 wallet in the 'Account' section, located at the bottom right of the X10 Trade screen.

On the API management page, you can obtain API keys, Stark keys, and Vault numbers for each of your sub-accounts. Note that each sub-account is a separate StarkEx vault and therefore has unique API and Stark keys.

Authenticate Using API Key

For the Testnet, X10 employs a simplified authentication scheme for API access. Authenticate by using your API key, which should be included in an HTTP header as follows: X-Api-Key: <API_KEY_FROM_API_MANAGEMENT_PAGE_OF_UI>.

Rate Limits

REST API endpoints are subject to rate limits. For real-time data, consider using the WebSockets API instead.

All REST API endpoints are throttled by IP address. Currently, the rate limit is set at 1,000 requests per minute, shared across all endpoints. We plan to increase these limits as our system expands. If you require an increase in the rate limit now, please reach out to our team on Discord.

When a REST API rate limit is exceeded, a 429 status code will be returned.

Pagination

Paginated response example:

{
  "status": "ok" | "error",
  "data": {
    // ...
  },
  "error": {
    "code": (number),
    "message": (string)
  },
  "pagination": {
    "cursor": (number) # current cursor
    "count": (number) # count of the items in the response
  }
}

General not paginated response example:

{
  "status": "ok" | "error",
  "data": {
    // ...
  },
  "error": {
    "code": number,
    "message": string
  }
}

The X10 API uses a cursor-based pagination model across all endpoints that may return large volumes of items.

Items are automatically sorted in descending order by their ID. As IDs increase over time, the most recent items are always returned first.

Pagination parameters are passed via the query string. These parameters include:

Parameter Required Type Description
cursor no number Determines the offset of the returned result. It represents the ID of the item after which you want to retrieve the next result. To get the next result page, use the cursor from the pagination section of the previous response.
limit no number The maximum number of items that should be returned.

Public REST-API

The following Public REST API endpoints enable users to access comprehensive information about available markets, their configurations, and trading statistics.

Get markets

HTTP Request

GET /api/v1/info/markets?market={market}

Get a list of available markets, their configurations, and trading statistics.

To request data for several markets, use the following format: GET /api/v1/info/markets?market=market1&market2.

Please note that the margin schedule by market is not covered by this endpoint. For more details on the margin schedule, please refer to the documentation.

Query Parameters

Parameter Required Type Description
market no List of strings List of names of the requested markets.

Response example:

{
  "status": "ok",
  "data": [
    {
      "name": "BTC-USD",
      "assetName": "BTC",
      "assetPrecision": 6,
      "collateralAssetName": "USD",
      "collateralAssetPrecision": 6,
      "active": true,
      "marketStats": {
        "dailyVolume": "39659164065",
        "dailyVolumeBase": "39659164065",
        "dailyPriceChangePercentage": "5.57",
        "dailyLow": "39512",
        "dailyHigh": "42122",
        "lastPrice": "42000",
        "askPrice": "42005",
        "bidPrice": "39998",
        "markPrice": "39950",
        "indexPrice": "39940",
        "fundingRate": "0.001",
        "nextFundingRate": 1701563440,
        "openInterest": "1245.2",
        "openInterestBase": "1245.2"
      },
      "tradingConfig": {
        "minOrderSize": "0.001",
        "minOrderSizeChange": "0.001",
        "minPriceChange": "0.001",
        "maxMarketOrderValue": "1000000",
        "maxLimitOrderValue": "5000000",
        "maxPositionValue": "10000000",
        "maxLeverage": "50",
        "maxNumOrders": "200",
        "limitPriceCap": "0.05",
        "limitPriceFloor": "0.05"
      },
      "l2Config": {
        "type": "STARKX",
        "collateralId": "0x35596841893e0d17079c27b2d72db1694f26a1932a7429144b439ba0807d29c",
        "collateralResolution": 1000000,
        "syntheticId": "0x4254432d3130000000000000000000",
        "syntheticResolution": 10000000000
      }
    }
  ]
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].name yes string Name of the market.
data[].assetName yes string Name of the base asset.
data[].assetPrecision yes number Number of decimals for the base asset.
data[].collateralAssetName yes string Name of the collateral asset.
data[].collateralAssetPrecision yes number Number of decimals for the collateral asset.
data[].active yes boolean Indicates if the market is currently active. Can be true or false
data[].marketStats.dailyVolume yes string Trading volume of the market in the previous 24 hours in the collateral asset.
data[].marketStats.dailyVolumeBase yes string Trading volume of the market in the previous 24 hours in the base asset.
data[].marketStats.dailyPriceChange yes string Absolute price change of the last trade price over the past 24 hours.
data[].marketStats.dailyPriceChangePercentage yes string Percent price change of the last trade price over the past 24 hours.
data[].marketStats.dailyLow yes string Lowest trade price over the past 24 hours.
data[].marketStats.dailyHigh yes string Highest trade price over the past 24 hours.
data[].marketStats.lastPrice yes string Last price of the market.
data[].marketStats.askPrice yes string Current best ask price of the market.
data[].marketStats.bidPrice yes string Current best bid price of the market.
data[].marketStats.markPrice yes string Current mark price of the market.
data[].marketStats.indexPrice yes string Current index price of the market.
data[].marketStats.fundingRate yes string Current funding rate, calculated every minute.
data[].marketStats.nextFundingRate yes number Timestamp of the next funding update.
data[].marketStats.openInterest yes string Open interest in collateral asset.
data[].marketStats.openInterestBase yes string Open interest in base asset.
data[].tradingConfig.minOrderSize yes string Minimum order size for the market.
data[].tradingConfig.minOrderSizeChange yes string Minimum order size change for the market.
data[].tradingConfig.minPriceChange yes string Minimum price change for the market.
data[].tradingConfig.maxMarketOrderValue yes string Maximum market order value for the market.
data[].tradingConfig.maxLimitOrderValue yes string Maximum limit order value for the market.
data[].tradingConfig.maxPositionValue yes string Maximum position value for the market.
data[].tradingConfig.maxLeverage yes string Maximum leverage available for the market.
data[].tradingConfig.maxNumOrders yes string Maximum number of open orders for the market.
data[].tradingConfig.limitPriceCap yes string Limit order price cap.
data[].tradingConfig.limitPriceFloor yes string Limit order floor ratio.
data[].l2Config.type yes string Type of Layer 2 solution. Currently, only 'STARKX' is supported.
data[].l2Config.collateralId yes string StarkEx collateral asset ID.
data[].l2Config.collateralResolution yes number Collateral asset resolution is the number of quantums (StarkEx units) that fit within one "human-readable" unit of the collateral asset.
data[].l2Config.syntheticId yes string StarkEx synthetic asset ID.
data[].l2Config.syntheticResolution yes number Synthetic asset resolution is the number of quantums (StarkEx units) that fit within one "human-readable" unit of the synthetic asset.

Get market statistics

HTTP Request

GET /api/v1/info/markets/{market}/stats

Get the latest trading statistics for an individual market.

Please note that the returned funding rate represents the most recent funding rate, which is calculated every minute.

URL Parameters

Parameter Required Type Description
market yes string Name of the requested market.

Successful response example:

{
  "status": "OK",
  "data": {
    "dailyVolume": "10283410.122959",
    "dailyVolumeBase": "3343.1217",
    "dailyPriceChange": "-26.00",
    "dailyPriceChangePercentage": "-0.0084",
    "dailyLow": "3057.98",
    "dailyHigh": "3133.53",
    "lastPrice": "3085.70",
    "askPrice": "3089.05",
    "bidPrice": "3087.50",
    "markPrice": "3088.439710293828",
    "indexPrice": "3089.556987078441",
    "fundingRate": "-0.000059",
    "nextFundingRate": 1716192000000,
    "openInterest": "35827242.257619",
    "openInterestBase": "11600.4344",
    "deleverageLevels": {
      "shortPositions": [
        {
          "level": 1,
          "rankingLowerBound": "-1354535.1454"
        },
        {
          "level": 2,
          "rankingLowerBound": "-6.3450"
        },
        {
          "level": 3,
          "rankingLowerBound": "-0.3419"
        },
        {
          "level": 4,
          "rankingLowerBound": "0.0000"
        }
      ],
      "longPositions": [
        {
          "level": 1,
          "rankingLowerBound": "-2978.4427"
        },
        {
          "level": 2,
          "rankingLowerBound": "0.0000"
        },
        {
          "level": 3,
          "rankingLowerBound": "0.0000"
        },
        {
          "level": 4,
          "rankingLowerBound": "0.0001"
        }
      ]
    }
  }
}

Error response example:

{
  "status": "status: error",
  "error": {
    "code": "NOT_FOUND",
    "message": "Market not found"
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data.dailyVolume yes string Trading volume of the market in the previous 24 hours in the collateral asset.
data.dailyVolumeBase yes string Trading volume of the market in the previous 24 hours in the base asset.
data.dailyPriceChange yes string Absolute price change of the last trade price over the past 24 hours.
data.dailyPriceChangePercentage yes string Percent price change of the last trade price over the past 24 hours.
data.dailyLow yes string Lowest trade price over the past 24 hours.
data.dailyHigh yes string Highest trade price over the past 24 hours.
data.lastPrice yes string Last price of the market.
data.askPrice yes string Current best ask price of the market.
data.bidPrice yes string Current best bid price of the market.
data.markPrice yes string Current mark price of the market.
data.indexPrice yes string Current index price of the market.
data.fundingRate yes string Current funding rate, calculated every minute.
data.nextFundingRate yes number Timestamp of the next funding update.
data.openInterest yes string Open interest in collateral asset.
data.openInterestBase yes string Open interest in base asset.
data.deleverageLevels yes enum Auto Deleveraging (ADL) levels for long and short positions, ranging from level 1 (lowest risk) to level 4 (highest risk) highest risk of ADL. For details, please refer to the documentation.

Get candles history

HTTP Request

GET /api/v1/info/candles/{market}/{candleType}

Get the candles history for an individual market for the specified timeframe in the request. The candles are sorted by timestamp in descending order.

Available price types include:

  1. Trades price: GET /api/v1/info/candles/{market}/trades.

  2. Mark price: GET /api/v1/info/candles/{market}/mark-prices.

  3. Index price: GET /api/v1/info/candles/{market}/index-prices.

The endpoint returns a maximum of 10,000 records.

URL Parameters

Parameter Required Type Description
market yes string Name of the requested market.
candleType yes string Price type for the data. Possible values are 'trades', 'mark-prices', or 'index-prices'.

Query Parameters

Parameter Required Type Description
interval yes string The time interval between data points.
limit no number The maximum number of items that should be returned.
endTime no number End timestamp (in epoch milliseconds) for the requested period.

Response example:

{
  "status": "OK",
  "data": [
    {
      "o": "65206.2",
      "l": "65206.2",
      "h": "65206.2",
      "c": "65206.2",
      "v": "0.0",
      "T": 1715797320000
    }
  ]
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].o yes string Open price.
data[].c yes string Close price.
data[].h yes string High price.
data[].l yes string Low price.
data[].v yes string Trading volume (Only for trades candles).
data[].T yes number Starting timestamp (in epoch milliseconds) for the candle.

Get funding rates history

HTTP Request

GET /api/v1/info/{market}/funding?&startTime={startTime}&endTime={endTime}

Get the funding rates history for an individual market for the specified timeframe in the request. The funding rates are sorted by timestamp in descending order.

The endpoint returns a maximum of 10,000 records; pagination should be used to access records beyond this limit.

While the funding rate is calculated every minute, it is only applied once per hour. The records represent the 1-hour rates that were applied for the payment of funding fees.

For details on how the funding rate is calculated on X10, please refer to the documentation.

URL Parameters

Parameter Required Type Description
market yes string Names of the requested market.

Query Parameters

Parameter Required Type Description
startTime yes number Starting timestamp (in epoch milliseconds) for the requested period.
endTime yes number Ending timestamp (in epoch milliseconds) for the requested period.
cursor no Determines the offset of the returned result. To get the next result page, you can use the cursor from the pagination section of the previous response.
limit no number Maximum number of items that should be returned.

Response example:

{
  "status": "OK",
  "data": [
    {
      "m": "BTC-USD",
      "T": 1701563440,
      "f": "0.001"
    }
  ],
  "pagination": {
    "cursor": 1784963886257016832,
    "count": 1
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].m yes string Name of the requested market.
data[].T yes number Timestamp (in epoch milliseconds) when the funding rate was calculated and applied.
data[].f yes string Funding rates used for funding fee payments.

Private REST-API

Account

You can create up to ten X10 sub-accounts for each L1 wallet address. For more details, please refer to the Authentication section of the API Documentation.

The Private API endpoints listed below grant access to details specific to each sub-account, such as balances, positions, orders, trades, and the fee rates applied. Additionally, there are endpoints for retrieving the current leverage and adjusting it.

Please note that all endpoints in this section will only return records for the authenticated sub-account.

Get balance

HTTP Request

GET /api/v1/user/balance

Get key balance details for the authenticated sub-account:

  1. Account Balance = Deposits - Withdrawals + Realised PnL.

  2. Equity = Account Balance + Unrealised PnL.

  3. Available Balance for Trading = Equity - Initial Margin Requirement.

  4. Available Balance for Withdrawals = Wallet Balance + min(0,Unrealised PnL) - Initial Margin Requirement.

  5. Unrealised PnL = The sum of unrealised PnL across open positions, calculated as Position Size * (Mark Price - Entry Price).

  6. Initial Margin Requirement for a given market = Max(Abs(Position Value + Value of Buy Orders), Abs(Position Value + Value of Sell Orders))*1/Leverage.

  7. Account Margin Ratio = Maintenance Margin requirement of all open positions / Equity. Liquidation is triggered when Account Margin Ratio > 100%

Response example:

{
  "status": "OK",
  "data": {
    "collateralName": "USDC",
    "balance": "13500",
    "equity": "12000",
    "availableForTrade": "1200",
    "availableForWithdrawal": "100",
    "unrealisedPnl": "-10.1",
    "initialMargin": "160",
    "marginRatio": "1.5",
    "updatedTime": 1701563440
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data.collateralName yes string Name of the collateral asset used for the account.
data.balance yes string Account balance expressed in the collateral asset, also known as Wallet balance.
data.equity yes string Equity of the account.
data.availableForTrade yes string Available Balance for Trading.
data.availableForWithdrawal yes string Available Balance for Withdrawals.
data.unrealisedPnl yes string Current unrealised PnL of the account.
data.initialMargin yes string Collateral used to open the positions and orders.
data.marginRatio yes string Margin ratio of the account.
data.updatedTime yes number Timestamp (in epoch milliseconds) when the server generated the balance message.

Get positions

HTTP Request

GET /api/v1/user/positions?market={market}&side={side}

Get all open positions for the authenticated sub-account. Optionally, the request can be filtered by a specific market or position side (long or short).

To request data for multiple markets, use the following format: GET /api/v1/user/positions?market=market1&market2.

Query Parameters

Parameter Required Type Description
market no string List of names of the requested markets.
side no string Position side. Can be long or short.

Response example:

{
  "status": "OK",
  "data": [
    {
      "id": 1,
      "accountId": 1,
      "market": "BTC-USD",
      "side": "LONG",
      "leverage": "10",
      "size": "0.1",
      "value": "4000",
      "openPrice": "39000",
      "markPrice": "40000",
      "liquidationPrice": "38200",
      "margin": "20",
      "unrealisedPnl": "1000",
      "realisedPnl": "1.2",
      "tpTriggerPrice": "41000",
      "tpLimitPrice": "41500",
      "slTriggerPrice": "39500",
      "slLimitPrice": "39000",
      "adl": "2.5",
      "maxPositionSize": "0.2",
      "createdTime": 1701563440000,
      "updatedTime": 1701563440
    }
  ]
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].id yes number Position ID assigned by X10.
data[].accountId yes number Account ID.
data[].market yes string Market name.
data[].side yes string Position side. Can be long or short.
data[].leverage yes string Position leverage.
data[].size yes string Position size, absolute value in base asset.
data[].value yes string Position value, absolute value in collateral asset.
data[].openPrice yes string Position's open (entry) price.
data[].markPrice yes string Current mark price of the market.
data[].liquidationPrice yes string Position's liquidation price.
data[].margin yes string Position margin in collateral asset.
data[].unrealisedPnl yes string Position's Unrealised PnL.
data[].realisedPnl yes string Position's Realised PnL.
data[].tpTriggerPrice no string Take Profit Trigger price.
data[].tpLimitPrice no string Take Profit Limit price.
data[].slTriggerPrice no string Stop Loss Trigger price.
data[].slLimitPrice no string Stop Loss Limit price.
data[].maxPositionSize yes string Maximum allowed position size, absolute value in base asset.
data[].adl yes string Position's Auto-Deleveraging (ADL) ranking in the queue, expressed as a percentile. A value closer to 100 indicates a higher likelihood of being ADLed.
data[].createdTime yes number Timestamp (epoch milliseconds) when the position was created.
data[].updatedTime yes number Timestamp (epoch milliseconds) when the position was updated.

Get positions history

HTTP Request

GET /api/v1/user/positions/history?market={market}&side={side}

Get all open and closed positions for the authenticated sub-account. Optionally, the request can be filtered by a specific market or position side (long or short).

To request data for several markets, use the following format: GET /api/v1/user/positions/history?market=market1&market2.

The endpoint returns a maximum of 10,000 records; pagination should be used to access records beyond this limit.

Query Parameters

Parameter Required Type Description
market no string List of names of the requested markets.
side no string Position side. Can be long or short.
cursor no Determines the offset of the returned result. It represents the ID of the item after which you want to retrieve the next result. To get the next result page, you can use the cursor from the pagination section of the previous response.
limit no number Maximum number of items that should be returned.

Response example:

{
  "status": "OK",
  "data": [
    {
      "id": 1784963886257016832,
      "accountId": 1,
      "market": "BTC-USD",
      "side": "LONG",
      "exitType": "TRADE",
      "leverage": "10",
      "size": "0.1",
      "maxPositionSize": "0.2",
      "openPrice": "39000",
      "exitPrice": "40000",
      "realisedPnl": "1.2",
      "createdTime": 1701563440000,
      "closedTime": 1701563440
    }
  ],
  "pagination": {
    "cursor": 1784963886257016832,
    "count": 1
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].id yes number Position ID assigned by X10.
data[].accountId yes number Account ID.
data[].market yes string Market name.
data[].side yes string Position side. Can be long or short.
data[].exitType no string The exit type for the last trade, which decreased the position, can be trade, liquidation, or adl.
data[].leverage yes string Position leverage.
data[].size yes string Position size, absolute value in base asset.
data[].maxPositionSize yes string Maximum allowed position size, absolute value in base asset.
data[].openPrice yes string The weighted average price of trades that contributed to increasing the position.
data[].exitPrice no string The weighted average price of trades that contributed to decreasing the position.
data[].realisedPnl yes string Position Realised PnL.
data[].createdTime yes number Timestamp (in epoch milliseconds) when the position was created.
data[].closedTime no number Timestamp (in epoch milliseconds) when the position was closed, applicable only for closed positions.

Get open orders

HTTP Request

GET /api/v1/user/orders?market={market}&type={type}&side={side}

Get all open orders for the authenticated sub-account. Optionally, the request can be filtered by a specific market or order type (limit, market, conditional, or tpsl).

Open orders correspond to the following order statuses from the list below: new, partially filled, untriggered.

To request data for several markets, use the following format: GET /api/v1/user/positions/history?market=market1&market2.

Order statuses

Status Description
NEW Order in the order book, not yet filled
PARTIALLY_FILLED Order in the order book, partially filled.
FILLED Order fully filled.
UNTRIGGERED Conditional order waiting for the trigger price.
CANCELLED Order cancelled.
REJECTED Order rejected.
EXPIRED Order expired.
TRIGGERED Technical status, transition from UNTRIGGERED to NEW.

Order status reasons (When order cancelled or rejected)

Reason Description
NONE Order was accepted.
UNKNOWN Technical status reason.
UNKNOWN_MARKET Market does not exist.
DISABLED_MARKET Market is not active.
NOT_ENOUGH_FUNDS Insufficient balance to create order.
NO_LIQUIDITY Not enough liquidity in the market to execute the order.
INVALID_FEE Fee specified in the create order request is invalid.
INVALID_QTY Quantity specified is invalid.
INVALID_PRICE Price specified is invalid.
INVALID_VALUE Order exceeds the maximum value.
UNKNOWN_ACCOUNT Account does not exist.
SELF_TRADE_PROTECTION Order cancelled to prevent self-trading.
POST_ONLY_FAILED Order could not be posted as a post-only order.
REDUCE_ONLY_FAILED Reduce-only order failed due to position size conflict.
INVALID_EXPIRE_TIME Expiration time specified is invalid.
POSITION_TPSL_CONFLICT TPSL position order already exists.
INVALID_LEVERAGE Leverage specified is invalid.
PREV_ORDER_NOT_FOUND The order to be replaced does not exist.
PREV_ORDER_TRIGGERED The order to be replaced has been triggered and cannot be replaced.

Query Parameters

Parameter Required Type Description
market no string List of names of the requested markets.
type no string Order type. Can be limit, market, conditional or tpsl.
side no string Order side. Can be buy or sell.

Response example:

{
  "status": "OK",
  "data": [
    {
      "id": 1775511783722512384,
      "accountId": 3017,
      "externalId": "2554612759479898620327573136214120486511160383028978112799136270841501275076",
      "market": "ETH-USD",
      "type": "LIMIT",
      "side": "BUY",
      "status": "PARTIALLY_FILLED",
      "price": "3300",
      "averagePrice": "3297.00",
      "qty": "0.2",
      "filledQty": "0.1",
      "payedFee": "0.0120000000000000",
      "trigger": {
        "triggerPrice": "3300",
        "triggerPriceType": "LAST",
        "triggerPriceDirection": "UP",
        "executionPriceType": "MARKET"
      },
      "takeProfit": {
        "triggerPrice": "3500",
        "triggerPriceType": "LAST",
        "price": "3340",
        "priceType": "MARKET"
      },
      "stopLoss": {
        "triggerPrice": "2800",
        "triggerPriceType": "LAST",
        "price": "2660",
        "priceType": "MARKET"
      },
      "reduceOnly": false,
      "postOnly": false,
      "createdTime": 1701563440000,
      "timeInForce": "FOK",
      "expireTime": 1712754771819
    }
  ]
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].id yes number Order ID assigned by X10.
data[].externalId yes string Order ID assigned by user.
data[].accountId yes number Account ID.
data[].market yes string Market name.
data[].status yes string Order status.
data[].statusReason no string Reason for REJECTED or CANCELLED status.
data[].type yes string Order type. Can be limit, market, conditional or tpsl.
data[].side yes string Order side. Can be buy or sell.
data[].price no string Worst accepted price in the collateral asset.
data[].averagePrice no string Actual filled price, empty if not filled.
data[].qty yes string Order size in base asset.
data[].filledQty no string Actual filled quantity in base asset.
data[].payedFee no string Paid fee.
data[].reduceOnly no boolean Whether the order is Reduce-only.
data[].postOnly no boolean Whether the order is Post-only.
data[].trigger.triggerPrice no string Trigger price for conditional orders.
data[].trigger.triggerPriceType no string Trigger price type . Can be last, mark or index.
data[].trigger.triggerPriceDirection no string Indicates whether the order should be triggered when the price is above or below the set trigger price. It can be up (the order will be triggered when the price reaches or surpasses the set trigger price) or down (the order will be triggered when the price reaches or drops below the set trigger price).
data[].trigger.executionPriceType no string Execution price type. Can be limit or market.
data[].tpSlType no string TPSL type determining TPSL order size. Can be order or position.
data[].takeProfit.triggerPrice no string Take Profit Trigger price.
data[].takeProfit.triggerPriceType no string Take Profit Trigger price type. Can be last, mark or index.
data[].takeProfit.price no string Take Profit order price.
data[].takeProfit.priceType no string Indicates whether the Take profit order should be executed as market or limit order.
data[].stopLoss.triggerPrice no string Stop loss Trigger price.
data[].stopLoss.triggerPriceType no string Stop Loss Trigger price type. Can be last, mark or index.
data[].stopLoss.price no string Stop loss order price.
data[].stopLoss.priceType no string Indicates whether the Stop loss order should be executed as market or limit order.
data[].createdTime yes number Timestamp (in epoch milliseconds) of order creation.
data[].timeInForce yes string Time-in-force. Can be GTT (Good till time), FOK (Fill or kill) or IOC (Immediate or cancel).
data[].expireTime yes number Timestamp (in epoch milliseconds) when the order expires.

Get orders history

HTTP Request

GET /api/v1/user/orders/history?market={market}&type={type}&side={side}

Get orders history for the authenticated sub-account. Optionally, the request can be filtered by a specific market or order type (limit, market, conditional, or tpsl).

History orders correspond to the following order statuses from the list below: filled, cancelled, rejected, expired.

To request data for several markets, use the following format: GET /api/v1/user/positions/history?market=market1&market2.

The endpoint returns a maximum of 10,000 records; pagination should be used to access records beyond this limit. The records for non-filled orders are available only for the past 3 days.

Order statuses

Status Description
NEW Order in the order book, not yet filled
PARTIALLY_FILLED Order in the order book, partially filled.
FILLED Order fully filled.
UNTRIGGERED Conditional order waiting for the trigger price.
CANCELLED Order cancelled.
REJECTED Order rejected.
EXPIRED Order expired.
TRIGGERED Technical status, transition from UNTRIGGERED to NEW.

Query Parameters

Parameter Required Type Description
market no string List of names of the requested markets.
type no string Order type. Can be limit, market, conditional or tpsl.
side no string Order side. Can be buy or sell.
cursor no Determines the offset of the returned result. It represents the ID of the item after which you want to retrieve the next result. To get the next result page, you can use the cursor from the pagination section of the previous response.
limit no number Maximum number of items that should be returned.

Response example:

{
  "status": "OK",
  "data": [
    {
      "id": 1784963886257016832,
      "externalId": "ExtId-1",
      "accountId": 1,
      "market": "BTC-USD",
      "status": "FILLED",
      "type": "LIMIT",
      "side": "BUY",
      "price": "39000",
      "averagePrice": "39000",
      "qty": "0.2",
      "filledQty": "0.1",
      "payedFee": "0.0120000000000000",
      "reduceOnly": false,
      "postOnly": false,
      "trigger": {
        "triggerPrice": "34000",
        "triggerPriceType": "LAST",
        "triggerPriceDirection": "UP",
        "executionPriceType": "MARKET"
      },
      "tpslType": "ORDER",
      "takeProfit": {
        "triggerPrice": "34000",
        "triggerPriceType": "LAST",
        "price": "35000",
        "priceType": "MARKET",
        "starkExSignature": ""
      },
      "stopLoss": {
        "triggerPrice": "34000",
        "triggerPriceType": "LAST",
        "price": "35000",
        "priceType": "MARKET",
        "starkExSignature": ""
      },
      "createdTime": 1701563440000,
      "timeInForce": "FOK",
      "expireTime": 1706563440
    }
  ],
  "pagination": {
    "cursor": 1784963886257016832,
    "count": 1
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].id yes number Order ID assigned by X10.
data[].externalId yes string Order ID assigned by user.
data[].accountId yes number Account ID.
data[].market yes string Market name.
data[].status yes string Order status.
data[].statusReason no string Reason for REJECTED or CANCELLED status.
data[].type yes string Order type. Can be limit, market, conditional or tpsl.
data[].side yes string Order side. Can be buy or sell.
data[].price no string Worst accepted price in the collateral asset.
data[].averagePrice no string Actual filled price, empty if not filled.
data[].qty yes string Order size in base asset.
data[].filledQty no string Actual filled quantity in base asset.
data[].payedFee no string Paid fee.
data[].reduceOnly no boolean Whether the order is Reduce-only.
data[].postOnly no boolean Whether the order is Post-only.
data[].trigger.triggerPrice no string Trigger price for conditional orders.
data[].trigger.triggerPriceType no string Trigger price type . Can be last, mark or index.
data[].trigger.triggerPriceDirection no string Indicates whether the order should be triggered when the price is above or below the set trigger price. It can be up (the order will be triggered when the price reaches or surpasses the set trigger price) or down (the order will be triggered when the price reaches or drops below the set trigger price).
data[].trigger.executionPriceType no string Execution price type. Can be limit or market.
data[].tpSlType no string TPSL type determining TPSL order size. Can be order or position.
data[].takeProfit.triggerPrice no string Take Profit Trigger price.
data[].takeProfit.triggerPriceType no string Take Profit Trigger price type. Can be last, mark or index.
data[].takeProfit.price no string Take Profit order price.
data[].takeProfit.priceType no string Indicates whether the Take profit order should be executed as market or limit order.
data[].stopLoss.triggerPrice no string Stop loss Trigger price.
data[].stopLoss.triggerPriceType no string Stop Loss Trigger price type. Can be last, mark or index.
data[].stopLoss.price no string Stop loss order price.
data[].stopLoss.priceType no string Indicates whether the Stop loss order should be executed as market or limit order.
data[].createdTime yes number Timestamp (in epoch milliseconds) of order creation.
data[].timeInForce yes string Time-in-force. Can be GTT (Good till time), FOK (Fill or kill) or IOC (Immediate or cancel).
data[].expireTime yes number Timestamp (in epoch milliseconds) when the order expires.

Get trades

HTTP Request

GET /api/v1/user/trades?market={market}&type={type}&side={side}

Get trades history for the authenticated sub-account. Optionally, the request can be filtered by a specific market, by trade type (trade, liquidation or deleverage) and side (buy or sell).

To request data for several markets, use the following format: GET /api/v1/user/trades?market=market1&market2.

The endpoint returns a maximum of 10,000 records; pagination should be used to access records beyond this limit.

Query Parameters

Parameter Required Type Description
market no string List of names of the requested markets.
type no string Trade type. Can be trade, liquidation or deleverage.
side no string Order side. Can be buy or sell.

Response example:

{
  "status": "OK",
  "data": [
    {
      "id": 1784963886257016832,
      "accountId": 3017,
      "market": "BTC-USD",
      "orderId": 9223372036854775808,
      "side": "BUY",
      "price": "58853.4000000000000000",
      "qty": "0.0900000000000000",
      "value": "5296.8060000000000000",
      "fee": "0.0000000000000000",
      "tradeType": "DELEVERAGE",
      "createdTime": 1701563440000,
      "isTaker": true
    }
  ],
  "pagination": {
    "cursor": 1784963886257016832,
    "count": 1
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data[].id yes number Trade ID assigned by X10.
data[].accountId yes number Account ID.
data[].market yes string Market name.
data[].orderId yes string Order ID assigned by X10.
data[].side yes string Order side. Can be buy or sell.
data[].averagePrice yes string Actual filled price.
data[].filledQty yes string Actual filled quantity in base asset.
data[].value yes string Actual filled absolute nominal value in collateral asset.
data[].fee yes string Paid fee.
data[].isTaker yes boolean Whether the trade was executed as a taker.
data[].tradeType yes string Trade type. Can be trade (for regular trades), liquidation (for liquidaton trades) or deleverage (for ADL trades).
data[].createdTime yes number Timestamp (in epoch milliseconds) when the trade happened.

Get current leverage

HTTP Request

GET /api/v1/user/leverage?market={market}

Get current leverage for the authenticated sub-account. You can get current leverage for all markets, a single market, or multiple specific markets.

To request data for several markets, use the format GET/api/v1/user/leverage?market=market1&market=market2.

Query Parameters

Parameter Required Type Description
market no string Name of the requested market.

Response example:

{
  "status": "OK",
  "data": [
    {
      "market": "SOL-USD",
      "leverage": "10"
    }
  ]
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data.market yes string Market name.
data.leverage yes string Current leverage.

Update leverage

HTTP Request

PATCH /api/v1/user/leverage

Update leverage for an individual market.

Modifying your leverage will impact your Available balance and Initial Margin requirements of your open position and orders in the market.

To adjust your leverage, you must meet two requirements: - The total value of your open position and triggered orders must remain below the maximum position value allowed for the selected leverage. - Your Available balance must be sufficient to cover the additional Margin requirements (if any) associated with the new leverage.

Failure to meet either of these criteria will result in an error.

For details on Margin requirements, please refer to the documentation.

Request example:

{
  "market": "BTC-USD",
  "leverage": "10"
}

Body Parameters

Parameter Required Type Description
market yes string Name of the requested market.
leverage yes string Target leverage.

Response example:

{
  "status": "OK",
  "data": {
    "market": "BTC-USD",
    "leverage": "10"
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data.market yes string Market name.
data.leverage yes string Updated leverage.

Get fees

HTTP Request

GET /api/v1/user/fees?market={market}

Get current fees for the sub-account.

Fees on X10 are determined by:

  1. The type of order: Maker vs. Taker,

  2. The cumulative trading volume over the past 30 days.

For details on the Fee Schedule, please refer to the documentation.

Query Parameters

Parameter Required Type Description
market no string Name of the requested market.

Response example:

{
  "status": "OK",
  "data": [
    {
      "market": "BTC-USD",
      "makerFeeRate": "0.0002",
      "takerFeeRate": "0.0005"
    }
  ]
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data.market yes string Market name.
data.makerFeeRate yes string Maker fee rate.
data.takerFeeRate yes string Taker fee rate.

Order management

The Private API endpoints listed below allow you to create, cancel, and manage orders from the authenticated sub-account.

StarkEx-Specific Logic

X10's use of the StarkEx Layer 2 engine introduces unique elements to order creation that differ from centralized exchanges:

  1. StarkKey Signature: Required for all order management endpoints. For details, please refer to the reference implementation in the Python SDK.

  2. Price Parameter: All orders, including market orders, require a price as a mandatory parameter.

  3. Fee Parameter: All orders require a fee as a mandatory parameter. The Fee parameter represents the maximum fee a user is willing to pay for an order. Use the maker fee for Post-only orders and the taker fee for all other orders. Enter the fee in decimal format (e.g., 0.1 for 10%). To view current fees, utilize the Get fees endpoint, which displays applicable fee rates.

  4. Expiration Timestamp: All orders, including 'Fill or Kill' and 'Immediate or Cancel' orders, require an expiration timestamp as a mandatory parameter. When submitting orders via the API, enter the expiration time as an epoch timestamp in milliseconds. On the Testnet, the maximum allowable expiration time is 28 days from the order creation date.

  5. Market Orders: StarkEx does not natively support market orders. On the UI, market orders are created as limit IOC (Immediate-or-Cancel) orders with a price parameter set to ensure immediate execution. For example, Market Buy Orders are set at the best ask price multiplied by 1.05, and Market Sell Orders at the best bid price multiplied by 0.95 (subtracting 5%).

  6. TPSL Orders: Orders with Take Profit and/or Stop Loss require multiple signatures. Please feel free to refer to the (documentation)[https://docs.x10.exchange/x10-resources/trading/order-types] to see supported types of TPSL orders.

Create order

HTTP Request

POST /api/v1/user/order

Create a new order or replace an open order by adding its ID as the cancelId parameter. When you create an order via our REST API, the initial response will confirm whether the order has been successfully accepted. Please be aware that, although rare, orders can be canceled or rejected by the Matching Engine even after acceptance at the REST API level. To receive real-time updates on your order status, it is crucial to subscribe to the Order WebSocket stream. This stream provides immediate notifications of any changes to your orders, including confirmations, cancellations, and rejections, allowing you to manage your trading strategies effectively.

Currently, we support limit, market, conditional and tpsl order types, along with reduce-only and post-only settings. For API trading, we offer the following Time-in-force settings: GTT (Good till time - default), FOK (Fill or kill) and IOC (Immediate or cancel). On the Testnet, the GTT expiration time cannot exceed 28 days from the order creation time. For details on supported order types and settings, please refer to the documentation

To successfully place an order, it must meet the following requirements:

  1. Trading Rules. For detailed information, please refer to the trading rules documentation.

  2. Order Cost Requirements. For detailed information, please refer to the order cost documentation.

  3. Margin Schedule Requirements. For detailed information, please refer to the margin schedule documentation.

  4. Price requirements, which are described below.

Price requirements

  1. Limit Orders
  1. Market Orders
  1. Conditional Orders
  1. TPSL Orders

Entry order: Buy; TPSL order: Sell.

Validation Stop loss Take profit
Trigger price validation Trigger price < Entry order price Trigger price > Entry order price.
Limit price validation Order Price ≥ Trigger price * (1-Limit Order Floor Ratio) Order Price ≥ Trigger price * (1-Limit Order Floor Ratio)

Entry order: Sell; TPSL order: Buy.

Validation Stop loss Take profit
Trigger price validation Trigger price > Entry order price. Trigger price < Entry order price.
Limit price validation Order Price ≤ Trigger Price * (1+Limit Order Price Cap) Order Price ≤ Trigger Price * (1+Limit Order Price Cap)

Request

Request example:

{
  "id": "e581a9ca-c3a2-4318-9706-3f36a2b858d3",
  "market": "BTC-USDT",
  "type": "CONDITIONAL",
  "side": "BUY",
  "qty": "1",
  "price": "1000",
  "timeInForce": "GTT",
  "expiryEpochMillis": 1715884049245,
  "fee": "0.0002",
  "nonce": "7923502913187648439",
  "settlement": {
    "signature": {
      "r": "0x17a89cb97c64f546d2dc9189e1ef73547487b228945dcda406cd0e4b8301bd3",
      "s": "0x385b65811a0fc92f109d5ebc30731efd158ee4e502945cd2fcb35a4947b045e"
    },
    "starkKey": "0x23830b00378d17755775b5a73a5967019222997eb2660c2dbfbc74877c2730f",
    "collateralPosition": "4272448241247734333"
  },
  "reduceOnly": true,
  "postOnly": false,
  "trigger": {
    "triggerPrice": "12000",
    "triggerPriceType": "LAST",
    "direction": "UP",
    "executionPriceType": "LIMIT"
  },
  "tpSlType": "ORDER",
  "takeProfit": {
    "triggerPrice": "1050",
    "triggerPriceType": "LAST",
    "price": "1300",
    "priceType": "LIMIT",
    "settlement": {
      "signature": {
        "r": "0x5b45f0fb2b8e075f6a5f9b4c039ccf1c01c56aa212c63f943337b920103c3a1",
        "s": "0x46133ab89d90a3ae2a3a7680d2a27e30fa015c0c4979931164c51b52b27758a"
      },
      "starkKey": "0x23830b00378d17755775b5a73a5967019222997eb2660c2dbfbc74877c2730f",
      "collateralPosition": "4272448241247734333"
    }
  },
  "stopLoss": {
    "triggerPrice": "950",
    "triggerPriceType": "LAST",
    "price": "900",
    "priceType": "LIMIT",
    "settlement": {
      "signature": {
        "r": "0x5033ad23fe851d16ceec5dd99f2f0c9585c5abec3f09ec89a32a961536ba55",
        "s": "0x1234ee151a8b5c68efb4adaa2eaf1dcc4a5107d4446274a69389ef8abd2dcf"
      },
      "starkKey": "0x23830b00378d17755775b5a73a5967019222997eb2660c2dbfbc74877c2730f",
      "collateralPosition": "4272448241247734333"
    }
  }
}

Body Parameters

Parameter Required Type Description
id yes string Order ID assigned by user.
market yes string Market name.
type yes string Order type. Can be limit, market, conditional or tpsl.
side yes string Order side. Can be buy or sell.
qty yes string Order size in base asset.
price yes string Worst accepted price in collateral asset. Note that price is optional for a tpsl type position.
reduceOnly no boolean Whether the order should be Reduce-only.
postOnly no boolean Whether the order should be Post-only.
timeInForce yes string Time-in-force setting. Can be GTT (Good till time), FOK (Fill or kill) or IOC (Immediate or cancel). This parameter will default to GTT.
expiryEpochMillis yes string Timestamp (in epoch milliseconds) when the order expires if not filled. Cannot exceed 28 days from the order creation time on Testnet.
fee yes string Highest accepted fee for the trade, expressed in decimal format (e.g., 0.1 for 10%). Use the maker fee for Post-only orders and the taker fee for all other orders.
cancelId no string External ID of the order that this order is replacing.
settlement yes object StarkKey signature, including nonce and signed order parameters. For details, please refer to the Python SDK reference implementation.
trigger.triggerPrice no string Price threshold for triggering a conditional order.
trigger.triggerPriceType no string Type of price used for the order triggering. Can be last, mark or index.
trigger.triggerPriceDirection no string Indicates whether the order should be triggered when the price is above or below the set trigger price. It can be up (the order will be triggered when the price reaches or surpasses the set trigger price) or down (the order will be triggered when the price reaches or drops below the set trigger price).
trigger.executionPriceType no string Type of price used for the order execution. Can be limit or market.
tpSlType no string TPSL type determining TPSL order size. Can be order or position.
takeProfit.triggerPrice no string Take Profit Trigger price.
takeProfit.triggerPriceType no string Type of price used for the Take Profit order triggering. Can be last, mark or index.
takeProfit.price no string Take Profit order price.
takeProfit.priceType no string Indicates whether the Take profit order should be executed as market or limit order.
takeProfit.settlement no object StarkKey signature, including nonce and signed order parameters. For details, please refer to the Python SDK reference implementation.
triggerPrice no string Stop loss Trigger price.
stopLoss.triggerPriceType no string Type of price used for the Stop Loss order triggering. Can be last, mark or index.
stopLoss.price no string Stop loss order price.
stopLoss.priceType no string Indicates whether the Stop loss order should be executed as market or limit order.
stopLoss.settlement no object StarkKey signature, including nonce and signed order parameters. For details, please refer to the Python SDK reference implementation.

Response example:

{
  "status": "OK",
  "data": {
    "id": 1791389621914243072,
    "externalId": "31097979600959341921260192820644698907062844065707793749567497227004358262"
  }
}

Response

Parameter Required Type Description
status yes string Can be ok or error.
data.id yes number Order ID assigned by X10.
data.externalId yes string Order ID assigned by user.

Cancel order

HTTP Request

DELETE /api/v1/user/order/{id}

Cancel an individual order.

The cancellation process is asynchronous, the endpoint returns only the status of the cancellation.

URL Parameters

Parameter Required Type Description
id yes number Order to be canceled, ID assigned by X10.

DELETE /api/v1/user/order?externalId={externalId}

Cancel an individual order.

The cancellation process is asynchronous, the endpoint returns only the status of the cancellation.

URL Parameters

Parameter Required Type Description
externalId yes string Order to be canceled, Order ID assigned by user.

Response

Parameter Required Type Description
status yes string Can be ok or error.

Mass Cancel

HTTP Request

POST /api/v1/user/order/massCancel

Mass Cancel enables the cancellation of multiple orders by ID, by specific market, or for all orders within an account.

The cancellation process is asynchronous; the endpoint returns only the status of the cancellation request.

Although all parameters are optional, at least one must be specified.

Request example:

{
  "orderIds": [
    1,
    2
  ],
  "externalOrderIds": [
    "ExtId-1",
    "ExtId-2"
  ],
  "markets": [
    "BTC-USD",
    "ETH-USD"
  ],
  "cancellAll": true
}

Body Parameters

Parameter Required Type Description
markets no List of strings Market names where all orders should be cancelled.
cancelAll no boolean Indicates whether all open orders for the account should be cancelled.
orderIds no List of numbers Cancel by X10 IDs.
externalOrderIds no List of string Cancel by external IDs.

Response

Parameter Required Type Description
status yes string Can be ok or error.

Public WebSocket streams

X10 offers a WebSocket API for streaming updates.

Connect to the WebSocket streams using ws://api.x10.exchange as the host.

The server sends pings every 15 seconds and expects a pong response within 10 seconds. Although the server does not require pings from the client, it will respond with a pong if one is received.

Orderbooks stream

HTTP Request

GET /stream.x10.exchange/v1/orderbooks/{market}

Subscribe to the orderbooks stream for a specific market or for all available markets. If the market parameter is not submitted, the stream will include data for all available markets.

The initial response from the stream will be a snapshot of the order book, provided immediately after subscription. Subsequent updates occur every minute. All updates after the initial snapshot are delivered in delta format, reflecting only changes since the last update.

In the current version we support the following depth specifications:

URL Parameters

Parameter Required Type Description
market no string Select an individual market. If not specified, the subscription includes all markets.

Query Parameters

Parameter Required Type Description
depth no string Specify '1' to receive updates for best bid & ask only.

Response example:

{
  "ts": 1701563440,
  "type": "SNAPSHOT",
  "data": {
    "m": "BTC-USD",
    "b": [
      {
        "p": "25670",
        "q": "0.1"
      }
    ],
    "a": [
      {
        "p": "25770",
        "q": "0.1"
      }
    ]
  },
  "seq": 1
}

Response

Parameter Type Description
type string Type of message. Can be snapshot or delta.
ts number Timestamp (in epoch milliseconds) when the system generated the data.
data.m string Market name.
data.b array List of bid orders. For a snapshot, bids are sorted by price in descending order.
data.b[].p string Bid price.
data.b[].q string Bid size. For a snapshot, this represents the absolute size; for a delta, the change in size.
data.a array List of ask orders. For a snapshot, asks are sorted by price in ascending order.
data.a[].p string Ask price.
data.a[].q string Ask size. For a snapshot, this represents the absolute size; for a delta, the change in size.
seq number Monothonic sequence number. '1' corresponds to the first snapshot, and all subsequent numbers correspond to deltas. If a client receives a sequence out of order, it should reconnect.

Trades stream

HTTP Request

GET /stream.x10.exchange/v1/publicTrades/{market}

Subscribe to the trades stream for a specific market or for all available markets. If the market parameter is not submitted, the stream will include data for all available markets.

For historical trades data, use the Get trades history endpoint.

URL Parameters

Parameter Required Type Description
market no string Select an individual market. If not specified, the subscription includes all markets.

Response example:

{
  "ts": 1701563440,
  "data": [
    {
      "m": "BTC-USD",
      "S": "BUY",
      "tT": "TRADE",
      "T": 1701563440,
      "p": "25670",
      "q": "0.1",
      "i": 25124
    }
  ],
  "seq": 2
}

Response

Parameter Type Description
ts number Timestamp (in epoch milliseconds) when the system generated the data.
data[].m string Market name.
data[].S string Side of taker trades. Can be buy or sell.
data[].tT string Trade type. Can be trade, liquidation or deleverage.
data[].T number Timestamp (in epoch milliseconds) when the trade happened.
data[].p string Trade price.
data[].q string Trade quantity in base asset.
data[].i number Trade ID.
seq number Monotonic sequence: Since there are no deltas, clients can skip trades that arrive out of sequence.

Funding rates stream

HTTP Request

GET /stream.x10.exchange/v1/funding/{market}

Subscribe to the funding rates stream for a specific market or for all available markets. If the market parameter is not submitted, the stream will include data for all available markets.

For historical funding rates data, use the Get funding rates history endpoint.

While the funding rate is calculated every minute, it is applied only once per hour. The records include only those funding rates that were used for funding fee payments.

URL Parameters

Parameter Required Type Description
market no string Select an individual market. If not specified, the subscription includes all markets.

Response example:

{
  "ts": 1701563440,
  "data": [
    {
      "m": "BTC-USD",
      "T": 1701563440,
      "f": "0.001"
    }
  ],
  "seq": 2
}

Response

Parameter Type Description
ts number Timestamp (in epoch milliseconds) when the system generated the data.
data[].m string Market name.
data[].T number Timestamp (in epoch milliseconds) when the funding rate was calculated and applied.
data[].f string Funding rates that were applied for funding fee payments.
seq number Monotonic sequence: Since there are no deltas, clients can skip funding rates that arrive out of sequence.

Candles stream

HTTP Request

GET /stream.x10.exchange/v1/candles/{market}/{candleType}?interval={interval}

Subscribe to the candles stream for a specific market or for all available markets. If the market parameter is not submitted, the stream will include data for all available markets.

The interval parameter should be specified in the ISO 8601 duration format. Available intervals include:

Trades price response example:

{
  "ts": 1695738675123,
  "data": [ 
    {
      "T": 1695738674000,
      "o": "1000.0000",
      "l": "800.0000",
      "h": "2400.0000",
      "c": "2100.0000",
      "v": "10.0000"
    }
  ],
  "seq": 1
}

Mark and Index price response example:

{
  "ts": 1695738675123,
  "data": [
    {
      "T": 1695738674000,
      "o": "1000.0000",
      "l": "800.0000",
      "h": "2400.0000",
      "c": "2100.0000"
    }
  ],
  "seq": 1
}

Available price types include:

  1. Trades price: GET /stream.x10.exchange/v1/candles/{market}/trades?interval=PT1M

  2. Mark price: GET /stream.x10.exchange/v1/candles/{market}/mark-prices?interval=PT1M

  3. Index price: GET /stream.x10.exchange/v1/candles/{market}/index-prices?interval=PT1M

Push frequency: 1-10s.

URL Parameters

Parameter Required Type Description
market no string Select an individual market. If not specified, the subscription includes all markets.
candleType yes string Price type. Can be trades, mark-prices or index-prices.

Query Parameters

Parameter Required Type Description
interval yes string Duration of candle (duration in ISO 8601).

Response

Parameter Type Description
ts number Timestamp (in epoch milliseconds) when the system generated the data.
data[].T number Starting timestamp (in epoch milliseconds) of the candle.
data[].o string Open price.
data[].c string Close price.
data[].h string High price.
data[].l string Low price.
data[].v string Trading volume (only for trade candles).
seq number Monothonic sequence number. '1' corresponds to the first snapshot, and all subsequent numbers correspond to deltas. If a client receives a sequence out of order, it should reconnect.

Private WebSocket streams

Сonnect to the WebSocket streams using ws://api.x10.exchange as the host.

The server sends pings every 15 seconds and expects a pong response within 10 seconds. Although the server does not require pings from clients, it will respond with a pong if it receives one.

Account updates stream

HTTP Request

GET /stream.x10.exchange/v1/account

Orders updates response example:

{
  "type": "ORDER",
  "data": {
    "orders": [
      {
        "id": 1791181340771614723,
        "accountId": 1791181340771614721,
        "externalId": "-1771812132822291885",
        "market": "BTC-USD",
        "type": "LIMIT",
        "side": "BUY",
        "status": "NEW",
        "price": "12400.000000",
        "averagePrice": "13140.000000",
        "qty": "10.000000",
        "filledQty": "3.513000",
        "payedFee": "0.513000",
        "trigger": {
          "triggerPrice": "1220.00000",
          "triggerPriceType": "LAST",
          "direction": "UP",
          "executionPriceType": "LIMIT"
        },
        "tpSlType": "ORDER",
        "takeProfit": {
          "triggerPrice": "1.00000",
          "triggerPriceType": "LAST",
          "price": "1.00000",
          "priceType": "LIMIT"
        },
        "stopLoss": {
          "triggerPrice": "1.00000",
          "triggerPriceType": "LAST",
          "price": "1.00000",
          "priceType": "LIMIT"
        },
        "reduceOnly": true,
        "postOnly": false,
        "createdTime": 1715885888571,
        "expireTime": 1715885888571
      }
    ]
  },
  "ts": 1715885884837,
  "seq": 1
}

Trades updates response example:

{
  "type": "TRADE",
  "data": {
    "trades": [
      {
        "id": 1784963886257016832,
        "accountId": 3017,
        "market": "BTC-USD",
        "orderId": 9223372036854775808,
        "side": "BUY",
        "price": "58853.4000000000000000",
        "qty": "0.0900000000000000",
        "value": "5296.8060000000000000",
        "fee": "0.0000000000000000",
        "tradeType": "DELEVERAGE",
        "createdTime": 1701563440000,
        "isTaker": true
      }
    ]
  },
  "ts": 1715885884837,
  "seq": 1
}

Account balance updates response example:

{
  "type": "BALANCE",
  "data": {
    "balance": {
      "collateralName": "BTC",
      "balance": "100.000000",
      "equity": "20.000000",
      "availableForTrade": "3.000000",
      "availableForWithdrawal": "4.000000",
      "unrealisedPnl": "1.000000",
      "initialMargin": "0.140000",
      "marginRatio": "1.500000",
      "updatedTime": 1699976104901
    }
  },
  "ts": 1715885952304,
  "seq": 1
}

Positions updates response example:

{
  "type": "POSITION",
  "data": {
    "positions": [
      {
        "id": 1791183357858545669,
        "accountId": 1791183357858545665,
        "market": "BTC-USD",
        "side": "SHORT",
        "leverage": "5.0",
        "size": "0.3",
        "value": "12751.8596295830",
        "openPrice": "42508.00",
        "markPrice": "42506.1987652769",
        "liquidationPrice": "75816.37",
        "margin": "637.59",
        "unrealisedPnl": "100.000000",
        "realisedPnl": "200.000000",
        "tpTriggerPrice": "1600.0000",
        "tpLimitPrice": "1500.0000",
        "slTriggerPrice": "1300.0000",
        "slLimitPrice": "1250.0000",
        "adl": 1,
        "createdAt": 1715886365748,
        "updatedAt": 1715886365748
      }
    ]
  },
  "ts": 1715886365748,
  "seq": 1
}

Subscribe to the account updates stream.

The initial responses will include comprehensive information about the account, including balance, open positions, and open orders, i.e. everything from GET /v1/user/balance, GET /v1/user/positions, GET /v1/user/orders.

Subsequent responses will contain all updates related to open orders, trades, account balance or open positions in a single message.

The response attributes will align with the responses from the corresponding REST API endpoints: Get trades, Get positions, Get open orders and Get balance. Refer to the Account section for details.

Error responses

Unless specified otherwise for a particular endpoint and HTTP status code, the error response model follows the general response format and includes an error code along with a descriptive message for most errors.

Error code Error Description
GENERAL
400 BadRequest Invalid or missing parameters.
401 Unauthorized Authentication failure.
403 Forbidden Access denied.
404 NotFound Resource not found.
422 UnprocessableEntity Request format is correct, but data is invalid.
500 InternalServerError Internal server error.
MARKET, ASSET & ACCOUNT
1000 AssetNotFound Asset not found.
1001 MarketNotFound Market not found.
1002 MarketDisabled Market is disabled.
1003 MarketGroupNotFound Market group not found.
1004 AccountNotFound Account not found.
1005 NotSupportedInterval Not supported interval.
ORDER
1120 OrderQtyLessThanMinTradeSize Order quantity less than min trade size, based on market-specific trading rules.
1121 InvalidQtyWrongSizeIncrement Invalid quantity due to the wrong size increment, based on market-specific Minimum Change in Trade Size trading rule.
1122 OrderValueExceedsMaxOrderValue Order value exceeds max order value, based on market-specific trading rules.
1123 InvalidQtyPrecision Invalid quantity precision, currently equals to market-specific Minimum Change in Trade Size.
1124 InvalidPriceWrongPriceMovement Invalid price due to wrong price movement, based on market-specific Minimum Price Change trading rule.
1125 InvalidPricePrecision Invalid price precision, currently equals to market-specific Minimum Price Change.
1126 MaxOpenOrdersNumberExceeded Max open orders number exceeded, currently 200 orders per market.
1127 MaxPositionValueExceeded Max position value exceeded, based on the Margin schedule.
1128 InvalidTradingFees Trading fees are invalid. Refer to Order management section for details.
1129 InvalidPositionTpslQty Invalid quantity for position TPSL.
1130 MissingOrderPrice Order price is missing.
1131 MissingTpslTrigger TPSL order trigger is missing.
1132 NotAllowedOrderType Order type is not allowed.
1133 InvalidOrderParameters Invalid order parameters.
1134 DuplicateOrder Duplicate Order.
1135 InvalidOrderExpiration Order expiration date must be within 28 days for the Testnet.
1136 ReduceOnlyOrderSize ExceedsPositionSize Reduce-only order size exceeds open position size.
1137 ReduceOnlyOrder PositionIsMissing Position is missing for a reduce-only order.
1138 ReduceOnlyOrder PositionSameSide Position is the same side as a reduce-only order.
1139 MarketOrderMustBeIOC Market order must have time in force IOC.
1140 OrderCostExceedsBalance New order cost exceeds available balance.
1141 InvalidPriceAmount Invalid price value.
1142 EditOrderNotFound Edit order not found.
1143 MissingConditionalTrigger Conditional order trigger is missing.
1144 PostOnlyCantBeOn ConditionalMarketOrder Conditional market order can't be Post-only.