### OpenAPI Definition Example Source: https://apidocs.bithumb.com/reference/%EC%9E%85%EA%B8%88-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C An example OpenAPI definition snippet showing configuration for headers, explorer, and proxy. ```json { "headers": [], "explorer-enabled": false, "proxy-enabled": false }, "x-readme-fauxas": true } ``` -------------------------------- ### OpenAPI Definition Example Source: https://apidocs.bithumb.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C An example of an OpenAPI definition structure. ```json { "x-readme-fauxas": true } ``` -------------------------------- ### Example Daily Candle Data Response Source: https://apidocs.bithumb.com/docs/%EC%9D%BCday-%EC%BA%94%EB%93%A4-%EC%A1%B0%ED%9A%8C This is an example of the JSON response received when successfully querying the daily candle data. It includes details such as market, timestamps, opening, high, low, closing prices, trading volume, and price changes. ```JSON [ { "market": "KRW-BTC", "candle_date_time_utc": "2018-04-18T00:00:00", "candle_date_time_kst": "2018-04-18T09:00:00", "opening_price": 8450000, "high_price": 8679000, "low_price": 8445000, "trade_price": 8626000, "timestamp": 1524046650532, "candle_acc_trade_price": 107184005903.68721, "candle_acc_trade_volume": 12505.93101659, "prev_closing_price": 8450000, "change_price": 176000, "change_rate": 0.0208284024 } ] ``` -------------------------------- ### Fetch Ticker Data (KRW-BTC) in Java Source: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A1%B0%ED%9A%8C Retrieve ticker data for the KRW-BTC market using Java with the OkHttpClient library. This example shows how to construct the request and execute it. ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.bithumb.com/v1/ticker?markets=KRW-BTC") .get() .addHeader("accept", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Retrieve API Keys (Python) Source: https://apidocs.bithumb.com/reference/api-%ED%82%A4-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C This Python snippet demonstrates how to generate an access token and call the API to retrieve your API keys. Ensure you have the 'pyjwt' library installed. ```python # Python 3 # pip3 installl pyJwt import jwt import uuid import time import requests # Set API parameters accessKey = '발급받은 API KEY' secretKey = '발급받은 SECRET KEY' apiUrl = 'https://api.bithumb.com' # Generate access token payload = { 'access_key': accessKey, 'nonce': str(uuid.uuid4()), 'timestamp': round(time.time() * 1000) } jwt_token = jwt.encode(payload, secretKey) authorization_token = 'Bearer {}'.format(jwt_token) headers = { 'Authorization': authorization_token } try: # Call API response = requests.get(apiUrl + '/v1/api_keys', headers=headers) # handle to success or fail print(response.status_code) print(response.json()) except Exception as err: # handle exception print(err) ``` -------------------------------- ### Get Ticker Information Source: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A1%B0%ED%9A%8C Fetches real-time ticker information for one or more cryptocurrency markets. You can specify the markets using the `markets` query parameter. ```APIDOC ## GET /v1/ticker ### Description Retrieves real-time ticker information for specified cryptocurrency markets. ### Method GET ### Endpoint /v1/ticker ### Parameters #### Query Parameters - **markets** (string) - Required - Comma-separated list of market pairs (e.g., KRW-BTC, BTC-ETH). ### Request Example ``` GET /v1/ticker?markets=KRW-BTC ``` ### Response #### Success Response (200) - **status** (string) - API response status. - **data** (object) - Ticker information for the requested markets. - **opening_price** (string) - Opening price. - **closing_price** (string) - Closing price. - **min_price** (string) - Minimum price. - **max_price** (string) - Maximum price. - **average_price** (string) - Average price. - **volume** (string) - Trading volume. - **fluctuation** (string) - Price fluctuation. - **postulating_price** (string) - Postulating price. - **datetime** (string) - Timestamp of the data. #### Response Example ```json { "status": "0000", "data": { "opening_price": "70000000", "closing_price": "71000000", "min_price": "69000000", "max_price": "72000000", "average_price": "70500000", "volume": "1000.00000000", "fluctuation": "1000000", "postulating_price": "71000000", "datetime": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Get Virtual Asset Warning Source: https://apidocs.bithumb.com/reference/%EA%B2%BD%EB%B3%B4%EC%A0%9C-%EC%A1%B0%ED%9A%8C This endpoint retrieves a list of virtual assets that have warnings associated with them. It's useful for staying updated on assets that may require extra caution. ```APIDOC ## GET /v1/market/virtual_asset_warning ### Description Retrieves information about virtual asset warnings. ### Method GET ### Endpoint /v1/market/virtual_asset_warning ### Parameters #### Query Parameters This endpoint does not accept any query parameters. ### Request Example ``` GET /v1/market/virtual_asset_warning HTTP/1.1 Host: api.bithumb.com Accept: application/json ``` ### Response #### Success Response (200) - **data** (object) - Contains warning information for virtual assets. - **warning_list** (array) - A list of assets with warnings. - **symbol** (string) - The trading symbol of the asset. - **warning_msg** (string) - The warning message associated with the asset. #### Response Example ```json { "status": "0000", "data": { "warning_list": [ { "symbol": "BTC", "warning_msg": "No warning" }, { "symbol": "ETH", "warning_msg": "Potential delisting risk" } ] } } ``` ``` -------------------------------- ### Java JWT Authentication and API Call Source: https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C Demonstrates how to generate a JWT for authentication and make an HTTP GET request to the Bithumb API to fetch order details. Ensure necessary libraries like Apache HttpClient are included. ```java import java.nio.charset.StandardCharsets; import java.security.Key; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.crypto.spec.SecretKeySpec; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; public class BithumbApi { public void getOrders(String apiKey, String apiSecret, String apiUrl, String endpoint) { // Generate JWT String queryHash = ""; String queryHashAlg = "SHA512"; String jwtToken = ""; String authenticationToken = "Bearer " + jwtToken; // Call API final HttpGet httpRequest = new HttpGet(apiUrl + "/v1/orders?" + queryHash); httpRequest.addHeader("Authorization", authenticationToken); try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse response = client.execute(httpRequest)) { // handle to response int httpStatus = response.getStatusLine().getStatusCode(); String responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); System.out.println(httpStatus); System.out.println(responseBody); } catch (Exception e) { throw new RuntimeException(e); } } } ``` -------------------------------- ### Retrieve API Keys (Java) Source: https://apidocs.bithumb.com/reference/api-%ED%82%A4-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C This Java snippet shows how to generate a JWT token and make an authenticated GET request to the Bithumb API for retrieving API keys. It uses the 'java-jwt' and 'httpclient' libraries. ```java package com.example.sample; // https://mvnrepository.com/artifact/com.auth0/java-jwt import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; // https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import java.nio.charset.StandardCharsets; import java.util.UUID; public class GETNoArgs { public static void main(String[] args) { String accessKey = "발급받은 API KEY"; String secretKey = "발급받은 SECRET KEY"; String apiUrl = "https://api.bithumb.com"; // Generate access token Algorithm algorithm = Algorithm.HMAC256(secretKey); String jwtToken = JWT.create() .withClaim("access_key", accessKey) .withClaim("nonce", UUID.randomUUID().toString()) .withClaim("timestamp", System.currentTimeMillis()) .sign(algorithm); String authenticationToken = "Bearer " + jwtToken; // Call API final HttpGet httpRequest = new HttpGet(apiUrl + "/v1/api_keys"); httpRequest.addHeader("Authorization", authenticationToken); try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse response = client.execute(httpRequest)) { // handle to response int httpStatus = response.getStatusLine().getStatusCode(); String responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); System.out.println(httpStatus); System.out.println(responseBody); } catch (Exception e) { throw new RuntimeException(e); } } } ``` -------------------------------- ### Python - Query Orders with UUIDs and Client Order IDs Source: https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C Use this Python snippet to query order history, supporting filtering by specific order UUIDs or client-defined order IDs. Ensure you have the 'PyJWT' library installed. ```Python # Python 3 # pip3 installl pyJwt import jwt import uuid import hashlib import time from urllib.parse import urlencode import requests accessKey = '발급받은 API KEY' secretKey = '발급받은 SECRET KEY' apiUrl = 'https://api.bithumb.com' # Set API parameters param = dict( market='KRW-XRP', limit=100, page=1, order_by='desc' ) # uuids 또는 client_order_ids 두 값 모두 전달하지 않은 경우 최신 주문 내역 조회 # 두 값이 모두 전달된 경우, uuids를 기준으로 조회 uuids = [ 'C0106000032400700021', 'C0106000043000097801' ] client_order_ids = [ 'my-order-001', 'my-order-002' ] query = urlencode(param) uuid_query = '&'.join([f'uuids[]={u}' for u in uuids]) client_order_id_query = '&'.join([f'client_order_ids[]={id}' for id in client_order_ids]) if uuid_query: query = query + "&" + uuid_query if client_order_id_query: query = query + "&" + client_order_id_query # Generate access token hash = hashlib.sha512() hash.update(query.encode()) query_hash = hash.hexdigest() payload = { 'access_key': accessKey, 'nonce': str(uuid.uuid4()), 'timestamp': round(time.time() * 1000), 'query_hash': query_hash, 'query_hash_alg': 'SHA512', } jwt_token = jwt.encode(payload, secretKey) authorization_token = 'Bearer {}'.format(jwt_token) headers = { 'Authorization': authorization_token } try: # Call API response = requests.get(apiUrl + '/v1/orders?' + query, headers=headers) # handle to success or fail print(response.status_code) print(response.json()) except Exception as err: # handle exception print(err) ``` -------------------------------- ### Fetch Virtual Asset Warning (JavaScript) Source: https://apidocs.bithumb.com/reference/%EA%B2%BD%EB%B3%B4%EC%A0%9C-%EC%A1%B0%ED%9A%8C Use this JavaScript snippet to make a GET request to the Bithumb API's virtual asset warning endpoint. It handles the response and logs any errors. ```javascript const options = { method: 'GET', headers: { accept: 'application/json', }, }; fetch('https://api.bithumb.com/v1/market/virtual_asset_warning', options) .then((response) => response.json()) .then((response) => { console.log(response); }) .catch((error) => { console.error(error); }); ``` -------------------------------- ### Python JWT Authentication for Bithumb API Source: https://apidocs.bithumb.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C This Python snippet demonstrates how to generate a JWT token and authenticate API requests to Bithumb. It includes setting API parameters, generating a query hash, and making a GET request. ```python # Python 3 # pip3 installl pyJwt import jwt import uuid import hashlib import time from urllib.parse import urlencode import requests accessKey = '발급받은 API KEY' secretKey = '발급받은 SECRET KEY' apiUrl = 'https://api.bithumb.com' # Set API parameters param = dict( limit=100, page=1, order_by='desc' ) uuids = [ '12704033', '12812333' ] query = urlencode(param) uuid_query = '&'.join([f'uuids[]={uuid}' for uuid in uuids]) query = query + "&" + uuid_query # Generate access token hash = hashlib.sha512() hash.update(query.encode()) query_hash = hash.hexdigest() payload = { 'access_key': accessKey, 'nonce': str(uuid.uuid4()), 'timestamp': round(time.time() * 1000), 'query_hash': query_hash, 'query_hash_alg': 'SHA512', } jwt_token = jwt.encode(payload, secretKey) authorization_token = 'Bearer {}'.format(jwt_token) headers = { 'Authorization': authorization_token } try: # Call API response = requests.get(apiUrl + '/v1/withdraws/krw?' + query, headers=headers) # handle to success or fail print(response.status_code) print(response.json()) except Exception as err: # handle exception print(err) ``` -------------------------------- ### GET /api/v1/payment/transfer/list Source: https://apidocs.bithumb.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C Retrieves a list of withdrawal transactions. This endpoint allows users to query their past withdrawal activities. ```APIDOC ## GET /api/v1/payment/transfer/list ### Description Retrieves a list of withdrawal transactions. This endpoint allows users to query their past withdrawal activities. ### Method GET ### Endpoint /api/v1/payment/transfer/list ### Parameters #### Query Parameters - **pagination_size** (integer) - Optional - The number of items to display per page. - **pagination_offset** (integer) - Optional - The starting point for pagination. - **from** (string) - Optional - The start date for the transaction search (YYYY-MM-DD). - **to** (string) - Optional - The end date for the transaction search (YYYY-MM-DD). - **currency** (string) - Optional - The currency code for filtering transactions (e.g., BTC, ETH). - **type** (string) - Optional - The type of transaction to filter by (e.g., "all", "deposit", "withdrawal"). ### Response #### Success Response (200) - **status** (string) - The status code of the API response. - **data** (object) - The response data containing transaction details. - **list** (array) - An array of withdrawal transaction objects. - **transaction_date** (string) - The date and time of the transaction. - **type** (string) - The type of transaction. - **units_traded** (string) - The amount of currency withdrawn. - **price** (string) - The price at the time of withdrawal (if applicable). - **fee** (string) - The transaction fee. - **order_currency** (string) - The currency that was ordered/withdrawn. - **payment_currency** (string) - The currency used for payment/fees. - ** I D** (string) - The unique identifier for the transaction. #### Response Example ```json { "status": "0000", "data": { "list": [ { "transaction_date": "2024-01-01 10:00:00", "type": "withdrawal", "units_traded": "0.5", "price": "30000.00", "fee": "0.0005", "order_currency": "BTC", "payment_currency": "KRW", " I D": "TX123456789" } ] } } ``` ``` -------------------------------- ### Get Day Candle Data Source: https://apidocs.bithumb.com/docs/%EC%9D%BCday-%EC%BA%94%EB%93%A4-%EC%A1%B0%ED%9A%8C Retrieves daily candle data for a specified trading pair. You can filter the results by market, reference time, and the number of candles to retrieve. For non-KRW markets, the closing price can be converted to KRW. ```APIDOC ## GET /v1/candles/days ### Description Retrieves daily candle data for a specified trading pair. ### Method GET ### Endpoint https://api.bithumb.com/v1/candles/days ### Parameters #### Query Parameters - **market** (string) - Required - Unique symbol of the trading pair (e.g., KRW-BTC) - **to** (string) - Optional - Reference time (KST). Candles at this time are excluded. Format: yyyy-MM-dd HH:mm:ss or yyyy-MM-ddTHH:mm:ss - **count** (int32) - Optional - Number of candles to view (max 200, defaults to 1) - **convertingPriceUnit** (string) - Optional - When requesting a daily chart for a market other than the KRW market, convert the closing price into the specified currency unit. Currently, only 'KRW' is supported. ### Responses #### Success Response (200) An array of objects, where each object represents a day's candle data: - **market** (string) - Unique symbol of the trading pair (e.g., KRW-BTC) - **candle_date_time_utc** (date-time) - Candle time (UTC) - **candle_date_time_kst** (date-time) - Candle time (KST) - **opening_price** (double) - Market price at the start of the candle period - **high_price** (double) - Highest price during the candle period - **low_price** (double) - Lowest price during the candle period - **trade_price** (double) - Closing price of the candle period - **timestamp** (string) - Time of the last trade during the candle period (Unix timestamp, Unit: ms) - **candle_acc_trade_price** (double) - Cumulative trading value during the candle period - **candle_acc_trade_volume** (double) - Cumulative trading volume during the candle period - **prev_closing_price** (double) - Previous day's closing price (as of 00:00 UTC) - **change_price** (double) - Change from the previous day's closing price - **change_rate** (double) - Change rate compared to the previous day's closing price - **converted_trade_price** (double) - Converted closing price (returned if `convertingPriceUnit` was requested) #### Response Example (200) ```json [ { "market": "KRW-BTC", "candle_date_time_utc": "2018-04-18T00:00:00", "candle_date_time_kst": "2018-04-18T09:00:00", "opening_price": 8450000, "high_price": 8679000, "low_price": 8445000, "trade_price": 8626000, "timestamp": "1524046650532", "candle_acc_trade_price": 107184005903.68721, "candle_acc_trade_volume": 12505.93101659, "prev_closing_price": 8450000, "change_price": 176000, "change_rate": 0.0208284024 } ] ``` #### Error Response (400) Bad Request ``` -------------------------------- ### Get KRW Withdrawals Source: https://apidocs.bithumb.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C Retrieves a list of KRW withdrawal transactions. Requires authentication with API keys and a JWT token. ```APIDOC ## GET /v1/withdraws/krw ### Description Retrieves a list of KRW withdrawal transactions associated with your account. This endpoint requires authentication and allows filtering by limit, page, order, and specific withdrawal UUIDs. ### Method GET ### Endpoint /v1/withdraws/krw ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of results to return. - **page** (integer) - Optional - The page number for pagination. - **order_by** (string) - Optional - The order of results (e.g., 'desc', 'asc'). - **uuids[]** (array of strings) - Optional - A list of withdrawal UUIDs to filter by. ### Request Example ```json { "example": "See Python or Java examples for full request construction including headers and query parameters." } ``` ### Response #### Success Response (200) - **status** (string) - The status of the API request. - **data** (object) - The withdrawal data. - **withdrawal_date** (string) - The date of the withdrawal. - **units_real** (string) - The actual amount withdrawn. - **units_paid** (string) - The amount paid. - **fee** (string) - The transaction fee. - **address** (string) - The withdrawal address. - **is_confirmed** (string) - Confirmation status. - **transaction_date** (string) - The date of the transaction. - **type** (string) - The type of withdrawal. - **wd_fee** (string) - Withdrawal fee. - **wd_units_real** (string) - Actual withdrawal units. #### Response Example ```json { "status": "0000", "data": [ { "withdrawal_date": "2024-01-01 10:00:00", "units_real": "10000.00000000", "units_paid": "10000.00000000", "fee": "0.00000000", "address": "BAddress123...", "is_confirmed": "0", "transaction_date": "2024-01-01 10:05:00", "type": "KRW", "wd_fee": "0.00000000", "wd_units_real": "10000.00000000" } ] } ``` ``` -------------------------------- ### Cancel Withdrawal (JavaScript) Source: https://apidocs.bithumb.com/reference/%EA%B0%80%EC%83%81-%EC%9E%90%EC%82%B0-%EC%B6%9C%EA%B8%88-%EC%B7%A8%EC%86%8C Use this JavaScript snippet to cancel a cryptocurrency withdrawal. Ensure you have installed the 'jsonwebtoken', 'uuid', and 'axios' packages. Replace placeholders with your actual API credentials and withdrawal ID. ```javascript // Required packages: // npm install jsonwebtoken uuid axios const jwt = require('jsonwebtoken'); const { v4: uuidv4 } = require('uuid'); const crypto = require('crypto'); const axios = require('axios'); // TODO: Replace with your API key. const accessKey = 'YOUR_ACCESS_KEY'; // TODO: Replace with your secret key. const secretKey = 'YOUR_SECRET_KEY'; // TODO: Replace with the withdrawal ID to cancel. const withdrawalId = 'YOUR_WITHDRAWAL_ID'; const apiUrl = 'https://api.bithumb.com'; const algorithm = 'SHA512'; function createPayload(queryString) { const queryHash = crypto.createHash(algorithm).update(queryString, 'utf-8').digest('hex'); return { access_key: accessKey, nonce: uuidv4(), timestamp: Date.now(), query_hash: queryHash, query_hash_alg: algorithm, }; } async function main() { const params = { withdrawal_id: withdrawalId }; const queryString = new URLSearchParams(params).toString(); const payload = createPayload(queryString); const jwtToken = jwt.sign(payload, secretKey); const response = await axios.delete(`${apiUrl}/v1/withdraws/coin`, { headers: { Authorization: `Bearer ${jwtToken}`, }, params, }); console.log('status:', response.status); console.log('data:', response.data); } main() .catch((error) => { console.log('status:', error.response?.status ?? 'NO_RESPONSE'); console.log('data:', error.response?.data ?? error.message); }); ``` -------------------------------- ### Fetch Virtual Asset Warning (Java) Source: https://apidocs.bithumb.com/reference/%EA%B2%BD%EB%B3%B4%EC%A0%9C-%EC%A1%B0%ED%9A%8C This Java code snippet shows how to fetch virtual asset warning data from the Bithumb API using OkHttpClient. ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.bithumb.com/v1/market/virtual_asset_warning") .get() .addHeader("accept", "application/json") .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string()); ``` -------------------------------- ### Fetch Ticker Data (KRW-BTC) in Python Source: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A1%B0%ED%9A%8C This Python snippet demonstrates how to retrieve ticker information for the KRW-BTC market using the requests library. It includes setting the necessary headers for the API call. ```python import requests url = "https://api.bithumb.com/v1/ticker?markets=KRW-BTC" headers = {"accept": "application/json"} response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### Fetch Ticker Data (KRW-BTC) in JavaScript Source: https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A1%B0%ED%9A%8C Use this snippet to fetch real-time ticker data for the KRW-BTC market using JavaScript's fetch API. Ensure proper error handling for network requests. ```javascript const options = {method: 'GET', headers: {accept: 'application/json'}}; fetch('https://api.bithumb.com/v1/ticker?markets=KRW-BTC', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Fetch Daily Candle Data Source: https://apidocs.bithumb.com/docs/%EC%9D%BCday-%EC%BA%94%EB%93%A4-%EC%A1%B0%ED%9A%8C Use this endpoint to retrieve daily candlestick data for a given trading pair. You can specify the market, a reference time, and the number of candles to retrieve. The 'convertingPriceUnit' parameter can be used to convert closing prices for non-KRW markets. ```Shell curl --request GET \ --url https://api.bithumb.com/v1/candles/days \ --header 'accept: application/json' ``` -------------------------------- ### Fetch Virtual Asset Warning (Python) Source: https://apidocs.bithumb.com/reference/%EA%B2%BD%EB%B3%B4%EC%A0%9C-%EC%A1%B0%ED%9A%8C This Python code snippet demonstrates how to retrieve virtual asset warning information from the Bithumb API using the requests library. ```python import requests url = "https://api.bithumb.com/v1/market/virtual_asset_warning" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### Java - Query Orders with UUIDs and Client Order IDs Source: https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C This Java snippet demonstrates how to query order history, allowing filtering by order UUIDs or client order IDs. It utilizes the auth0 Java JWT library and Apache HttpClient. ```java package com.example.sample; // https://mvnrepository.com/artifact/com.auth0/java-jwt import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; // https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient import org.apache.http.NameValuePair; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; public class GETArgsArray { public static void main(String[] args) throws NoSuchAlgorithmException { String accessKey = "발급받은 API KEY"; String secretKey = "발급받은 SECRET KEY"; String apiUrl = "https://api.bithumb.com"; // Set API parameters List queryParams = new ArrayList<>(); queryParams.add(new BasicNameValuePair("market", "KRW-XRP")); queryParams.add(new BasicNameValuePair("limit", "100")); queryParams.add(new BasicNameValuePair("page", "1")); queryParams.add(new BasicNameValuePair("order_by", "desc")); // uuids 또는 client_order_ids 두 값 모두 전달하지 않은 경우 최신 주문 내역 조회 // 두 값이 모두 전달된 경우, uuids를 기준으로 조회 List uuids = new ArrayList<>(); uuids.add("C0106000032400700021"); uuids.add("C0106000043000097801"); String uuidQuery = uuids.stream().map(uuid -> "uuids[]=" + uuid).collect(Collectors.joining("&")); List clientOrderIds = new ArrayList<>(); clientOrderIds.add("my-order-001"); clientOrderIds.add("my-order-002"); String clientOrderIdQuery = clientOrderIds.stream().map(id -> "client_order_ids[]=" + id).collect(Collectors.joining("&")); // Generate access token String query = URLEncodedUtils.format(queryParams, StandardCharsets.UTF_8); if (!uuidQuery.isEmpty()) { query = query + "&" + uuidQuery; } if (!clientOrderIdQuery.isEmpty()) { query = query + "&" + clientOrderIdQuery; } MessageDigest md = MessageDigest.getInstance("SHA-512"); md.update(query.getBytes(StandardCharsets.UTF_8)); String queryHash = String.format("%0128x", new BigInteger(1, md.digest())); Algorithm algorithm = Algorithm.HMAC256(secretKey); String jwtToken = JWT.create() .withClaim("access_key", accessKey) .withClaim("nonce", UUID.randomUUID().toString()) .withClaim("timestamp", System.currentTimeMillis()) ``` -------------------------------- ### Java JWT Authentication for Bithumb API Source: https://apidocs.bithumb.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C This Java snippet shows how to authenticate API requests to Bithumb using JWT. It covers setting up API parameters, generating the query hash, creating the JWT token, and making the HTTP request. ```java package com.example.sample; // https://mvnrepository.com/artifact/com.auth0/java-jwt import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; // https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient import org.apache.http.NameValuePair; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; public class GETArgsArray { public static void main(String[] args) throws NoSuchAlgorithmException { String accessKey = "발급받은 API KEY"; String secretKey = "발급받은 SECRET KEY"; String apiUrl = "https://api.bithumb.com"; // Set API parameters List queryParams = new ArrayList<>(); queryParams.add(new BasicNameValuePair("limit", "100")); queryParams.add(new BasicNameValuePair("page", "1")); queryParams.add(new BasicNameValuePair("order_by", "desc")); List uuids = new ArrayList<>(); uuids.add("12704033"); uuids.add("12812333"); String uuidQuery = uuids.stream().map(uuid -> "uuids[]=" + uuid).collect(Collectors.joining("&")); // Generate access token String query = URLEncodedUtils.format(queryParams, StandardCharsets.UTF_8); if (uuidQuery.isEmpty()) { query = query + "&" + uuidQuery; } MessageDigest md = MessageDigest.getInstance("SHA-512"); md.update(query.getBytes(StandardCharsets.UTF_8)); String queryHash = String.format("%0128x", new BigInteger(1, md.digest())); Algorithm algorithm = Algorithm.HMAC256(secretKey); String jwtToken = JWT.create() .withClaim("access_key", accessKey) .withClaim("nonce", UUID.randomUUID().toString()) .withClaim("timestamp", System.currentTimeMillis()) .withClaim("query_hash", queryHash) .withClaim("query_hash_alg", "SHA512") .sign(algorithm); String authenticationToken = "Bearer " + jwtToken; // Call API final HttpGet httpRequest = new HttpGet(apiUrl + "/v1/withdraws/krw?" + query); httpRequest.addHeader("Authorization", authenticationToken); try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse response = client.execute(httpRequest)) { // handle to response int httpStatus = response.getStatusLine().getStatusCode(); String responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); System.out.println(httpStatus); System.out.println(responseBody); } catch (Exception e) { throw new RuntimeException(e); } } } ``` -------------------------------- ### Retrieve API Keys Source: https://apidocs.bithumb.com/reference/api-%ED%82%A4-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C This endpoint allows you to retrieve your API keys. It requires authentication using a JWT token generated with your access and secret keys. ```APIDOC ## GET /v1/api_keys ### Description Retrieves the API keys associated with your account. This is a protected endpoint that requires authentication. ### Method GET ### Endpoint /v1/api_keys ### Request Example ``` { "Authorization": "Bearer [JWT_TOKEN]" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the API key information. - **api_key** (string) - Your Bithumb API key. - **created_at** (string) - Timestamp when the API key was created. - **modified_at** (string) - Timestamp when the API key was last modified. #### Response Example ```json { "status": "0000", "data": { "api_key": "your_api_key_here", "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Public WebSocket Source: https://apidocs.bithumb.com/reference Provides real-time market data without requiring authentication. This includes current prices, trade history, and order book information. ```APIDOC ## Public WebSocket ### Description Receive market data in real time without authentication. ### Endpoint `wss://ws-api.bithumb.com/websocket/v1` ### Data Types * **Current price (Ticker)**: Real-time price snapshot of a stock, including current price, rate of change, and trading volume. * **Trade**: Real-time transaction history (transaction price, transaction volume, buy/sell distinction). * **Orderbook**: Real-time buy/sell quotes and remaining volume. ``` -------------------------------- ### Private API - Etc Source: https://apidocs.bithumb.com/docs/api-%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4 Miscellaneous endpoints for checking deposit/withdrawal status and managing API keys. Requires JWT authentication. ```APIDOC ### Private API - etc __ Deposit/Withdrawal Status __ Check deposit/withdrawal status and block status. __ API key list inquiry __ View a list of API keys and their expiration dates. ``` -------------------------------- ### Private API - Account Source: https://apidocs.bithumb.com/docs/api-%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4 Provides endpoints for querying user account and asset information. Requires JWT authentication. ```APIDOC ### Private API - Account JWT authentication is required to call the Private API. __ View all accounts __ View information about the assets you hold. ``` -------------------------------- ### Retrieve Order History Source: https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C This endpoint allows users to retrieve their order history. It supports filtering by market, limit, page, order_by, and optionally by uuids or client_order_ids. Authentication is required using a JWT token. ```APIDOC ## GET /v1/orders ### Description Retrieves the user's order history with various filtering options. ### Method GET ### Endpoint /v1/orders ### Parameters #### Query Parameters - **market** (string) - Required - The trading market (e.g., 'KRW-XRP'). - **limit** (integer) - Optional - The maximum number of orders to return. - **page** (integer) - Optional - The page number for pagination. - **order_by** (string) - Optional - The order in which to sort results (e.g., 'desc'). - **uuids[]** (string) - Optional - An array of UUIDs to filter orders. - **client_order_ids[]** (string) - Optional - An array of client order IDs to filter orders. ### Request Example ```python import jwt import uuid import hashlib import time from urllib.parse import urlencode import requests accessKey = 'YOUR_API_KEY' secretKey = 'YOUR_SECRET_KEY' apiUrl = 'https://api.bithumb.com' param = dict( market='KRW-XRP', limit=100, page=1, order_by='desc' ) uuids = [ 'C0106000032400700021', 'C0106000043000097801' ] client_order_ids = [ 'my-order-001', 'my-order-002' ] query = urlencode(param) uuid_query = '&'.join([f'uuids[]={u}' for u in uuids]) client_order_id_query = '&'.join([f'client_order_ids[]={id}' for id in client_order_ids]) if uuid_query: query = query + "&" + uuid_query if client_order_id_query: query = query + "&" + client_order_id_query hash = hashlib.sha512() hash.update(query.encode()) query_hash = hash.hexdigest() payload = { 'access_key': accessKey, 'nonce': str(uuid.uuid4()), 'timestamp': round(time.time() * 1000), 'query_hash': query_hash, 'query_hash_alg': 'SHA512', } jwt_token = jwt.encode(payload, secretKey) authorization_token = 'Bearer {}'.format(jwt_token) headers = { 'Authorization': authorization_token } response = requests.get(apiUrl + '/v1/orders?' + query, headers=headers) print(response.status_code) print(response.json()) ``` ### Response #### Success Response (200) - **status** (string) - API response status. - **data** (object) - Response data. - **order_currency** (string) - The currency of the order. - **payment_currency** (string) - The currency used for payment. - **order_id** (string) - The unique identifier for the order. - **order_date** (string) - The date and time the order was placed. - **type** (string) - The type of order (e.g., 'bid', 'ask'). - **units** (string) - The quantity of the currency ordered. - **price** (string) - The price per unit. - **total** (string) - The total cost of the order. - **currency** (string) - The currency of the order. - **contract** (string) - The contract details. - **order_status** (string) - The current status of the order. - **from_id** (string) - The ID of the previous order in a sequence. - **to_id** (string) - The ID of the next order in a sequence. - **pagination** (object) - Pagination information. - **next_url** (string) - The URL for the next page of results. #### Response Example ```json { "status": "0000", "data": [ { "order_currency": "XRP", "payment_currency": "KRW", "order_id": "202301010000000001", "order_date": "2023-01-01T10:00:00Z", "type": "bid", "units": "10.0", "price": "500.0", "total": "5000.0", "currency": "KRW", "contract": "", "order_status": "completed", "from_id": "", "to_id": "", "pagination": { "next_url": "/v1/orders?page=2&limit=100" } } ] } ``` ``` -------------------------------- ### Private API - Etc Source: https://apidocs.bithumb.com/reference Miscellaneous endpoints for checking status and managing API keys. Requires JWT authentication. ```APIDOC ### etc __ Deposit/Withdrawal Status __ Check deposit/withdrawal status and block status. __ API key list inquiry __ View a list of API keys and their expiration dates. ``` -------------------------------- ### Bithumb API Base URLs Source: https://apidocs.bithumb.com/docs/api-%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4 Provides the base URLs for accessing Bithumb's REST API and WebSocket services. REST APIs require versioning in the path. ```text REST API: https://api.bithumb.com WebSocket: wss://ws-api.bithumb.com/websocket/v1 (Public) wss://ws-api.bithumb.com/websocket/v1/private (Private) ``` -------------------------------- ### Private API - Deposit Source: https://apidocs.bithumb.com/docs/api-%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4 Endpoints for managing deposits, including viewing deposit history, checking deposit lists for virtual assets and KRW, and requesting deposits or deposit addresses. Requires JWT authentication. ```APIDOC ### Private API - Deposit __ Individual deposit inquiry __ View individual deposit history. __ Check coin deposit list __ View the list of virtual asset deposits. __ Check the list of Korean won deposits __ View the list of KRW deposits. __ KRW deposit __ I would like to request a deposit in Korean Won. __ Request to create a deposit address __ Request to create a deposit address. __ All deposit addresses inquiry __ View the full deposit address. __ Individual deposit addresses inquiry __ Check the deposit address for each virtual asset. ``` -------------------------------- ### Private API - Deposit Source: https://apidocs.bithumb.com/reference Endpoints for managing deposits of virtual assets and Korean Won, including address management. Requires JWT authentication. ```APIDOC ### Deposit __ Individual deposit inquiry __ View individual deposit history. __ Check coin deposit list __ View the list of virtual asset deposits. __ Check the list of Korean won deposits __ View the list of KRW deposits. __ KRW deposit __ I would like to request a deposit in Korean Won. __ Request to create a deposit address __ Request to create a deposit address. __ All deposit addresses inquiry __ View the full deposit address. __ Individual deposit addresses inquiry __ Check the deposit address for each virtual asset. ``` -------------------------------- ### Private API - Order Source: https://apidocs.bithumb.com/docs/api-%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4 Endpoints for managing orders, including viewing order information, history, requesting new orders, and cancellations. Requires JWT authentication. ```APIDOC ### Private API - Order __ Ordering Information __ View order availability information (fees, restrictions, etc.) for each trading pair. __ Individual Order Inquiry __ View individual order history. __ View order list __ View your order list. __ Order Request __ Requesting a limit/market order. (v2) __ Multi-order request __ Request multiple orders at once. (v2, up to 20 orders) __ Order cancellation request __ Requesting order cancellation. (v2) __ Multiple order cancellations accepted __ Requesting bulk cancellation for multiple orders. (v2, maximum 30 orders) ``` -------------------------------- ### Private API - Withdrawal Source: https://apidocs.bithumb.com/reference Endpoints for managing withdrawals of virtual assets and Korean Won. Requires JWT authentication. ```APIDOC ### Withdrawal __ Withdrawal information __ Check the withdrawal availability of the currency in question. __ Individual withdrawal inquiry __ View individual withdrawal history. __ View coin withdrawal list __ View the list of virtual asset withdrawals. __ View the list of Korean won withdrawals __ View the list of Korean Won withdrawals. __ Virtual asset withdrawal request __ Request a withdrawal of virtual assets. __ Cancellation of virtual asset withdrawal __ Cancel virtual asset withdrawal. __ Korean Won withdrawal request __ Request a withdrawal in Korean Won to your registered withdrawal account. __ List of allowed withdrawal addresses inquiry __ View the list of registered allowed withdrawal addresses. ``` -------------------------------- ### Private WebSocket Source: https://apidocs.bithumb.com/reference Enables real-time retrieval of user-specific data through JWT authentication. This includes order status, execution history, and asset balance changes. ```APIDOC ## Private WebSocket ### Description Receives user personal data in real time through JWT authentication. ### Endpoint `wss://ws-api.bithumb.com/websocket/v1/private` ### Authentication Requires JWT authentication. ### Data Types * **My Order and Execution (MyOrder)**: Receive real-time updates on my order status and execution history. * **MyAsset**: Receive real-time changes in asset balances. ```