### Python Authentication Setup Source: https://www.bitstamp.net/api Initial setup for generating authentication headers and payload in Python. ```python import hashlib import hmac import time import requests import uuid import sys from urllib.parse import urlencode api_key = 'api_key' API_SECRET = b'api_key_secret' timestamp = str(int(round(time.time() * 1000))) nonce = str(uuid.uuid4()) content_type = 'application/x-www-form-urlencoded' payload = {'offset': '1'} payload_string = urlencode(payload) ``` -------------------------------- ### Cancel All Orders Response Example Source: https://www.bitstamp.net/api Example JSON response structure for a bulk cancellation request, showing the list of canceled orders and success status. ```json { "canceled": [ { "id": 1453282316578816, "amount": "0.02035278", "price": "2100.45", "type": 0, "currency_pair": "BTC/USD", "market": "BTC/USD" } ], "success": true } ``` -------------------------------- ### Cancel Order Response Example Source: https://www.bitstamp.net/api Example JSON response structure returned after successfully cancelling a specific order. ```json { "id": 1453282316578816, "amount": "0.02035278", "price": "2100.45", "type": 0, "market": "BTC/USD", "status": "Canceled" } ``` -------------------------------- ### Account Balances Response Sample Source: https://www.bitstamp.net/api Example JSON response for the account balances endpoint. ```json [ { "currency": "usd", "total": "100.00", "available": "90.00", "reserved": "10.00" } ] ``` -------------------------------- ### GET /api/v2/collateral_currencies/ Source: https://www.bitstamp.net/api Returns collateral currencies with haircut. ```APIDOC ## GET /api/v2/collateral_currencies/ ### Description Returns collateral currencies with haircut. ### Method GET ### Endpoint https://www.bitstamp.net/api/v2/collateral_currencies/ ### Response #### Success Response (200) - **currency** (string) - Description not available. - **haircut** (string) - Description not available. #### Response Example ```json [ { "currency": "USD", "haircut": "0.5" } ] ``` ``` -------------------------------- ### Trading Fees Response Sample Source: https://www.bitstamp.net/api Example JSON response for the trading fees endpoint. ```json [ { "currency_pair": "btcusd", "market": "btcusd", "fees": { "maker": "0.15000", "taker": "0.16000" } } ] ``` -------------------------------- ### Response Collateral Currencies Source: https://www.bitstamp.net/api Example response listing supported collateral currencies and their associated haircuts. ```json [ { "currency": "USD", "haircut": "0.5" } ] ``` -------------------------------- ### Withdrawal Fees Response Sample Source: https://www.bitstamp.net/api Example JSON response for the withdrawal fees endpoint. ```json [ { "currency": "btc", "fee": "0.00015000", "network": "bitcoin" } ] ``` -------------------------------- ### Account Balance for Currency Response Sample Source: https://www.bitstamp.net/api Example JSON response for the account balance of a specific currency. ```json { "currency": "usd", "total": "100.00", "available": "90.00", "reserved": "10.00" } ``` -------------------------------- ### Crypto Deposits List Response Sample Source: https://www.bitstamp.net/api Example JSON response structure for a list of cryptocurrency deposits. ```json [ { "id": 1, "network": "bitcoin", "currency": "BTC", "destination_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "txid": "e4123d1d57df4106aaae5ec4d77eb6cd42e226d020a0a2c1c7919d14b932494b", "amount": 1.23, "datetime": 1759995000, "status": "PENDING", "pending_reason": "ADDRESS_VERIFICATION_NEEDED" } ] ``` -------------------------------- ### GET /api/v2/margin_info/ Source: https://www.bitstamp.net/api Returns current margin information for the account. ```APIDOC ## GET /api/v2/margin_info/ ### Description Returns margin information for the account. ### Method GET ### Endpoint /api/v2/margin_info/ ### Response #### Success Response (200) - **account_margin** (string) - Total account margin - **account_margin_available** (string) - Available margin - **account_margin_currency** (string) - Margin currency - **assets** (array) - List of assets with margin details - **initial_margin_ratio** (string) - Initial margin ratio - **maintenance_margin_ratio** (string) - Maintenance margin ratio #### Response Example { "account_margin": "20000.00", "account_margin_available": "20000.00", "account_margin_currency": "USD", "assets": [ { "asset": "USD", "total_amount": "20000.00", "available": "20000.00" } ], "initial_margin_ratio": "3.00", "maintenance_margin_ratio": "3.12" } ``` -------------------------------- ### GET /api/v2/my_markets/ Source: https://www.bitstamp.net/api Returns all markets that can be traded on the selected account. ```APIDOC ## GET /api/v2/my_markets/ ### Description Returns all markets that can be traded on the selected account. ### Method GET ### Endpoint https://www.bitstamp.net/api/v2/my_markets/ ### Response #### Success Response (200) - **name** (string) - The market name (e.g., BTC/USD). - **url_symbol** (string) - The URL-friendly symbol. #### Response Example [ { "name": "BTC/USD", "url_symbol": "btcusd" } ] ``` -------------------------------- ### GET /api/v2/ticker/ Source: https://www.bitstamp.net/api Returns ticker data for all currency pairs. ```APIDOC ## GET /api/v2/ticker/ ### Description Returns ticker data for the requested currency pair. Passing any GET parameters will result in your request being rejected. ### Method GET ### Endpoint /api/v2/ticker/ ### Response #### Success Response (200) - **last** (string) - Last price - **high** (string) - 24h high - **low** (string) - 24h low - **vwap** (string) - Volume weighted average price - **volume** (string) - 24h volume - **bid** (string) - Highest buy order - **ask** (string) - Lowest sell order - **timestamp** (string) - Unix timestamp - **open** (string) - Open price - **open_24** (string) - Open price 24h ago - **percent_change_24** (string) - 24h percentage change - **side** (string) - Side - **market_type** (string) - Market type - **mark_price** (string) - Mark price - **index_price** (string) - Index price - **open_interest** (string) - Open interest - **open_interest_value** (string) - Open interest value - **pair** (string) - Currency pair - **market** (string) - Market identifier #### Response Example { "last": "2211.00", "high": "2811.00", "low": "2188.97", "vwap": "2189.80", "volume": "213.26801100", "bid": "2188.97", "ask": "2211.00", "timestamp": "1643640186", "open": "2211.00", "open_24": "2211.00", "percent_change_24": "13.57", "side": "0", "market_type": "SPOT", "mark_price": "2812.00", "index_price": "2814.00", "open_interest": "10.1", "open_interest_value": "10234.00", "pair": "BTC/USD", "market": "BTC/USD" } ``` -------------------------------- ### Trading Fee for Market Response Sample Source: https://www.bitstamp.net/api Example JSON response for the trading fee of a specific market. ```json { "currency_pair": "btcusd", "market": "btcusd", "fees": { "maker": "0.15000", "taker": "0.16000" } } ``` -------------------------------- ### VASP List Response Sample Source: https://www.bitstamp.net/api Example JSON response for the VASP list retrieval endpoint. ```json { "data": [ { "uuid": "258b8c23-48c0-4916-bba9-0dd47bcdd7cf", "name": "Bitstamp" } ], "pagination": { "page": 0, "size": 0, "count": 0 } } ``` -------------------------------- ### Get All Markets Source: https://www.bitstamp.net/api Retrieves a list of all available markets on Bitstamp. ```APIDOC ## GET /api/v2/markets/ ### Description Retrieves a list of all available markets on Bitstamp. ### Method GET ### Endpoint /api/v2/markets/ ### Response #### Success Response (200) - **name** (string) - The name of the market (e.g., "BTC/USD"). - **market_symbol** (string) - The unique symbol for the market (e.g., "btcusd"). - **base_currency** (string) - The base currency of the market (e.g., "BTC"). - **base_decimals** (integer) - The number of decimal places for the base currency. - **counter_currency** (string) - The counter currency of the market (e.g., "USD"). - **counter_decimals** (integer) - The number of decimal places for the counter currency. - **minimum_order_value** (string) - The minimum value for an order in this market. - **maximum_order_value** (string) - The maximum value for an order in this market. - **minimum_order_amount** (string) - The minimum amount for an order in this market. - **maximum_order_amount** (string) - The maximum amount for an order in this market. - **trading** (string) - Indicates if trading is enabled for this market ("Enabled" or "Disabled"). - **instant_order_counter_decimals** (integer) - Decimal places for instant order counter currency. - **instant_and_market_orders** (string) - Indicates if instant and market orders are enabled. - **description** (string) - A human-readable description of the market. - **market_type** (string) - The type of market (e.g., "SPOT"). - **underlying_asset** (string) - The underlying asset for derivative markets. - **payoff_type** (string) - The payoff type for derivative markets. - **contract_size** (string) - The contract size for derivative markets. - **tick_size** (string) - The minimum price fluctuation for this market. - **isin** (string) - The ISIN code for the market. ### Response Example ```json [ { "name": "BTC/USD", "market_symbol": "btcusd", "base_currency": "BTC", "base_decimals": 8, "counter_currency": "USD", "counter_decimals": 2, "minimum_order_value": "20.0", "maximum_order_value": "200.0", "minimum_order_amount": "0.01", "maximum_order_amount": "10", "trading": "Enabled", "instant_order_counter_decimals": 2, "instant_and_market_orders": "Enabled", "description": "Bitcoin / U.S. dollar", "market_type": "SPOT", "underlying_asset": "Kaiko BTC Benchmark Reference Rate", "payoff_type": "Linear", "contract_size": "1", "tick_size": "0.0001", "isin": "EZHKD4DNKHY3" } ] ``` ``` -------------------------------- ### Instant Convert Address Info Response Source: https://www.bitstamp.net/api Example JSON response containing transaction details for an instant convert address. ```json [ * { * "address": "3MDvHUAg41uJx1511gDotsf4ccKuc9frz1", * "currency_pair": "BTC/USD", * "transactions": [ * { * "order_id": 1, * "count": 1, * "trades": [ * { * "exchange_rate": "1.0", * "btc_amount": "1.0", * "fees": "0.0" } ] } ] } ] ``` -------------------------------- ### Crypto Transactions Response Sample Source: https://www.bitstamp.net/api Example JSON response structure for a successful crypto transactions request. ```json { "ripple_iou_transactions": [ { "currency": "BTC", "network": "bitcoin", "destinationAddress": "3FiKkjgZ6Sj4RWp3ZsCjYh5Pt7ZCBsL7uF", "txid": "e4123d1d57df4106aaae5ec4d77eb6cd42e226d020a0a2c1c7919d14b932494b", "amount": 0.00012, "datetime": 1642665114 } ], "deposits": [ { "id": 1, "network": "bitcoin", "currency": "BTC", "txid": "e4123d1d57df4106aaae5ec4d77eb6cd42e226d020a0a2c1c7919d14b932494b", "amount": 1.23, "datetime": 1759995000, "status": "PENDING", "pending_reason": "ADDRESS_VERIFICATION_NEEDED", "destinationAddress": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" } ], "withdrawals": [ { "currency": "BTC", "network": "bitcoin", "destinationAddress": "3FiKkjgZ6Sj4RWp3ZsCjYh5Pt7ZCBsL7uF", "txid": "e4123d1d57df4106aaae5ec4d77eb6cd42e226d020a0a2c1c7919d14b932494b", "amount": 0.00012, "datetime": 1642665114 } ] } ``` -------------------------------- ### GET /api-external/psd2/v1/account-balances/ Source: https://www.bitstamp.net/api-psd2 Retrieves an array of fiat balances (EUR, USD, GBP) for the authenticated account. ```APIDOC ## GET /api-external/psd2/v1/account-balances/ ### Description Returns an array of your fiat balances (EUR, USD, GBP). ### Method GET ### Endpoint https://www.bitstamp.net/api-external/psd2/v1/account-balances/ ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by currency. Valid options: USD, EUR, GBP. ### Response #### Success Response (200) - **amount** (string) - Balance amount - **currency** (string) - Balance currency #### Error Response - **code** (string) - Error code - **message** (string) - Error Message ``` -------------------------------- ### Instant Convert Address Response Source: https://www.bitstamp.net/api Example JSON response for an instant convert address request. ```json { * "address": "3MDvHUAg41uJx1511gDotsf4ccKuc9frz1" } ``` -------------------------------- ### GET /api/v2/currencies/ Source: https://www.bitstamp.net/api Retrieves a list of all listed currencies with their basic data, including network-specific withdrawal and deposit information. ```APIDOC ## GET /api/v2/currencies/ ### Description Returns a list of all currencies with basic data, including blockchain network support, minimum withdrawal amounts, and decimal precision. ### Method GET ### Endpoint /api/v2/currencies/ ### Response #### Success Response (200) - **name** (string) - Currency name - **currency** (string) - Currency code - **type** (string) - Type of currency (e.g., crypto) - **symbol** (string) - Currency symbol - **decimals** (integer) - Decimal precision - **networks** (array) - List of supported blockchain networks #### Response Example [ { "name": "Bitcoin", "currency": "BTC", "type": "crypto", "symbol": "₿", "decimals": 8, "networks": [ { "network": "ethereum", "withdrawal_minimum_amount": "0.01", "withdrawal_decimals": 8, "deposit": "Enabled", "withdrawal": "Enabled" } ] } ] ``` -------------------------------- ### Bitstamp API Request Example Source: https://www.bitstamp.net/api Demonstrates how to construct and send a POST request to the Bitstamp API, including authentication and signature generation. Ensure libcurl and OpenSSL libraries are linked. ```cpp int main() { const std::string api_key = "api_key"; const std::string api_secret = "api_key_secret"; std::chrono::milliseconds timestamp = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() ); uuid_t uuid; uuid_string_t nonce; uuid_generate(uuid); uuid_unparse_lower(uuid, nonce); std::string x_auth = "BITSTAMP " + api_key; std::string x_auth_nonce = nonce; std::string x_auth_timestamp = std::to_string(timestamp.count()); std::string x_auth_version = "v2"; std::string content_type = "application/x-www-form-urlencoded"; std::string payload = url_encode("{offset:1}"); std::string http_method = "POST"; std::string url_host = "www.bitstamp.net"; std::string url_path = "/api/v2/user_transactions/"; std::string url_query = ""; std::string data_to_sign = ""; data_to_sign.append(x_auth); data_to_sign.append(http_method); data_to_sign.append(url_host); data_to_sign.append(url_path); data_to_sign.append(url_query); data_to_sign.append(content_type); data_to_sign.append(x_auth_nonce); data_to_sign.append(x_auth_timestamp); data_to_sign.append(x_auth_version); data_to_sign.append(payload); // calculate hmac signature unsigned char* result; unsigned int len = 20; result = (unsigned char*)malloc(sizeof(char) * len); HMAC_CTX ctx; HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, api_secret.c_str(), api_secret.length(), EVP_sha256(), NULL); HMAC_Update(&ctx, (unsigned char*)data_to_sign.c_str(), data_to_sign.length()); HMAC_Final(&ctx, result, &len); HMAC_CTX_cleanup(&ctx); std::string x_auth_signature = b2a_hex( (char *)result, 32 ); free(result); // send request CURL *curl; CURLcode res; std::string read_buffer; curl = curl_easy_init(); if(curl) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, ("X-Auth: " + x_auth).c_str()); headers = curl_slist_append(headers, ("X-Auth-Signature: " + x_auth_signature).c_str()); headers = curl_slist_append(headers, ("X-Auth-Nonce: " + x_auth_nonce).c_str()); headers = curl_slist_append(headers, ("X-Auth-Timestamp: " + x_auth_timestamp).c_str()); headers = curl_slist_append(headers, ("X-Auth-Version: " + x_auth_version).c_str()); headers = curl_slist_append(headers, ("Content-Type: " + content_type).c_str()); std::string url = "https://" + url_host + url_path + url_query; curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload.c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_call_back); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &read_buffer); res = curl_easy_perform(curl); if(res != CURLE_OK) { std::cout << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl; } std::cout << "curl_easy_perform() response: " << read_buffer << std::endl; curl_easy_cleanup(curl); } return 0; } ``` -------------------------------- ### GET /api/v2/earn/subscriptions/ Source: https://www.bitstamp.net/api Retrieves the earn subscriptions for the user. ```APIDOC ## GET /api/v2/earn/subscriptions/ ### Description Get earn subscriptions for user. ### Method GET ### Endpoint /api/v2/earn/subscriptions/ ### Response #### Success Response (200) - **currency** (string) - Currency code - **type** (string) - Subscription type - **term** (string) - Subscription term - **estimated_annual_yield** (number) - Estimated annual yield - **distribution_period** (string) - Distribution period - **activation_period** (string) - Activation period - **minimum_subscription_amount** (number) - Minimum subscription amount - **amount** (number) - Subscribed amount - **available_amount** (number) - Available amount - **amount_earned** (number) - Total amount earned #### Response Example [ { "currency": "ETH", "type": "LENDING", "term": "FIXED", "estimated_annual_yield": 10, "distribution_period": "DAILY", "activation_period": "24 hours", "minimum_subscription_amount": 0, "amount": 1, "available_amount": 1, "amount_earned": 2 } ] ``` -------------------------------- ### POST /api/v2/earn/subscriptions/setting/ Source: https://www.bitstamp.net/api Manage subscription settings (opt in, opt out) for staking products. ```APIDOC ## POST /api/v2/earn/subscriptions/setting/ ### Description Manage subscription settings (opt in, opt out). Currently only supported for staking. ### Method POST ### Endpoint /api/v2/earn/subscriptions/setting/ ### Parameters #### Request Body - **setting** (string) - Required - Type of setting action (Enum: "OPT_IN", "OPT_OUT") - **currency** (string) - Required - Currency - **earn_type** (string) - Required - Type of Earn product (Enum: "STAKING", "LENDING") ### Request Example { "setting": "OPT_IN", "currency": "ADA", "earn_type": "STAKING" } ### Response #### Success Response (204) - No content returned on success. #### Response Example (400) { "code": "string", "message": "string", "field": "string" } ``` -------------------------------- ### POST /api/v2/instant_convert_address/new/ Source: https://www.bitstamp.net/api Creates a new instant convert address for automatic crypto-to-fiat conversion. ```APIDOC ## POST /api/v2/instant_convert_address/new/ ### Description Creates a new instant convert address which will automatically sell deposited crypto for a specified fiat currency. ### Method POST ### Endpoint https://www.bitstamp.net/api/v2/instant_convert_address/new/ ### Parameters #### Request Body - **liquidation_currency** (string) - Optional - Deposited crypto will be converted to this currency. - **address_format** (string) - Optional - Address format, either "P2SHP2WSH" or "BECH32". ``` -------------------------------- ### GET /api/v2/trade_history/ Source: https://www.bitstamp.net/api Retrieves the derivatives trade history. ```APIDOC ## GET /api/v2/trade_history/ ### Description Returns derivatives trade history. ### Method GET ### Endpoint /api/v2/trade_history/ ### Parameters #### Query Parameters - **limit** (string) - Optional - Limit result to that many records (default: 100; maximum: 1000). - **sort** (string) - Optional - Sorting order: asc - ascending; desc - descending (default: desc). - **order_id** (string) - Optional - Order ID. - **since_timestamp** (integer) - Optional - Show only trades from unix timestamp. - **until_timestamp** (integer) - Optional - Show only trades to unix timestamp. - **after_id** (string) - Optional - Show only records from specified id. If after_id parameter is used, limit parameter is set to 1000. ### Response #### Success Response (200) - **trade_id** (string) - Trade ID - **order_id** (string) - Order ID - **self_trade_order_id** (string) - Self trade order ID - **datetime** (string) - Date and time of trade - **fee** (string) - Fee amount - **liquidation_fee** (string) - Liquidation fee - **fee_currency** (string) - Fee currency - **market** (string) - Market pair - **margin_mode** (string) - Margin mode - **leverage** (string) - Leverage value - **side** (string) - Trade side (BUY/SELL) - **type** (string) - Trade type - **self_trade_type** (string) - Self trade type - **price** (string) - Trade price - **amount** (string) - Trade amount #### Response Example [ { "trade_id": "1234123412341234", "order_id": "1234123412341235", "self_trade_order_id": "1234123412341236", "datetime": "2022-03-01 10:54:53.849000", "fee": "0.62563", "liquidation_fee": "0.5", "fee_currency": "USD", "market": "BTC/USD", "margin_mode": "ISOLATED", "leverage": "1.90", "side": "BUY", "type": "TRADE", "self_trade_type": "TRADE", "price": "100.00", "amount": "0.5" } ] ``` -------------------------------- ### GET /api/v2/earn/transactions/ Source: https://www.bitstamp.net/api Retrieves the earn transaction history for the user. ```APIDOC ## GET /api/v2/earn/transactions/ ### Description Get earn transaction history. ### Method GET ### Endpoint /api/v2/earn/transactions/ ### Parameters #### Query Parameters - **limit** (integer) - Optional - Limit result to that many events (default: 100; maximum: 1000) - **offset** (integer) - Optional - Skip that many events before returning results (default: 0, maximum: 200000) - **currency** (string) - Optional - Currency - **quote_currency** (string) - Optional - Currency in which value is calculated ### Response #### Success Response (200) - **datetime** (string) - Transaction timestamp - **type** (string) - Transaction type - **amount** (number) - Transaction amount - **currency** (string) - Currency code - **value** (number) - Transaction value - **quote_currency** (string) - Quote currency code - **status** (string) - Transaction status #### Response Example [ { "datetime": "2022-01-31 14:43:15.796000", "type": "SUBSCRIBE", "amount": 10, "currency": "ETH", "value": 100, "quote_currency": "USD", "status": "COMPLETED" } ] ``` -------------------------------- ### GET /api/v2/travel_rule/contacts/ Source: https://www.bitstamp.net/api Retrieve a list of all Travel Rule contacts. ```APIDOC ## GET /api/v2/travel_rule/contacts/ ### Description Returns all contacts created for Travel Rule purposes. ### Method GET ### Endpoint /api/v2/travel_rule/contacts/ ### Parameters #### Query Parameters - **per_page** (integer) - Optional - Number of items per page - **page** (integer) - Optional - Page number ### Response #### Success Response (200) - **contacts** (array) - List of contact objects ``` -------------------------------- ### Sample Trading Markets Response Source: https://www.bitstamp.net/api This JSON array lists available trading markets, each represented by its name (e.g., BTC/USD) and a URL-friendly symbol. ```json [ { "name": "BTC/USD", "url_symbol": "btcusd" } ] ``` -------------------------------- ### GET /api/v2/position_settlement_transactions/ Source: https://www.bitstamp.net/api Retrieves a list of position settlement transactions. ```APIDOC ## GET /api/v2/position_settlement_transactions/ ### Description Returns a list of position settlement transactions. ### Method GET ### Endpoint /api/v2/position_settlement_transactions/ ### Parameters #### Query Parameters - **offset** (string) - Optional - Skip that many records before returning results (default: 0, maximum: 200000). - **limit** (string) - Optional - Limit result to that many records (default: 100; maximum: 1000). - **since_id** (string) - Optional - Show only records from specified id. - **sort** (string) - Optional - Sorting order: asc - ascending; desc - descending (default: desc). - **since_timestamp** (string) - Optional - Show only settlement transactions from unix timestamp (for max 30 days old). - **until_timestamp** (string) - Optional - Show only settlement transactions to unix timestamp (for max 30 days old). ### Response #### Success Response (200) - **transaction_id** (string) - Transaction ID - **position_id** (string) - Position ID - **settlement_time** (number) - Settlement time - **settlement_type** (string) - Type of settlement - **settlement_price** (string) - Settlement price - **market** (string) - Market name - **market_type** (string) - Market type - **pnl_currency** (string) - PnL currency - **pnl_settled** (string) - Settled PnL - **pnl_component_price** (string) - Price component of PnL - **pnl_component_fees** (string) - Fees component of PnL - **pnl_component_funding** (string) - Funding component of PnL - **pnl_component_socialized_loss** (string) - Socialized loss component of PnL - **margin_mode** (string) - Margin mode - **size** (string) - Position size - **strike_price** (string) - Strike price - **fees_component_trading** (string) - Trading fees component - **fees_component_liquidation** (string) - Liquidation fees component #### Response Example [ { "transaction_id": "123123", "position_id": "123123", "settlement_time": 123123123, "settlement_type": "PERIODIC", "settlement_price": "20.00", "market": "BTC/USD-PERP", "market_type": "PERPETUAL", "pnl_currency": "USD", "pnl_settled": "-200.00", "pnl_component_price": "-200.00", "pnl_component_fees": "-200.00", "pnl_component_funding": "-200.00", "pnl_component_socialized_loss": "-200.00", "margin_mode": "ISOLATED", "size": "3.00", "strike_price": "20000.00", "fees_component_trading": "50.00", "fees_component_liquidation": "50.00" } ] ``` -------------------------------- ### POST /api/v2/sell/instant/{market_symbol}/ Source: https://www.bitstamp.net/api Opens an instant sell order. The execution depends on market conditions. This call is executed on the account bound to the API key. ```APIDOC ## Sell instant order ### Description Open an instant sell order. By placing an instant order you acknowledge that the execution of your order depends on the market conditions and that these conditions may be subject to sudden changes that cannot be foreseen. This call will be executed on the account (Sub or Main), to which the used API key is bound to. ### Method POST ### Endpoint /api/v2/sell/instant/{market_symbol}/ ### Parameters #### Path Parameters - **market_symbol** (string) - Required - The market symbol for the order (e.g., BTC/USD). #### Request Body - **amount** (number) - Required - Amount in base currency (Example: For BTC/USD pair, amount is quoted in BTC). - **amount_in_counter** (boolean) - Optional - If true, the amount parameter refers to the counter currency instead of the base currency. - **client_order_id** (string) - Optional - Client order ID for internal reference. - **margin_mode** (string) - Optional - Enum: "CROSS", "ISOLATED". Margin mode (Derivatives only). - **leverage** (string) - Optional - Leverage rate (Derivatives only). - **reduce_only** (boolean) - Optional - A reduce-only order can only reduce your current position. Cannot be true when using amount_in_counter (Derivatives only). ### Request Example ```json { "amount": "0.001", "amount_in_counter": false, "client_order_id": "my_order_123", "margin_mode": "CROSS", "leverage": "5", "reduce_only": false } ``` ### Response #### Success Response (200) - **subtype** (string) - The subtype of the order. - **id** (string) - The unique identifier for the order. - **market** (string) - The market symbol. - **datetime** (string) - The date and time the order was placed. - **type** (string) - The type of the order. - **price** (string) - The price of the order. - **amount** (string) - The amount of the order. - **client_order_id** (string) - The client-provided order ID. - **margin_mode** (string) - The margin mode used for the order. - **leverage** (string) - The leverage rate used for the order. - **stop_price** (string) - The stop price for the order. - **trigger** (string) - The trigger condition for the order. - **activation_price** (string) - The activation price for the order. - **trailing_delta** (number) - The trailing delta for the order. #### Response Example ```json { "subtype": "LIMIT", "id": "1234123412341234", "market": "BTC/USD", "datetime": "2022-01-31 14:43:15.796000", "type": "0", "price": "2211.00", "amount": "45.00000000", "client_order_id": "123456789", "margin_mode": "ISOLATED", "leverage": "3.1", "stop_price": "10.123", "trigger": "LAST_TRADED_PRICE", "activation_price": "10.123", "trailing_delta": 50 } ``` ``` -------------------------------- ### POST /api/v2/buy/instant/{market_symbol}/ Source: https://www.bitstamp.net/api Places an instant buy order for a specified market symbol. ```APIDOC ## POST /api/v2/buy/instant/{market_symbol}/ ### Description Places an instant buy order on the specified market. ### Method POST ### Endpoint /api/v2/buy/instant/{market_symbol}/ ### Parameters #### Path Parameters - **market_symbol** (string) - Required - The trading pair symbol. #### Request Body - **amount** (number) - Required - Amount in counter currency. - **client_order_id** (string) - Optional - Unique client reference ID. - **margin_mode** (string) - Required (for derivatives) - Enum: "CROSS", "ISOLATED". - **leverage** (string) - Required (for derivatives) - Leverage rate. ### Response #### Success Response (200) - **id** (string) - Order ID - **market** (string) - Market pair - **amount** (string) - Amount #### Response Example { "id": "1234123412341234", "market": "BTC/USD", "amount": "45.00000000" } ``` -------------------------------- ### GET /api/v2/open_positions/ Source: https://www.bitstamp.net/api Retrieves the list of currently open derivative positions. ```APIDOC ## GET /api/v2/open_positions/ ### Description Returns the list of open positions for the user. ### Method GET ### Endpoint /api/v2/open_positions/ ### Response #### Success Response (200) - **id** (string) - Position ID. - **market** (string) - Market name. - **side** (string) - Position side (SHORT/LONG). - **size** (string) - Position size. - **entry_price** (string) - Entry price. #### Response Example [ { "id": "1234567890", "market": "BTC/USD-PERP", "side": "SHORT", "size": "3.00", "entry_price": "20000.00" } ] ``` -------------------------------- ### GET /api/v2/margin_tiers/ Source: https://www.bitstamp.net/api Retrieves a list of margin tiers for each derivative market. ```APIDOC ## GET /api/v2/margin_tiers/ ### Description Returns a list of Margin Tiers for each Market. ### Method GET ### Endpoint /api/v2/margin_tiers/ ### Response #### Success Response (200) - **market** (string) - Market name. - **tiers** (array) - List of margin tier configurations. #### Response Example [ { "market": "BTC/USD-PERP", "tiers": [ { "tier": "1", "size_limit_low": "0", "size_limit_high": "10000000", "max_leverage": "10", "initial_margin_rate": "10", "maintenance_margin_rate": "5", "close_out_margin_rate": "5" } ] } ] ``` -------------------------------- ### User Transactions Response Source: https://www.bitstamp.net/api Example JSON response for a user transactions query. ```json [ * { * "id": 1, * "datetime": "2022-03-01 10:54:53.849000", * "type": "1", * "fee": "0.62563", * "{from_currency}": "-1.0", * "{to_currency}": "1.0", * "{currency_pair}": 1, * "order_id": 1463489000206336, * "self_trade": true, * "self_trade_order_id": 1 } ] ``` -------------------------------- ### Instant Sell Order Response Sample Source: https://www.bitstamp.net/api This is a sample JSON response for an instant sell order. It includes details about the executed order such as ID, market, datetime, price, and amount. ```json { "subtype": "LIMIT", "id": "1234123412341234", "market": "BTC/USD", "datetime": "2022-01-31 14:43:15.796000", "type": "0", "price": "2211.00", "amount": "45.00000000", "client_order_id": "123456789", "margin_mode": "ISOLATED", "leverage": "3.1", "stop_price": "10.123", "trigger": "LAST_TRADED_PRICE", "activation_price": "10.123", "trailing_delta": 50 } ``` -------------------------------- ### GET /api/v2/travel_rule/contacts/{contact_uuid}/ Source: https://www.bitstamp.net/api Retrieve details of a specific Travel Rule contact. ```APIDOC ## GET /api/v2/travel_rule/contacts/{contact_uuid}/ ### Description Returns a specific contact previously created for Travel Rule purposes. ### Method GET ### Endpoint /api/v2/travel_rule/contacts/{contact_uuid}/ ### Parameters #### Path Parameters - **contact_uuid** (string) - Required - The UUID of the contact. ### Response #### Success Response (200) - **retail_info** (object) - Retail contact details - **corporate_info** (object) - Corporate contact details - **id** (string) - Contact UUID - **description** (string) - Contact description ``` -------------------------------- ### Get EUR/USD Conversion Rate Source: https://www.bitstamp.net/api Retrieves the current EUR/USD conversion rate. ```APIDOC ## GET /api/v2/eur_usd/ ### Description Returns the current EUR/USD conversion rate. ### Method GET ### Endpoint /api/v2/eur_usd/ ### Response #### Success Response (200) - **buy** (string) - The buy rate for EUR/USD. - **sell** (string) - The sell rate for EUR/USD. ### Response Example ```json { "buy": "16.52234567", "sell": "0.06577932" } ``` ``` -------------------------------- ### Buy instant order Source: https://www.bitstamp.net/api Opens a buy instant order. The execution depends on market conditions and may be subject to sudden changes. ```APIDOC ## POST /api/v2/buy/{market_symbol}/ ### Description Opens a buy instant order. By placing an instant order you acknowledge that the execution of your order depends on the market conditions and that these conditions may be subject to sudden changes that cannot be foreseen. This call will be executed on the account (Sub or Main), to which the used API key is bound to. ### Method POST ### Endpoint /api/v2/buy/{market_symbol}/ ### Parameters #### Path Parameters - **market_symbol** (string) - Required - The market symbol for the order (e.g., BTC/USD). #### Request Body - **amount** (number) - Required - The amount to buy. - **price** (number) - Required - The price at which to buy. ### Possible errors - **Missing amount and/or price POST parameters**: Missing one or both parameters. - **'parameter': Enter a number. Use "." as a decimal point.**: 'parameter' can only be a number. - **Minimum order size is 10 USD / 10 EUR / 10 GBP / 10 USDT / 10 USDC / 10 PAX / 10 GUSD / 0.0002 BTC / 0.002 ETH**: Order value must be at least the specified amount in the respective currency. - **You can only buy 'amount' 'currency'. Check your account balance for details.**: Account has less 'available_currency' than is required to make this order. - **Maximum market buy amount at the moment is 'amount' 'currency'. Please use limit order instead.**: Order amount exceeds the limit amount set for market buy orders. - **Order could not be placed.**: Order could not be placed (perhaps due to internal error or trade halt). Please retry placing order. ``` -------------------------------- ### GET /api/v2/transactions/{market_symbol}/ Source: https://www.bitstamp.net/api Return transaction data from a given time frame. ```APIDOC ## GET /api/v2/transactions/{market_symbol}/ ### Description Return transaction data from a given time frame. ### Method GET ### Endpoint /api/v2/transactions/{market_symbol}/ ### Parameters #### Path Parameters - **market_symbol** (string) - Required - The market symbol #### Query Parameters - **time** (string) - Optional - Time interval: "minute", "hour" (default), or "day" ### Response #### Success Response (200) - **date** (string) - Transaction date - **tid** (string) - Transaction ID - **price** (string) - Transaction price - **amount** (string) - Transaction amount - **type** (string) - Transaction type #### Response Example { "date": "1644406050", "tid": "220744838", "price": "43524.69", "amount": "0.00676053", "type": "string" } ``` -------------------------------- ### Get Leverage Settings Response Source: https://www.bitstamp.net/api This JSON array contains leverage settings for different markets. Each object includes current and maximum leverage values. ```json [ { "margin_mode": "ISOLATED", "market": "BTC/USD-PERP", "leverage_current": "1.90", "leverage_max": "1.90" } ] ```