### GET /quote/v1/index Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Fetches the index price for one or more trading symbols. ```APIDOC ## GET /quote/v1/index ### Description Get the index price for a symbol or symbols. ### Method GET ### Endpoint `/quote/v1/index` ### Parameters #### Query Parameters - **symbol** (STRING) - Optional - The trading symbol (e.g., BTCUSDT). If omitted, index prices for all symbols will be returned. ### Weight 1 ### Response #### Success Response (200) - **index** (OBJECT) - An object containing index prices for symbols. - **[symbol]** (STRING) - The index price for the specified symbol. - **edp** (OBJECT) - An object containing the average of indices over 10 minutes. - **[symbol]** (STRING) - The 10-minute average index price for the specified symbol. ### Response Example ```json { "index":{ "BTCUSDT":"42999.21" }, "edp":{ "BTCUSDT":"43031.36006" } } ``` ``` -------------------------------- ### GET /api/v1/exchangeInfo Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Fetches current exchange trading rules and symbol information. ```APIDOC ## GET /api/v1/exchangeInfo ### Description Fetches current exchange trading rules and symbol information. ### Method GET ### Endpoint `/api/v1/exchangeInfo` ### Parameters #### Path Parameters NONE #### Query Parameters NONE ### Request Example ```bash curl https://api.toobit.com/api/v1/exchangeInfo ``` ### Response #### Success Response (200) - **timezone** (string) - The exchange's timezone. - **serverTime** (integer) - The current server time in milliseconds. - **rateLimits** (array) - List of rate limit rules. - **exchangeFilters** (array) - List of exchange-wide filters. - **symbols** (array) - List of trading symbols and their details. #### Response Example ```json { "timezone": "UTC", "serverTime": 1538323200000, "rateLimits": [ { "rateLimitType": "REQUESTS", "interval": "MINUTE", "limit": 1200 } ], "exchangeFilters": [], "symbols": [ { "symbol": "BTCUSDT", "status": "TRADING", "baseAsset": "BTC", "quoteAsset": "USDT", "orderTypes": ["LIMIT", "MARKET"], "icebergAllowed": true, "ocoAllowed": true, "isSpotTradingAllowed": true, "isMarginTradingAllowed": true } ] } ``` ``` -------------------------------- ### GET /quote/v1/markPrice Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Fetches the current mark price for a given trading pair. ```APIDOC ## GET /quote/v1/markPrice ### Description Get the mark price of a trading pair. ### Method GET ### Endpoint `/quote/v1/markPrice` ### Parameters #### Query Parameters - **symbol** (STRING) - Required - The trading symbol (e.g., BTCUSDT). ### Response #### Success Response (200) - **exchangeId** (INTEGER) - The exchange ID. - **symbolId** (STRING) - The trading symbol. - **price** (STRING) - The mark price. - **time** (LONG) - The timestamp of the mark price. ### Response Example ```json { "exchangeId": 301, "symbolId": "BTC-SWAP-USDT", "price": "17042.54471", "time": 1670897454000 } ``` ``` -------------------------------- ### GET /api/v1/ping Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Tests connectivity to the Toobit REST API. ```APIDOC ## GET /api/v1/ping ### Description Tests connectivity to the Toobit REST API. ### Method GET ### Endpoint `/api/v1/ping` ### Parameters #### Path Parameters NONE #### Query Parameters NONE ### Request Example ```bash curl https://api.toobit.com/api/v1/ping ``` ### Response #### Success Response (200) An empty JSON object `{}` is returned upon successful connection. #### Response Example ```json {} ``` ``` -------------------------------- ### GET /api/v1/time Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves the current server time from the Toobit API. ```APIDOC ## GET /api/v1/time ### Description Retrieves the current server time from the Toobit API. ### Method GET ### Endpoint `/api/v1/time` ### Parameters #### Path Parameters NONE #### Query Parameters NONE ### Request Example ```bash curl https://api.toobit.com/api/v1/time ``` ### Response #### Success Response (200) - **serverTime** (integer) - The current server time in milliseconds since the Unix epoch. #### Response Example ```json { "serverTime": 1538323200000 } ``` ``` -------------------------------- ### Exchange Information - ExchangeInfo (GET) Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This GET request retrieves current exchange trading rules and symbol information. It is essential for understanding available trading pairs, price rules, and other critical exchange parameters. The request has a weight of 1. ```HTTP GET /api/v1/exchangeInfo ``` -------------------------------- ### GET /api/v1/symbols Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves a list of all available trading symbols on the USDT Perpetual Swap platform, along with their trading rules and filters. ```APIDOC ## GET /api/v1/symbols ### Description Retrieves a list of all available trading symbols and their associated trading rules and filters for the USDT Perpetual Swap market. ### Method GET ### Endpoint /api/v1/symbols ### Parameters #### Query Parameters NONE ### Request Example ### Response #### Success Response (200) - **timezone** (string) - The timezone of the exchange. - **brokerFilters** (array) - A list of filters applicable to brokers. - **symbols** (array) - An array of symbol objects, each containing detailed trading information: - **filters** (array) - An array of filter objects defining trading rules for the symbol: - **minPrice** (string) - Minimum allowed price for the symbol. - **maxPrice** (string) - Maximum allowed price for the symbol. - **tickSize** (string) - The smallest price increment for the symbol. - **filterType** (string) - The type of price filter (e.g., "PRICE_FILTER"). - **minQty** (string) - Minimum allowed quantity for a trade. - **maxQty** (string) - Maximum allowed quantity for a trade. - **stepSize** (string) - The smallest quantity increment for the symbol. - **filterType** (string) - The type of lot size filter (e.g., "LOT_SIZE"). - **minNotional** (string) - Minimum notional value for a trade. - **filterType** (string) - The type of notional filter (e.g., "MIN_NOTIONAL"). - **minAmount** (string) - Minimum transaction amount. - **maxAmount** (string) - Maximum trade amount. - **minBuyPrice** (string) - Minimum buy price. - **filterType** (string) - The type of trade amount filter (e.g., "TRADE_AMOUNT"). - **maxSellPrice** (string) - Maximum sell price. - **buyPriceUpRate** (string) - Maximum buy price increase rate relative to the marked/latest price. - **sellPriceDownRate** (string) - Maximum sell price decrease rate relative to the marked/latest price. - **maxEntrustNum** (string) - Maximum number of orders (contracts). - **maxConditionNum** (string) - Maximum number of condition orders (contracts). - **filterType** (string) - The type of limit trading filter (e.g., "LIMIT_TRADING"). - **noAllowMarketStartTime** (string) - Market order start time is not allowed. - **noAllowMarketEndTime** (string) - Market order end time is not allowed. - **limitOrderStartTime** (string) - The start time of a limit order. - **limitOrderEndTime** (string) - The end time of a limit order. - **limitMinPrice** (string) - The minimum price of a limit order. - **limitMaxPrice** (string) - The maximum price of a limit order. - **filterType** (string) - The type of open quote filter (e.g., "OPEN_QUOTE"). - **exchangeId** (string) - The ID of the exchange. - **symbol** (string) - The trading symbol (e.g., "ETHUSDT"). - **symbolName** (string) - The name of the trading symbol. - **status** (string) - The trading status of the symbol (e.g., "TRADING"). - **baseAsset** (string) - The base asset of the trading pair (e.g., "ETH"). - **baseAssetName** (string) - The name of the base asset. - **baseAssetPrecision** (string) - The precision for the base asset. - **quoteAsset** (string) - The quote asset of the trading pair (e.g., "USDT"). - **quoteAssetName** (string) - The name of the quote asset. - **quotePrecision** (string) - The precision for the quote asset. - **icebergAllowed** (boolean) - Whether iceberg orders are allowed. - **isAggregate** (boolean) - Whether the symbol is aggregated. - **allowMargin** (boolean) - Whether margin trading is allowed. #### Response Example ```json { "timezone": "UTC", "brokerFilters": [], "symbols": [ { "filters":[ { "minPrice":"0.01", "maxPrice":"100000.00000000", "tickSize":"0.01", "filterType":"PRICE_FILTER" }, { "minQty":"0.0001", "maxQty":"4000", "stepSize":"0.0001", "filterType":"LOT_SIZE" }, { "minNotional":"10", "filterType":"MIN_NOTIONAL" }, { "minAmount": "10", "maxAmount": "6600000", "minBuyPrice": "0.01", "filterType": "TRADE_AMOUNT" }, { "maxSellPrice": "999999999", "buyPriceUpRate": "0.1", "sellPriceDownRate": "0.1", "maxEntrustNum": "100000", "maxConditionNum": "100000", "filterType": "LIMIT_TRADING" }, { "buyPriceUpRate": "0.1", "sellPriceDownRate": "0.1", "filterType": "MARKET_TRADING" }, { "noAllowMarketStartTime": "0", "noAllowMarketEndTime": "0", "limitOrderStartTime": "0", "limitOrderEndTime": "0", "limitMinPrice": "0", "limitMaxPrice": "0", "filterType": "OPEN_QUOTE" } ], "exchangeId": "301", "symbol": "ETHUSDT", "symbolName": "ETHUSDT", "status": "TRADING", "baseAsset": "ETH", "baseAssetName": "ETH", "baseAssetPrecision": "0.0001", "quoteAsset": "USDT", "quoteAssetName": "USDT", "quotePrecision": "0.01", "icebergAllowed": false, "isAggregate": false, "allowMargin": true }, { "filters":[ { "minPrice":"0.01", "maxPrice":"100000.00000000", "tickSize":"0.01", "filterType":"PRICE_FILTER" }, { "minQty":"0.0001", "maxQty":"4000", "stepSize":"0.0001", "filterType":"LOT_SIZE" }, { "minNotional":"10", "filterType":"MIN_NOTIONAL" }, { "minAmount": "10", "maxAmount": "6600000", "minBuyPrice": "0.01", "filterType": "TRADE_AMOUNT" }, { "maxSellPrice": "999999999", "buyPriceUpRate": "0.1", "sellPriceDownRate": "0.1", "maxEntrustNum": "100000", "maxConditionNum": "100000", "filterType": "LIMIT_TRADING" }, { "buyPriceUpRate": "0.1", "sellPriceDownRate": "0.1", "filterType": "MARKET_TRADING" }, { "noAllowMarketStartTime": "0", "noAllowMarketEndTime": "0", "limitOrderStartTime": "0", "limitOrderEndTime": "0", "limitMinPrice": "0", "limitMaxPrice": "0", "filterType": "OPEN_QUOTE" } ], "exchangeId": "301", "symbol": "BTCUSDT", "symbolName": "BTCUSDT", "status": "TRADING", "baseAsset": "BTC", "baseAssetName": "BTC", "baseAssetPrecision": "0.000001", "quoteAsset": "USDT", "quoteAssetName": "USDT", "quotePrecision": "0.01", "icebergAllowed": false } ] } ``` ``` -------------------------------- ### Check Server Time - Time (GET) Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This GET request retrieves the current server time from the Toobit API. It's useful for synchronizing client-side time with the server and requires no parameters. The response includes the server time in milliseconds since the Unix epoch. ```HTTP GET /api/v1/time ``` -------------------------------- ### GET /api/v1/futures/historyFundingRate Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Fetches historical funding rates for a given symbol. Allows filtering by symbol and ID range. ```APIDOC ## GET /api/v1/futures/historyFundingRate ### Description Retrieves historical funding rates for a given symbol. ### Method GET ### Endpoint `/api/v1/futures/historyFundingRate` ### Parameters #### Query Parameters - **symbol** (STRING) - Required - The trading symbol (e.g., BTC-PERP-REV). - **fromId** (LONG) - Optional - Filter by funding rate history starting from this ID. - **endId** (LONG) - Optional - Filter by funding rate history up to this ID. - **limit** (INT) - Optional - The maximum number of records to return. Defaults to 20, min 1, max 1000. ### Response #### Success Response (200) - (ARRAY) - An array of historical funding rate objects. - **id** (STRING) - The unique identifier for the funding rate record. - **symbol** (STRING) - The trading symbol. - **fundingTime** (STRING) - The timestamp of the funding settlement. - **fundingRate** (STRING) - The funding rate. ### Response Example ```json [ { "id": "3434343434343", "symbol": "BTC-PERP-REV", "fundingTime": "1570708800000", "fundingRate": "0.00321" } ] ``` ``` -------------------------------- ### GET /api/v1/ticker/all Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves detailed information for all available USDT perpetual swap trading pairs. This includes price filters, lot size filters, minimum notional values, and trading amount restrictions. ```APIDOC ## GET /api/v1/ticker/all ### Description Retrieves detailed information for all available USDT perpetual swap trading pairs, including various trading filters and limits. ### Method GET ### Endpoint /api/v1/ticker/all ### Query Parameters None ### Request Body None ### Request Example ``` GET /api/v1/ticker/all ``` ### Response #### Success Response (200) - **data** (array) - An array of objects, where each object contains detailed information about a trading symbol. - **exchangeId** (string) - The ID of the exchange. - **symbol** (string) - The trading symbol (e.g., XRPUSDT). - **symbolName** (string) - The full name of the symbol. - **status** (string) - The trading status of the symbol (e.g., TRADING). - **baseAsset** (string) - The base asset of the trading pair. - **baseAssetName** (string) - The name of the base asset. - **baseAssetPrecision** (string) - The precision for the base asset. - **quoteAsset** (string) - The quote asset of the trading pair. - **quoteAssetName** (string) - The name of the quote asset. - **quotePrecision** (string) - The precision for the quote asset. - **icebergAllowed** (boolean) - Whether iceberg orders are allowed. - **isAggregate** (boolean) - Whether the symbol is aggregated. - **allowMargin** (boolean) - Whether margin trading is allowed. - **filters** (array) - An array of trading filters applied to the symbol. - **filterType** (string) - The type of filter (e.g., PRICE_FILTER, LOT_SIZE, MIN_NOTIONAL, TRADE_AMOUNT, LIMIT_TRADING, MARKET_TRADING, OPEN_QUOTE). - *Specific filter parameters vary based on `filterType` (e.g., minPrice, maxPrice, tickSize for PRICE_FILTER; minQty, maxQty, stepSize for LOT_SIZE; minNotional for MIN_NOTIONAL; minAmount, maxAmount, minBuyPrice for TRADE_AMOUNT; maxSellPrice, buyPriceUpRate, sellPriceDownRate, maxEntrustNum, maxConditionNum for LIMIT_TRADING; buyPriceUpRate, sellPriceDownRate for MARKET_TRADING; noAllowMarketStartTime, noAllowMarketEndTime, limitOrderStartTime, limitOrderEndTime, limitMinPrice, limitMaxPrice for OPEN_QUOTE).* #### Response Example ```json { "data": [ { "exchangeId": "301", "symbol": "XRPUSDT", "symbolName": "XRPUSDT", "status": "TRADING", "baseAsset": "XRP", "baseAssetName": "XRP", "baseAssetPrecision": "0.01", "quoteAsset": "USDT", "quoteAssetName": "USDT", "quotePrecision": "0.01", "icebergAllowed": false, "isAggregate": false, "allowMargin": false, "filters": [ { "minPrice": "0.01", "maxPrice": "100000.00000000", "tickSize": "0.01", "filterType": "PRICE_FILTER" }, { "minQty": "0.0001", "maxQty": "4000", "stepSize": "0.0001", "filterType": "LOT_SIZE" }, { "minNotional": "10", "filterType": "MIN_NOTIONAL" }, { "minAmount": "10", "maxAmount": "6600000", "minBuyPrice": "0.01", "filterType": "TRADE_AMOUNT" }, { "maxSellPrice": "999999999", "buyPriceUpRate": "0.1", "sellPriceDownRate": "0.1", "maxEntrustNum": "100000", "maxConditionNum": "100000", "filterType": "LIMIT_TRADING" }, { "buyPriceUpRate": "0.1", "sellPriceDownRate": "0.1", "filterType": "MARKET_TRADING" }, { "noAllowMarketStartTime": "0", "noAllowMarketEndTime": "0", "limitOrderStartTime": "0", "limitOrderEndTime": "0", "limitMinPrice": "0", "limitMaxPrice": "0", "filterType": "OPEN_QUOTE" } ] } ], "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalUnit": 1, "limit": 3000 }, { "rateLimitType": "ORDERS", "interval": "SECOND", "intervalUnit": 60, "limit": 60 } ], "options": [] } ``` ``` -------------------------------- ### GET /quote/v1/ticker/bookTicker Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves the best price and quantity on the order book for a specified symbol or all symbols. ```APIDOC ## GET /quote/v1/ticker/bookTicker ### Description Retrieves the best price and quantity on the order book for a specified symbol or all symbols. ### Method GET ### Endpoint `/quote/v1/ticker/bookTicker` ### Parameters #### Query Parameters - **symbol** (STRING) - Optional - The symbol for which to retrieve the order book ticker. If not provided, tickers for all symbols will be returned. ### Request Example ``` GET /quote/v1/ticker/bookTicker?symbol=BTCUSDT ``` ### Response #### Success Response (200) - **t** (LONG) - Timestamp - **s** (STRING) - Symbol - **b** (STRING) - Bid Price - **bq** (STRING) - Bid Quantity - **a** (STRING) - Ask Price - **aq** (STRING) - Ask Quantity #### Response Example ```json [ { "t": 1535975085052, "s": "LTCBTC", "b": "4.00000000", "bq": "431.00000000", "a": "4.00000200", "aq": "9.00000000" } ] ``` ``` -------------------------------- ### Get Leverage and Position Mode Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves the leverage multiples and position modes for all contract trading pairs for a user. This API requires signed requests. ```APIDOC ## GET /api/v1/futures/accountLeverage ### Description Obtain the leverage multiples and position types of all contract trading pairs of the user. This API requires your request to be signed. ### Method GET ### Endpoint /api/v1/futures/accountLeverage ### Parameters #### Query Parameters - **symbol** (STRING) - Required - symbol - **category** (ENUM) - Optional - USDC-M Futures=`USDC`, Default=USDT-M Futures. - **recvWindow** (LONG) - Optional - recv window - **timestamp** (LONG) - Required - timestamp ### Response #### Success Response (200) - **symbol** (STRING) - symbol - **leverage** (STRING) - leverage - **marginType** (STRING) - CROSS or ISOLATED #### Response Example ```json [ { "symbol":"BTC-SWAP-USDT", "leverage":"20", "marginType":"CROSS" } ] ``` ``` -------------------------------- ### User Data Stream Payload Examples Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Demonstrates the structure of payloads for account balance updates and position updates received via user data streams. These events are pushed only when there are changes. ```json [ { "e": "outboundContractAccountInfo", "E": 1564745798939, "T": true, "W": true, "D": true, "B": [ { "a": "LTC", "f": "17366.18538083", "l": "0.00000000" } ] } ] ``` ```json [ { "e": "outboundContractPositionInfo", "E": "1668693440976", "A": "1270447370291795457", "s": "BTCUSDT", "S": "LONG", "p": "441.0", "P": "1291488620385157122", "a": "1000", "f": "1291488620167835136", "m": "18.2", "r": "44", "mt": "CROSS", "rr": "89", "up": "12", "pr": "0.003", "pv": "123", "v": "10" } ] ``` -------------------------------- ### Start User Data Stream - REST API Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Initiates a new user data stream. The stream remains active for 60 minutes unless a keepalive signal is sent. This endpoint requires no parameters. ```http POST /api/v1/listenKey ``` -------------------------------- ### GET /api/v1/exchangeInfo - Exchange Information Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves general exchange information, including trading rules and symbol details. This endpoint does not require authentication. ```APIDOC ## GET /api/v1/exchangeInfo ### Description Retrieves general information about the exchange, including supported trading symbols, filters, and rate limits. ### Method GET ### Endpoint https://api.toobit.com/api/v1/exchangeInfo ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl https://api.toobit.com/api/v1/exchangeInfo ``` ### Response #### Success Response (200) - **timezone** (string) - The exchange's timezone. - **serverTime** (integer) - The current server time in milliseconds. - **rateLimits** (array) - An array of rate limit objects. - **rateLimitType** (string) - Type of rate limit (e.g., 'RAW_REQUEST', 'REQUEST_WEIGHT', 'ORDER'). - **interval** (string) - The time interval for the rate limit (e.g., 'MINUTE', 'HOUR'). - **limit** (integer) - The maximum number of requests allowed within the interval. - **symbols** (array) - An array of symbol information objects. - **symbol** (string) - The trading pair symbol. - **status** (string) - The status of the symbol (e.g., 'TRADING', 'BREAK'). - **filters** (array) - An array of filter objects applied to the symbol. #### Response Example ```json { "timezone": "UTC", "serverTime": 1678886400000, "rateLimits": [ { "rateLimitType": "RAW_REQUESTS", "interval": "MINUTE", "limit": 1200 } ], "symbols": [ { "symbol": "BTCUSDT", "status": "TRADING", "filters": [ { "filterType": "PRICE_FILTER", "minPrice": "0.01", "maxPrice": "1000000.00", "tickSize": "0.01" } ] } ] } ``` ``` -------------------------------- ### GET /api/v1/futures/fundingRate Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves the current funding rate for a specified symbol. If no symbol is provided, it may return rates for all symbols (behavior may vary). ```APIDOC ## GET /api/v1/futures/fundingRate ### Description Retrieves the current funding rate for a specified symbol. ### Method GET ### Endpoint `/api/v1/futures/fundingRate` ### Parameters #### Query Parameters - **symbol** (STRING) - Optional - The trading symbol (e.g., BTC-SWAP-USDT). ### Response #### Success Response (200) - (ARRAY) - An array of funding rate objects. - **symbol** (STRING) - The trading symbol. - **lastFundingTime** (STRING) - Timestamp of the last funding settlement. - **nextFundingTime** (STRING) - Timestamp of the next funding settlement. - **rate** (STRING) - The settlement funding rate. ### Response Example ```json [ { "symbol": "BTC-SWAP-USDT", "lastFundingTime": "1668398400000", "nextFundingTime": "1668427200000", "rate": "0.0018099173553719" } ] ``` ``` -------------------------------- ### Get Mark Price Kline/Candlestick Data Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Fetches historical kline (candlestick) data for the mark price of a given symbol and interval. Requires symbol, interval, start time, and end time. An optional limit parameter can be used to restrict the number of results. ```json { "code": 200, "data": [ { "symbol": "BTCUSDT",// Symbol "time": 1670157900000,// time "low": "16991.14096",//Low price "open": "16991.78288",//Open price "high": "16996.30641",// High prce "close": "16996.30641",// Close price "volume": "0",// Volume "curId": 1670157900000 } ] } ``` -------------------------------- ### Place Spot Order with HMAC SHA256 (curl) Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Example of using curl to place a spot order on Toobit, including the necessary API key and HMAC SHA256 signature in the request headers and data payload. This command demonstrates how to structure the request for the `/api/v1/spot/order` endpoint. ```Shell $ curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" -X POST 'https://api.toobit.com/api/v1/spot/order' -d 'symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000×tamp=1668481902307&signature=8420e499e71cce4a00946db16543198b6bcae01791bdb75a06b5a7098b156468' ``` ```Shell $ curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" -X POST 'https://api.toobit.com/api/v1/spot/order?symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=400&recvWindow=10000000×tamp=1668481902307&signature=59ef0b2085ebb99cca5b6445c202d99add17be2d5d1861c0f4aa17bc785ac4d5' ``` -------------------------------- ### Get Index Price Kline/Candlestick Data Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves historical kline (candlestick) data for the index price of a specified symbol and interval. Requires symbol, interval, start time, and end time. Optionally accepts a limit for the number of data points returned. ```json { "code": 200, "data": [ { "t": 1669155300000,//time "s": "ETHUSDT",// symbol "sn": "ETHUSDT",//symbol name "c": "1127.1",//Close price "h": "1130.81",//High price "l": "1126.17",//Low price "o": "1130.8",//Open price "v": "0"//Volume }, { "t": 1669156200000, "s": "ETHUSDT", "sn": "ETHUSDT", "c": "1129.44", "h": "1129.54", "l": "1127.1", "o": "1127.1", "v": "0" } ] } ``` -------------------------------- ### USDT Swap V1 Account Balance Example Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This snippet demonstrates the structure of the response when querying account balance information. It includes details such as asset, total balance, available balance, position margin, order margin, and cross unrealized profit and loss. ```json [ { "asset": "USDT", "balance": "999999999999.982", "availableBalance": "1899999999978.4995", "positionMargin": "11.9825", "orderMargin": "9.5", "crossUnRealizedPnl": "10.01" } ] ``` -------------------------------- ### Get Funding Rate History Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Retrieves historical funding rates for a specified symbol. The symbol parameter is mandatory. This endpoint also supports filtering by start and end IDs, and a limit for the number of records. Returns an array of funding rate records, each including ID, symbol, funding time, and rate. ```json [ { "id": "3434343434343", "symbol": "BTC-PERP-REV", // Symbol "fundingTime": "1570708800000", "fundingRate": "0.00321" } ] ``` -------------------------------- ### USDT Swap V1 User Trade Fee Rate Example Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This snippet demonstrates the response format for retrieving user trade fee rates. It includes the open maker fee, open taker fee, close maker fee, and close taker fee. ```json { "openMakerFee": "0.000006", "openTakerFee": "0.0001", "closeMakerFee": "0.0002", "closeTakerFee": "0.0004" } ``` -------------------------------- ### USDT Swap V1 Today PnL Example Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This snippet shows the response structure for today's Profit and Loss (PnL) data. It includes the day's profit and the day's profit rate, both calculated based on the UTC+0 time zone. ```json { "dayProfit": "100", "dayProfitRate": "0.01" } ``` -------------------------------- ### Test Connectivity - Ping (GET) Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This GET request is used to test the connectivity to the Toobit Rest API. It requires no parameters and returns an empty JSON object upon successful connection, indicating the API is responsive. ```HTTP GET /api/v1/ping ``` -------------------------------- ### USDT Swap V1 Account Trade List Example Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This snippet illustrates the response format for retrieving a list of trades for a specific account and symbol. It includes details such as trade time, ID, order ID, symbol, price, quantity, commission, and trade side. ```json [ { "time": "1668425281370", "id": "1289239136943831296", "orderId": "1289239134670518528", "symbol": "BTC-SWAP-USDT", "price": "24000", "qty": "9", "commissionAsset": "USDT", "commission": "0.0162", "makerRebate": "0", "type": "LIMIT", "isMaker": false, "side": "BUY_OPEN", "realizedPnl": "0", "ticketId": "1185465136943458745" } ] ``` -------------------------------- ### Submit Signed Futures Order using cURL Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This example shows how to send a POST request to the /api/v1/futures/order endpoint using cURL, including the necessary API key in the header and the signed payload with the generated signature in the request body. ```bash curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" -X POST 'https://api.toobit.com/api/v1/futures/order' -d 'symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000×tamp=1668481902307&signature=8420e499e71cce4a00946db16543198b6bcae01791bdb75a06b5a7098b156468' ``` -------------------------------- ### Query History Orders - Example Response Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This snippet displays a sample JSON response for querying historical orders. It includes details such as order time, order ID, symbol, price, quantity, status, and type. This endpoint is useful for reviewing past trading activity. ```json [ { "time": "1570760254539", "updateTime": "1570760254539", "orderId": "469965509788581888", "clientOrderId": "1570760253946", "symbol": "BTC-PERP-REV", "price": "8502.34", "leverage": "20", "origQty": "222", "executedQty": "0", "avgPrice": "0", "marginLocked": "0.00130552", "type": "LIMIT", "side": "BUY_OPEN", "timeInForce": "GTC", "status": "CANCELED", "priceType": "INPUT" } ] ``` -------------------------------- ### Query Position (USER_DATA) - Example Response Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This snippet shows the JSON structure for the response when querying current position information. It includes details such as symbol, side, average price, position quantity, leverage, and unrealized profit/loss. Note that this API requires a request signature. ```json [ { "symbol": "BTC-SWAP-USDT", "side": "LONG", "avgPrice": "24000", "position": "10", "available": "10", "leverage": "2", "lastPrice": "16854.4", "positionValue": "24", "flp": "12077.8", "margin": "11.9825", "marginRate": "0.4992", "unrealizedPnL": "0", "profitRate": "0", "realizedPnL": "-0.018", "maxNotionalValue": "60000", "marginType": "ISOLATED", "markPrice": "16854.2" } ] ``` -------------------------------- ### POST /api/v1/futures/order - Order Placement Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Places a futures order. This endpoint requires API key authentication and a signature. ```APIDOC ## POST /api/v1/futures/order ### Description Places a futures order. Requires API key and signature. ### Method POST ### Endpoint https://api.toobit.com/api/v1/futures/order ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading pair symbol. - **side** (string) - Required - 'BUY' or 'SELL'. - **type** (string) - Required - Order type (e.g., 'LIMIT', 'MARKET'). - **timeInForce** (string) - Optional - Time in force (e.g., 'GTC', 'IOC'). - **quantity** (number) - Required - The quantity to trade. - **price** (number) - Required for LIMIT orders - The price of the order. - **recvWindow** (number) - Optional - The window size in milliseconds for the timestamp. - **timestamp** (integer) - Required - The millisecond timestamp of the request. - **signature** (string) - Required - The HMAC SHA256 signature of the parameters. #### Request Body This endpoint typically uses query parameters for all its input. ### Request Example ```bash # Example using query string parameters curl -H "X-BB-APIKEY: YOUR_API_KEY" -X POST 'https://api.toobit.com/api/v1/futures/order?symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000×tamp=1668481902307&signature=8420e499e71cce4a00946db16543198b6bcae01791bdb75a06b5a7098b156468' ``` ### Response #### Success Response (200) - **orderId** (string) - The ID of the placed order. - **status** (string) - The status of the order. #### Response Example ```json { "orderId": "123456789", "status": "NEW" } ``` ### Error Handling - **400 Bad Request**: Invalid parameters or missing required fields. - **401 Unauthorized**: Invalid API key or signature. - **429 Too Many Requests**: Rate limit exceeded. ``` -------------------------------- ### POST /api/v1/spot/order Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index Places a spot order on Toobit. Supports various order types and includes HMAC SHA256 signature for authentication. ```APIDOC ## POST /api/v1/spot/order ### Description Places a spot order on Toobit. Supports various order types and includes HMAC SHA256 signature for authentication. ### Method POST ### Endpoint `https://api.toobit.com/api/v1/spot/order` ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading pair symbol (e.g., BTCUSDT). - **side** (string) - Required - The side of the order (BUY_OPEN, BUY_CLOSE, SELL_OPEN, SELL_CLOSE). - **type** (string) - Required - The type of order (MARKET, LIMIT, LIMIT_MAKER, etc.). - **timeInForce** (string) - Optional - Duration the order is active (GTC, IOC, FOK). - **quantity** (number) - Required - The quantity of the asset to trade. - **price** (number) - Required for LIMIT orders - The price at which to place the order. - **recvWindow** (integer) - Optional - The window for the server to process the request. - **timestamp** (integer) - Required - The current timestamp in milliseconds. - **signature** (string) - Required - The HMAC SHA256 signature of the parameters. ### Request Example ```bash curl -H "X-BB-APIKEY: YOUR_API_KEY" -X POST 'https://api.toobit.com/api/v1/spot/order' -d 'symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000×tamp=1668481902307&signature=YOUR_SIGNATURE' ``` ### Request Body (Example for HMAC SHA256) ``` symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000×tamp=1668481902307 ``` ### Response #### Success Response (200) - **orderId** (string) - The ID of the placed order. - **status** (string) - The status of the order (e.g., NEW, FILLED). #### Response Example ```json { "orderId": "1234567890", "status": "NEW" } ``` ``` -------------------------------- ### Place USDT-M Futures Batch Orders using Curl Source: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/index This snippet demonstrates how to place multiple limit orders for USDT-M futures using a cURL command. It requires authentication headers and a JSON payload specifying order details like symbol, side, type, price, and quantity. The response includes success or failure codes for each order. ```shell curl -H "Content-Type:application/json" -H "X-BB-APIKEY: 3jIF0QWOFAA64MnaFJz1pMvVFNaLyMThHUvhii1eyYBw4saPs9ocLasp45pqeGRs" -X POST -d '[ { "newClientOrderId": "pl2023010712345678900", "symbol": "BTC-SWAP-USDT", "side": "BUY_OPEN", "type": "LIMIT", "price": 16500, "quantity": 10, "priceType": "INPUT" }, { "newClientOrderId": "pl2023010712345678901", "symbol": "BTC-SWAP-USDT", "side": "BUY_OPEN", "type": "LIMIT", "price": 16000, "quantity": 10, "priceType": "INPUT" } ]' '#HOST/api/v1/futures/batchOrders?timestamp=1673062952473&signature=f746cebecf9cf53601d2ab69b2f88f426a1c93a5f7bcc8bbdc5a2ce95c3fa976' ```