### Java Example for Generating GET Request Parameter String Source: https://ourbitdevelop.github.io/apidocs This utility method formats a map of parameters into a URL-encoded string, sorted by key, suitable for GET or DELETE requests. It handles empty maps and ensures proper encoding. ```java /** * 获取get请求参数字符串 * * @param param get/delete请求参数map * @return */ public static String getRequestParamString(Map param) { if (MapUtils.isEmpty(param)) { return ""; } StringBuilder sb = new StringBuilder(1024); SortedMap map = new TreeMap<>(param); for (Map.Entry entry : map.entrySet()) { String key = entry.getKey(); String value = StringUtils.isBlank(entry.getValue()) ? "" : entry.getValue(); sb.append(key).append('=').append(urlEncode(value)).append('&'); } sb.deleteCharAt(sb.length() - 1); return sb.toString(); } ``` -------------------------------- ### Signature Method (Java Example) Source: https://ourbitdevelop.github.io/apidocs Example of how to generate a signature for API requests using Java. ```APIDOC /** * Get GET request parameter string * @param param GET/DELETE request parameters map * @return */ public static String getRequestParamString(Map param) { if (MapUtils.isEmpty(param)) { return ""; } StringBuilder sb = new StringBuilder(1024); SortedMap map = new TreeMap<>(param); for (Map.Entry entry : map.entrySet()) { String key = entry.getKey(); String value = StringUtils.isBlank(entry.getValue()) ? "" : entry.getValue(); sb.append(key).append('=').append(urlEncode(value)).append('&'); } sb.deleteCharAt(sb.length() - 1); return sb.toString(); } public static String urlEncode(String s) { try { return URLEncoder.encode(s, "UTF-8").replaceAll("\+", "%20"); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("UTF-8 encoding not supported!"); } } /** * Signature */ public static String sign(SignVo signVo) { if (signVo.getRequestParam() == null) { signVo.setRequestParam(""); } String str = signVo.getAccessKey() + signVo.getReqTime() + signVo.getRequestParam(); return actualSignature(str, signVo.getSecretKey()); } public static String actualSignature(String inputStr, String key) { Mac hmacSha256; try { hmacSha256 = Mac.getInstance("HmacSHA256"); SecretKeySpec secKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); hmacSha256.init(secKey); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("No such algorithm: " + e.getMessage()); } catch (InvalidKeyException e) { throw new RuntimeException("Invalid key: " + e.getMessage()); } byte[] hash = hmacSha256.doFinal(inputStr.getBytes(StandardCharsets.UTF_8)); return Hex.encodeHexString(hash); } @Getter @Setter public static class SignVo { private String reqTime; private String accessKey; private String secretKey; private String requestParam; //get请求参数根据字典顺序排序,使用&拼接字符串,post为json字符串 } ``` -------------------------------- ### Get Trade Details Response Example Source: https://ourbitdevelop.github.io/apidocs This JSON object represents a successful response when retrieving detailed trade information. It includes a list of trades with their respective details such as symbol, quantity, price, and timestamps. ```json { "code": 200, "data": [ { "id": "4ab9700a077d403f8c144c981ff3464b", "symbol": "OB_USDT", "quantity": "5", "price": "1.328", "amount": "6.64", "fee": "0.01328", "trade_type": "ASK", "order_id": "d4991cd4296f4138a5b02b2aea8bde8d", "is_taker": true, "fee_currency": "USDT", "create_time": 1657173950000 } ] } ``` -------------------------------- ### Java Example for Generating Signature Source: https://ourbitdevelop.github.io/apidocs Constructs the signature string by concatenating the API key, request time, and request parameters, then signs it using HMAC SHA256. ```java /** * 签名 */ public static String sign(SignVo signVo) { if (signVo.getRequestParam() == null) { signVo.setRequestParam(""); } String str = signVo.getAccessKey() + signVo.getReqTime() + signVo.getRequestParam(); return actualSignature(str, signVo.getSecretKey()); } ``` -------------------------------- ### K线数据 Source: https://ourbitdevelop.github.io/apidocs Retrieves candlestick (k-line) data for a trading pair with specified interval, start time, and limit. ```APIDOC ## GET /open/api/v2/market/kline ### Description Retrieves candlestick (k-line) data for a trading pair with specified interval, start time, and limit. ### Method GET ### Endpoint /open/api/v2/market/kline ### Parameters #### Query Parameters - **symbol** (string) - Required - Trading pair name - **interval** (string) - Required - Time interval (e.g., 1m, 5m, 15m, 30m, 60m, 4h, 1d, 1M) - **start_time** (long) - Optional - Start time (10-digit timestamp in seconds) - **limit** (integer) - Optional - Number of records to return (1-1000, default 100) ### Response #### Success Response (200) - **time** (long) - Start time (10-digit timestamp in seconds) - **open** (string) - Opening price - **close** (string) - Closing price - **high** (string) - Highest price - **low** (string) - Lowest price - **vol** (string) - Trading volume - **amount** (string) - Trading volume in quote currency ### Response Example ```json { "code": 200, "data": [ [ 1557728040, //timestamp in seconds "7054.7", //open "7056.26", //close "7056.29", //high "7054.16", //low "9.817734", //vol "6926.521" //amount ], [ 1557728100, "7056.26", "7042.17", "7056.98", "7042.16", "23.69423", "1677.931" ] ] } ``` ``` -------------------------------- ### Query Orders Response Example Source: https://ourbitdevelop.github.io/apidocs This JSON object represents a successful response when querying order details. It includes a list of orders with their respective information such as ID, symbol, price, quantity, and state. ```json { "code": 200, "data": [ { "id": "504feca6ba6349e39c82262caf0be3f4", "symbol": "OB_ETH", "price": "0.000901", "quantity": "300000", "state": "NEW", "type": "BID", "deal_quantity": "0", "deal_amount": "0", "create_time": 1573117266000 }, { "id": "72872b6ae721480ca4fe0f265d29dfee", "symbol": "OB_ETH", "price": "0.000907", "quantity": "300000", "state": "NEW", "type": "ASK", "deal_quantity": "0", "deal_amount": "0", "create_time": 1573117267000 } ] } ``` -------------------------------- ### Get Coin Information List Source: https://ourbitdevelop.github.io/apidocs Fetches a list of supported cryptocurrencies with their details, including chain, precision, and withdrawal/deposit status. Requires withdrawal read permission. ```json { "code": 200, "data": [ { "currency": "AGLD", "coins": [ { "chain": "ERC20", "precision": 18, "fee": 15.37, "is_withdraw_enabled": true, "is_deposit_enabled": true, "deposit_min_confirm": 16, "withdraw_limit_max": 500000.0, "withdraw_limit_min": 14.0 } ], "full_name": "Adventure Gold" } ] } ``` -------------------------------- ### Get All Trading Pairs Information Source: https://ourbitdevelop.github.io/apidocs Retrieves detailed information for all available trading pairs, including their state, precision scales, fee rates, and partition. ```json { "code": 200, "data": [ { "symbol": "QTUM_USDT", "state": "ENABLED", "price_scale": 4, "quantity_scale": 2, "min_amount": "5", "max_amount": "5000000", "maker_fee_rate": "0.002", "taker_fee_rate": "0.002", "limited": false, "etf_mark": 0, "symbol_partition": "MAIN" } ] } ``` -------------------------------- ### Java Example for URL Encoding Source: https://ourbitdevelop.github.io/apidocs Encodes a given string using UTF-8 encoding and replaces '+' with '%20'. Throws an IllegalArgumentException if UTF-8 is not supported. ```java public static String urlEncode(String s) { try { return URLEncoder.encode(s, "UTF-8").replaceAll("\+", "%20"); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("UTF-8 encoding not supported!"); } } ``` -------------------------------- ### Request Formats Source: https://ourbitdevelop.github.io/apidocs The API accepts GET, POST, or DELETE requests. Parameters are placed in the path for GET/DELETE requests and in the request body for POST requests. ```APIDOC GET/DELETE: Parameters in path (request param) POST: Parameters in request body (request body) ``` -------------------------------- ### Get Platform Supported API Trading Pairs Source: https://ourbitdevelop.github.io/apidocs Retrieves a list of trading pairs that are supported for API trading on the platform. ```json { "code": 200, "data": [ { "ALEPH_USDT", "XFI_USDT", "ETH3S_USDT", "OGN_USDT", "HC_USDT", "PAX_USDT", "BNU_USDT", } ] } ``` -------------------------------- ### Get Platform Supported API Trading Pairs Source: https://ourbitdevelop.github.io/apidocs Retrieves a list of trading pairs that are supported for API trading on the platform. ```APIDOC ## GET /open/api/v2/market/api_default_symbols ### Description Retrieves a list of trading pairs that are supported for API trading on the platform. ### Method GET ### Endpoint /open/api/v2/market/api_default_symbols ### Parameters #### Path Parameters None #### Query Parameters None ### Response #### Success Response (200) - **code** (integer) - Status code - **message** (string) - Error description (if any) - **symbol** (string) - Trading pair ### Response Example ```json { "code": 200, "data": [ "ALEPH_USDT", "XFI_USDT", "ETH3S_USDT", "OGN_USDT", "HC_USDT", "PAX_USDT", "BNU_USDT" ] } ``` ``` -------------------------------- ### Get Deal Details Source: https://ourbitdevelop.github.io/apidocs Retrieves the details of a specific trade based on the provided order ID. ```APIDOC ## GET /open/api/v2/order/deal_detail ### Description Retrieves the details of a specific trade based on the provided order ID. ### Method GET ### Endpoint /open/api/v2/order/deal_detail ### Parameters #### Query Parameters - **order_id** (string) - Required - The ID of the order. ### Response #### Success Response (200) - **symbol** (string) - Trading pair. - **id** (string) - Deal ID. - **order_id** (string) - Order ID. - **trade_type** (string) - Trade type. - **quantity** (string) - Deal quantity. - **price** (string) - Deal price. - **amount** (string) - Deal amount. - **fee** (string) - Deal fee. - **fee_currency** (string) - Fee currency. - **is_taker** (bool) - Whether the order was a taker order in the deal. - **create_time** (long) - Deal creation time. ### Response Example ```json { "code": 200, "data": [ { "id": "4ab9700a077d403f8c144c981ff3464b", "symbol": "OB_USDT", "quantity": "5", "price": "1.328", "amount": "6.64", "fee": "0.01328", "trade_type": "ASK", "order_id": "d4991cd4296f4138a5b02b2aea8bde8d", "is_taker": true, "fee_currency": "USDT", "create_time": 1657173950000 } ] } ``` ``` -------------------------------- ### Get Current System Time Source: https://ourbitdevelop.github.io/apidocs Fetches the current system timestamp in milliseconds since the Unix epoch. ```json { "code": 200, "data": 1573542414480 } ``` -------------------------------- ### Get Current System Time Source: https://ourbitdevelop.github.io/apidocs Retrieves the current system timestamp in milliseconds since the Unix epoch. ```APIDOC ## GET /open/api/v2/common/timestamp ### Description Retrieves the current system timestamp in milliseconds since the Unix epoch. ### Method GET ### Endpoint /open/api/v2/common/timestamp ### Parameters #### Path Parameters None #### Query Parameters None ### Response #### Success Response (200) - **data** (long) - Current system timestamp in milliseconds since Unix epoch ### Response Example ```json { "code": 200, "data": 1573542414480 } ``` ``` -------------------------------- ### Java Example for HMAC SHA256 Signature Calculation Source: https://ourbitdevelop.github.io/apidocs Performs the actual HMAC SHA256 signing operation on the input string using the provided secret key. It handles potential exceptions during key initialization and algorithm instantiation. ```java public static String actualSignature(String inputStr, String key) { Mac hmacSha256; try { hmacSha256 = Mac.getInstance("HmacSHA256"); SecretKeySpec secKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); hmacSha256.init(secKey); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("No such algorithm: " + e.getMessage()); } catch (InvalidKeyException e) { throw new RuntimeException("Invalid key: " + e.getMessage()); } byte[] hash = hmacSha256.doFinal(inputStr.getBytes(StandardCharsets.UTF_8)); return Hex.encodeHexString(hash); } ``` -------------------------------- ### Get Ticker Market Data Source: https://ourbitdevelop.github.io/apidocs Retrieves the latest ticker information for a specified trading pair. Use this to get current trading volume, price, and change rate. ```json { "code": 200, "data": [ { "symbol": "BTC_USDT", "volume": "47876.096755", "amount": "1161420469.76", "high": "24902.08", "low": "23494.28", "bid": "24684.48", "ask": "24685.6", "open": "24018.6", "last": "24681.71", "time": 1660226100000, "change_rate": "0.02760818" } ] } ``` -------------------------------- ### Get All Trading Pairs Information Source: https://ourbitdevelop.github.io/apidocs Retrieves comprehensive information for all available trading pairs, including their state, precision scales, trading limits, fee rates, and partition. ```APIDOC ## GET /open/api/v2/market/symbols ### Description Retrieves comprehensive information for all available trading pairs, including their state, precision scales, trading limits, fee rates, and partition. ### Method GET ### Endpoint /open/api/v2/market/symbols ### Parameters #### Path Parameters None #### Query Parameters None ### Response #### Success Response (200) - **symbol** (string) - Trading pair name - **state** (string) - Trading pair status, whether it can be traded currently - **price_scale** (integer) - Price precision - **quantity_scale** (integer) - Quantity precision - **min_amount** (string) - Minimum transaction amount - **max_amount** (string) - Maximum transaction amount - **maker_fee_rate** (string) - Maker fee rate - **taker_fee_rate** (string) - Taker fee rate - **limited** (string) - API trading enabled flag (valid values: true, false) - **etf_mark** (integer) - ETF flag, 0 means not ETF, positive or negative integers mean it is an ETF - **symbol_partition** (string) - Trading zone, e.g., Main board ### Response Example ```json { "code": 200, "data": [ { "symbol": "QTUM_USDT", "state": "ENABLED", "price_scale": 4, "quantity_scale": 2, "min_amount": "5", "max_amount": "5000000", "maker_fee_rate": "0.002", "taker_fee_rate": "0.002", "limited": false, "etf_mark": 0, "symbol_partition": "MAIN" } ] } ``` ``` -------------------------------- ### Get Recent Trade Deals Source: https://ourbitdevelop.github.io/apidocs Fetches a list of recent trades for a trading pair. Each trade includes time, price, quantity, and type (BID/ASK). ```json { "code": 200, "data": [ { "trade_time": 1573267931530, "trade_price": "183.1683154", "trade_quantity": "5", "trade_type": "BID" }, { "trade_time": 1573266717841, "trade_price": "183.1683154", "trade_quantity": "0.5", "trade_type": "ASK" }, { "trade_time": 1573013871967, "trade_price": "183.1183105", "trade_quantity": "128.6", "trade_type": "BID" } ] } ``` -------------------------------- ### Get Market Depth Information Source: https://ourbitdevelop.github.io/apidocs Retrieves the order book (bids and asks) for a given trading pair and depth. Useful for understanding market liquidity. ```json { "code": 200, "data": { "asks": [ { "price": "183.1683154", "quantity": "128.5" }, { "price": "183.1983186", "quantity": "101.6" } ], "bids": [ { "price": "182.4417544", "quantity": "115.5" }, { "price": "182.4217568", "quantity": "135.7" } ] } } ``` -------------------------------- ### Personal Trade History Response Example Source: https://ourbitdevelop.github.io/apidocs This JSON object shows a successful response for retrieving personal trade history. It contains a list of trade records, including details like symbol, quantity, price, amount, fees, and timestamps. ```json { "code": 200, "data": [ { "id": "4ab9700a077d403f8c144c981ff3464b", "symbol": "OB_USDT", "quantity": "5", "price": "1.328", "amount": "6.64", "fee": "0.01328", "trade_type": "ASK", "order_id": "d4991cd4296f4138a5b02b2aea8bde8d", "is_taker": true, "fee_currency": "USDT", "create_time": 1657173950000 } ] } ``` -------------------------------- ### Cancel Orders by Trading Pair Response Example Source: https://ourbitdevelop.github.io/apidocs This JSON object shows a successful response after attempting to cancel orders for a given trading pair. Each item in the 'data' array indicates the status and order ID for each cancellation attempt. ```json { "code": 200, "data": [ { "msg": "success", "order_id": "75ecf99feef04538b78e4622beaba6eb", "client_order_id": "a9329e86f2094b0d8b58e92c25029554" }, { "msg": "success", "order_id": "139413c48f8b4c018f452ce796586bcf" }, { "msg": "success", "order_id": "b58ef34c570e4917981f276d44091484" } ] } ``` -------------------------------- ### Get Kline (Candlestick) Data Source: https://ourbitdevelop.github.io/apidocs Retrieves historical kline (candlestick) data for a trading pair and interval. Data includes timestamp, open, high, low, close, volume, and amount. ```json { "code": 200, "data": [ [ 1557728040, //timestamp in seconds "7054.7", //open "7056.26", //close "7056.29", //high "7054.16", //low "9.817734", //vol "6926.521" //amount ], [ 1557728100, "7056.26", "7042.17", "7056.98", "7042.16", "23.69423", "1677.931" ] ] } ``` -------------------------------- ### Signature Calculation Steps Source: https://ourbitdevelop.github.io/apidocs Steps to construct the string for signature generation. ```APIDOC 1. Obtain the request parameter string: - GET/DELETE: Sort business parameters alphabetically, join with '&', URL-encode special characters if necessary. - POST: Use the JSON string of the request body (no alphabetical sorting). - If no parameters, use an empty string. 2. Construct the signature target string: accessKey + timestamp + parameter string. 3. Sign the target string using HMAC SHA256 with your Secret Key. 4. The resulting signature string is placed in the 'Signature' header. Do not Base64 encode the signature. ``` -------------------------------- ### Batch Place Orders API Response (with client_order_id) Source: https://ourbitdevelop.github.io/apidocs This is a sample response when client_order_id is provided in the batch order placement request. It maps client order IDs to their corresponding order IDs. ```json { "code": 200, "data": { "1572936": "c8663a12a2fc457fbfdd55307b463495", "1572937": "ec42569b4f4349f7aabe26f78b0f8bd2", "1572938": "70669675cac2414c90493be2dcfaf7e3" } } ``` -------------------------------- ### Creating API Keys Source: https://ourbitdevelop.github.io/apidocs API keys, consisting of an Access Key and a Secret Key, can be created in the user's personal center on the OURBIT site. Permissions should be set before use. ```APIDOC Create API keys in the OURBIT user center. Keys include Access Key and Secret Key. Set appropriate permissions for each API key. ``` -------------------------------- ### Batch Place Orders API Response (without client_order_id) Source: https://ourbitdevelop.github.io/apidocs This is a sample response when client_order_id is not provided in the batch order placement request. It returns a list of order IDs. ```json { "code": 200, "data": [ "e3e1ee06916c462eb8cd0349ff9ab242", "4d1f8c13f4cc40bcbfbac4da2a26d3a5" ] } ``` -------------------------------- ### 获取币种信息 Source: https://ourbitdevelop.github.io/apidocs Retrieves detailed information about currencies, including their supported chains, precision, withdrawal/deposit status, and limits. ```APIDOC ## GET /open/api/v2/market/coin/list ### Description Retrieves detailed information about currencies, including their supported chains, precision, withdrawal/deposit status, and limits. Hidden or delisted currencies are not returned. ### Method GET ### Endpoint /open/api/v2/market/coin/list ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by a specific currency ### Response #### Success Response (200) - **code** (int) - Status code - **message** (string) - Error description (if any) - **currency** (string) - Currency symbol - **full_name** (string) - Full name of the currency - **chain** (string) - Chain name - **precision** (string) - Currency precision - **is_withdraw_enabled** (string) - Indicates if withdrawal is enabled - **is_deposit_enabled** (string) - Indicates if deposit is enabled - **deposit_minconfirm** (number) - Minimum confirmation blocks for deposit - **withdraw_limit_max** (number) - Maximum withdrawal amount per transaction - **withdraw_limit_min** (number) - Minimum withdrawal amount per transaction - **fee** (string) - Withdrawal fee amount ### Response Example ```json { "code": 200, "data": [ { "currency": "AGLD", "coins": [ { "chain": "ERC20", "precision": 18, "fee": 15.37, "is_withdraw_enabled": true, "is_deposit_enabled": true, "deposit_min_confirm": 16, "withdraw_limit_max": 500000.0, "withdraw_limit_min": 14.0 } ], "full_name": "Adventure Gold" } ] } ``` ``` -------------------------------- ### Place Batch Orders Source: https://ourbitdevelop.github.io/apidocs Enables the placement of multiple orders in a single request. The response format varies based on whether client-provided order IDs are included in the request. ```APIDOC ## POST /open/api/v2/order/place_batch ### Description Enables the placement of multiple orders in a single request. The response format varies based on whether client-provided order IDs are included in the request. ### Method POST ### Endpoint /open/api/v2/order/place_batch ### Parameters #### Request Body - **symbol** (string) - Required - Trading pair name. - **price** (string) - Required - Trading price. - **quantity** (string) - Required - Trading volume. - **trade_type** (string) - Required - Trade type. Possible values: BID, ASK. - **order_type** (string) - Required - Order type. Possible values: LIMIT_ORDER, POST_ONLY, IMMEDIATE_OR_CANCEL. - **client_order_id** (string) - Optional - Client Order ID. Maximum length is 32 characters. ### Request Example ```json [ { "order_type": "LIMIT_ORDER", "price": "40000", "quantity": "0.0002", "symbol": "BTC_USDT", "trade_type": "BID", "client_order_id": 9588234 }, { "order_type": "LIMIT_ORDER", "price": "0.00846945", "quantity": "1", "symbol": "RACA_USDT", "trade_type": "ASK" } ] ``` ### Response #### Success Response (200) - **data** (map or array) - If client_order_id is provided, it's a map of client order ID to order ID. Otherwise, it's an array of order IDs. #### Response Example (with client_order_id) ```json { "code": 200, "data": { "1572936": "c8663a12a2fc457fbfdd55307b463495", "1572937": "ec42569b4f4349f7aabe26f78b0f8bd2", "1572938": "70669675cac2414c90493be2dcfaf7e3" } } ``` #### Response Example (without client_order_id) ```json { "code": 200, "data": [ "e3e1ee06916c462eb8cd0349ff9ab242", "4d1f8c13f4cc40bcbfbac4da2a26d3a5" ] } ``` ``` -------------------------------- ### Batch Place Orders API Request Source: https://ourbitdevelop.github.io/apidocs This is a sample request body for placing multiple orders in a batch. It supports specifying order details like symbol, price, quantity, trade type, order type, and an optional client order ID. ```json [ { "order_type": "LIMIT_ORDER", "price": "40000", "quantity": "0.0002", "symbol": "BTC_USDT", "trade_type": "BID", "client_order_id": 9588234 }, { "order_type": "LIMIT_ORDER", "price": "0.00846945", "quantity": "1", "symbol": "RACA_USDT", "trade_type": "ASK" } ] ``` -------------------------------- ### Private Interface Headers Source: https://ourbitdevelop.github.io/apidocs For private interfaces, include ApiKey, Request-Time, Signature, Content-Type (application/json), and optionally Recv-Window in the headers. ```APIDOC Headers for private interfaces: - ApiKey: Your API key's Access Key. - Request-Time: 13-digit millisecond timestamp. - Signature: Generated signature string. - Content-Type: application/json - Recv-Window: (Optional) Custom time window for request validation. ``` -------------------------------- ### 深度信息 Source: https://ourbitdevelop.github.io/apidocs Retrieves market depth information, including asks and bids, for a specified trading pair and depth. ```APIDOC ## GET /open/api/v2/market/depth ### Description Retrieves market depth information, including asks and bids, for a specified trading pair and depth. ### Method GET ### Endpoint /open/api/v2/market/depth ### Parameters #### Query Parameters - **symbol** (string) - Required - Trading pair name - **depth** (string) - Required - Number of depth levels to return (1-2000) ### Response #### Success Response (200) - **bids** (object) - Bid orders, containing price and quantity fields. - **asks** (object) - Ask orders, containing price and quantity fields. ### Response Example ```json { "code": 200, "data": { "asks": [ { "price": "183.1683154", "quantity": "128.5" }, { "price": "183.1983186", "quantity": "101.6" } ], "bids": [ { "price": "182.4417544", "quantity": "115.5" }, { "price": "182.4217568", "quantity": "135.7" } ] } } ``` ``` -------------------------------- ### Ticker行情 Source: https://ourbitdevelop.github.io/apidocs Retrieves real-time ticker information for trading pairs. Includes data like volume, high, low, bid, ask, open, last price, and change rate. ```APIDOC ## GET /open/api/v2/market/ticker ### Description Retrieves real-time ticker information for trading pairs. ### Method GET ### Endpoint /open/api/v2/market/ticker ### Parameters #### Query Parameters - **symbol** (string) - Required - Trading pair name ### Response #### Success Response (200) - **symbol** (string) - Trading pair - **volume** (string) - Volume for the current period - **amount** (string) - Total amount for the current period - **high** (string) - Highest price in the current period - **low** (string) - Lowest price in the current period - **bid** (string) - Current highest bid price - **ask** (string) - Current lowest ask price - **open** (string) - Opening price for the current period - **last** (string) - Latest transaction price for the current period - **time** (string) - Timestamp of the latest quote - **change_rate** (string) - Change rate for the current period ### Response Example ```json { "code": 200, "data": [ { "symbol": "BTC_USDT", "volume": "47876.096755", "amount": "1161420469.76", "high": "24902.08", "low": "23494.28", "bid": "24684.48", "ask": "24685.6", "open": "24018.6", "last": "24681.71", "time": 1660226100000, "change_rate": "0.02760818" } ] } ``` ``` -------------------------------- ### API Base URL Source: https://ourbitdevelop.github.io/apidocs Use the following base URL for all API requests. ```APIDOC https://www.ourbit.com ``` -------------------------------- ### 成交记录 Source: https://ourbitdevelop.github.io/apidocs Fetches trade history for a given trading pair, with an optional limit on the number of records returned. ```APIDOC ## GET /open/api/v2/market/deals ### Description Fetches trade history for a given trading pair, with an optional limit on the number of records returned. ### Method GET ### Endpoint /open/api/v2/market/deals ### Parameters #### Query Parameters - **symbol** (string) - Required - Trading pair name - **limit** (integer) - Optional - Number of records to return (1-1000, default 100) ### Response #### Success Response (200) - **trade_time** (long) - Timestamp of the trade - **trade_price** (string) - Trade price - **trade_quantity** (string) - Trade quantity - **trade_type** (string) - Trade direction (BID or ASK) ### Response Example ```json { "code": 200, "data": [ { "trade_time": 1573267931530, "trade_price": "183.1683154", "trade_quantity": "5", "trade_type": "BID" }, { "trade_time": 1573266717841, "trade_price": "183.1683154", "trade_quantity": "0.5", "trade_type": "ASK" }, { "trade_time": 1573013871967, "trade_price": "183.1183105", "trade_quantity": "128.6", "trade_type": "BID" } ] } ``` ``` -------------------------------- ### Response Format Source: https://ourbitdevelop.github.io/apidocs All API responses are in JSON format. ```APIDOC JSON ``` -------------------------------- ### Ping Source: https://ourbitdevelop.github.io/apidocs Checks the server status. A successful response indicates the server is operational. ```APIDOC ## GET /open/api/v2/common/ping ### Description Checks the server status. A successful response indicates the server is operational. ### Method GET ### Endpoint /open/api/v2/common/ping ### Parameters #### Path Parameters None #### Query Parameters None ### Response #### Success Response (200) - **code** (int) - If returned, the server status is OK ### Response Example ```json { "code": 200 } ``` ``` -------------------------------- ### Ping Server Source: https://ourbitdevelop.github.io/apidocs A simple endpoint to check server status. A successful response indicates the server is operational. ```json { "code": 200 } ``` -------------------------------- ### Signature Operation Components Source: https://ourbitdevelop.github.io/apidocs Components involved in signature verification for private interfaces. ```APIDOC ApiKey: API key's access key. Request-Time: Timestamp of the request in milliseconds (13-digit string). Signature: Generated signature string (HMAC SHA256). Interface HTTP Request Method: HTTP method (GET, POST, DELETE). Interface URI: API endpoint path. Business Parameters: Parameters required by the interface (included in signature for GET/DELETE). ``` -------------------------------- ### Query Orders Source: https://ourbitdevelop.github.io/apidocs Retrieves a list of orders based on the provided order IDs. Supports batch operations for up to 20 order IDs. ```APIDOC ## GET /open/api/v2/order/query ### Description Retrieves order details based on provided order IDs. Supports batch operations for up to 20 order IDs. ### Method GET ### Endpoint /open/api/v2/order/query ### Parameters #### Query Parameters - **order_ids** (string) - Required - Order ID(s), supports batch operations. Maximum batch size is 20. ### Response #### Success Response (200) - **symbol** (string) - Trading pair name - **id** (string) - Order ID - **price** (string) - Order price - **quantity** (string) - Order quantity - **state** (string) - Order status - **type** (string) - Order type - **deal_quantity** (string) - Deal quantity - **deal_amount** (string) - Deal amount - **create_time** (string) - Order creation time - **client_order_id** (string) - Client Order ID ### Response Example ```json { "code": 200, "data": [ { "id": "504feca6ba6349e39c82262caf0be3f4", "symbol": "OB_ETH", "price": "0.000901", "quantity": "300000", "state": "NEW", "type": "BID", "deal_quantity": "0", "deal_amount": "0", "create_time": 1573117266000 } ] } ``` ``` -------------------------------- ### Signature Rules Source: https://ourbitdevelop.github.io/apidocs Public interfaces do not require a signature. Private interfaces require signature operations. Time security is enforced via the 'Request-Time' header. ```APIDOC Public Interfaces: No signature required. Private Interfaces: Signature required. Time Security: 'Request-Time' header must be present and within a 10-second window (customizable with 'Recv-Window'). ``` -------------------------------- ### Java SignVo Data Transfer Object Source: https://ourbitdevelop.github.io/apidocs A data class to hold parameters required for signature generation, including request time, access key, secret key, and request parameters. ```java @Getter @Setter public static class SignVo { private String reqTime; private String accessKey; private String secretKey; private String requestParam; //get请求参数根据字典顺序排序,使用&拼接字符串,post为json字符串 } ``` -------------------------------- ### Cancel Order API Response Source: https://ourbitdevelop.github.io/apidocs This is a sample response for the order cancellation API. It indicates the success of the operation. ```json { "code": 200, "data": { "504feca6ba6349e39c82262caf0be3f4": "success" } } ``` -------------------------------- ### Enum Definitions Source: https://ourbitdevelop.github.io/apidocs Definitions for various enumerations used in the API, such as order status, order type, and trade type. ```APIDOC Order Status: - NEW: Not yet filled - FILLED: Fully filled - PARTIALLY_FILLED: Partially filled - CANCELED: Canceled - PARTIALLY_CANCELED: Partially canceled Order Type: - LIMIT_ORDER: Limit order - POST_ONLY: Post-only limit order - IMMEDIATE_OR_CANCEL: Immediate or cancel order Trade Type: - BID: Buy order - ASK: Sell order Recharge Status: - PENDING: In progress - SUCCESS: Completed Time Intervals: m -> minute; h -> hour; d -> day; M -> month - 1m - 5m - 15m - 30m - 60m - 4h - 1M ``` -------------------------------- ### Cancel Orders by Symbol Source: https://ourbitdevelop.github.io/apidocs Cancels all open orders for a specified trading pair. ```APIDOC ## DELETE /open/api/v2/order/cancel_by_symbol ### Description Cancels all open orders for a specified trading pair. ### Method DELETE ### Endpoint /open/api/v2/order/cancel_by_symbol ### Parameters #### Query Parameters - **symbol** (string) - Required - Trading pair name. ### Response #### Success Response (200) - **data** (map) - Order number and corresponding operation result. ### Response Example ```json { "code": 200, "data": [ { "msg": "success", "order_id": "75ecf99feef04538b78e4622beaba6eb", "client_order_id": "a9329e86f2094b0d8b58e92c25029554" }, { "msg": "success", "order_id": "139413c48f8b4c018f452ce796586bcf" }, { "msg": "success", "order_id": "b58ef34c570e4917981f276d44091484" } ] } ``` ``` -------------------------------- ### Rate Limiting Rules Source: https://ourbitdevelop.github.io/apidocs REST API access is rate-limited. Exceeding limits results in a 429 status code. Limits are based on account for authenticated requests and IP for unauthenticated requests. ```APIDOC Rate limits apply to REST API access. Exceeding limits returns status code 429. Authenticated requests: Limited per account. Unauthenticated requests: Limited per IP address. Default limit (if not specified): 20 requests/second. ``` -------------------------------- ### Cancel Order Source: https://ourbitdevelop.github.io/apidocs Allows users to cancel one or more orders using their order IDs or client-specified order IDs. Supports batch cancellation with a limit of 20 orders per request. ```APIDOC ## DELETE /open/api/v2/order/cancel ### Description Allows users to cancel one or more orders using their order IDs or client-specified order IDs. Supports batch cancellation with a limit of 20 orders per request. ### Method DELETE ### Endpoint /open/api/v2/order/cancel ### Parameters #### Query Parameters - **order_ids** (string) - Optional - Order ID, supports batch cancellation, separated by commas. Maximum batch operation count is 20. - **client_order_ids** (string) - Optional - Client Order ID, supports batch cancellation, separated by commas. Maximum batch operation count is 20. ### Response #### Success Response (200) - **data** (map) - Order ID and corresponding operation result. ### Response Example ```json { "code": 200, "data": { "504feca6ba6349e39c82262caf0be3f4": "success" } } ``` ``` -------------------------------- ### Error Codes Source: https://ourbitdevelop.github.io/apidocs A list of possible error codes returned by the API and their meanings. ```APIDOC 400: Invalid request parameters 401: Signature verification failed 429: Too many requests 10072: Invalid access key 10073: Invalid request time 30000: Trading pair suspended 30001: Trading direction not allowed 30002: Below minimum trading amount 30003: Exceeds maximum trading amount 30004: Insufficient position 30005: Sell order exceeds limit 30010: Order price out of range 30016: Trading suspended 30019: API market order not enabled 30020: Restricted trading pair, API access not supported 30021: Invalid trading pair ``` -------------------------------- ### Personal Transaction Records Source: https://ourbitdevelop.github.io/apidocs Retrieves a list of personal transaction records for a given trading pair. Supports filtering by time range and limiting the number of results. ```APIDOC ## GET /open/api/v2/order/deals ### Description Retrieves personal transaction records for a specified trading pair. Allows filtering by time and limiting the number of returned records. ### Method GET ### Endpoint /open/api/v2/order/deals ### Parameters #### Query Parameters - **symbol** (string) - Required - Trading pair name. - **limit** (string) - Optional - Number of records to return. Default is 50. (1-1000) - **start_time** (string) - Optional - Query start time. ### Response #### Success Response (200) - **symbol** (string) - Trading pair - **id** (string) - Transaction ID - **order_id** (string) - Order ID - **trade_type** (string) - Transaction type - **quantity** (string) - Transaction quantity - **price** (string) - Transaction price - **amount** (string) - Transaction amount - **fee** (string) - Transaction fee - **fee_currency** (string) - Fee currency - **is_taker** (bool) - Indicates if the order was a taker order in the transaction - **create_time** (long) - Transaction creation time ### Response Example ```json { "code": 200, "data": [ { "id": "4ab9700a077d403f8c144c981ff3464b", "symbol": "OB_USDT", "quantity": "5", "price": "1.328", "amount": "6.64", "fee": "0.01328", "trade_type": "ASK", "order_id": "d4991cd4296f4138a5b02b2aea8bde8d", "is_taker": true, "fee_currency": "USDT", "create_time": 1657173950000 } ] } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.