### Curl Example: Get All Currencies Source: https://api.exchange.cryptomkt.com/index Example using curl to fetch all available currencies from the Cryptomkt API. ```curl curl "https://api.exchange.cryptomkt.com/api/3/public/currency" ``` -------------------------------- ### Spot New Order Request and Response Examples Source: https://api.exchange.cryptomkt.com/index Provides JSON examples for placing a new spot order, including the request payload, a successful response structure, and an example error response. ```json { "method": "spot_new_order", "params": { "client_order_id": "57d5525562c945448e3cbd559bd068c4", "symbol": "ETHBTC", "side": "sell", "type": "limit", "quantity": "0.015", "price": "0.059837" }, "id": 123 } ``` ```json { "jsonrpc": "2.0", "result": { "id": 583565960004, "client_order_id": "57d5525562c945448e3cbd559bd06211", "symbol": "BTCUSDT", "side": "buy", "status": "new", "type": "market", "time_in_force": "GTC", "quantity": "0.00001", "quantity_cumulative": "0", "post_only": false, "created_at": "2024-07-02T00:58:05.307Z", "updated_at": "2024-07-02T00:58:05.307Z", "report_type": "new" }, "id": 123 } ``` ```json { "error": { "code": 20001, "message": "Insufficient funds", "description": "Check that the funds are sufficient, given commissions" }, "id": 123 } ``` -------------------------------- ### Get Currency Example Response Source: https://api.exchange.cryptomkt.com/index Example JSON response when requesting details for a cryptocurrency, showing its properties and network configurations. ```json { "full_name": "test", "crypto": true, "payin_enabled": true, "payout_enabled": true, "transfer_enabled": true, "sign": "฿", "qr_prefix": "bitcointestnet:", "crypto_payment_id_name": "", "crypto_explorer": "https://blockchain.info/tx/{tx}", "precision_transfer": "1", "delisted": false, "networks": [ { "code": "test123", "network_name": "test123", "network": "test", "protocol": "test123", "default": true, "is_ens_available": true, "payin_enabled": true, "payout_enabled": true, "precision_payout": "1", "payout_fee": "0.000000000000", "payout_is_payment_id": false, "payin_payment_id": false, "payin_confirmations": 3, "is_multichain": false } ] } ``` -------------------------------- ### Get Currency Example Request Source: https://api.exchange.cryptomkt.com/index Example cURL command to fetch details for a specific cryptocurrency (e.g., BTC) from the Cryptomkt API. ```bash curl "https://api.exchange.cryptomkt.com/api/3/public/currency/BTC" ``` -------------------------------- ### Get Subaccounts List Response Examples Source: https://api.exchange.cryptomkt.com/index Example JSON responses for getting subaccounts, including success, error, and empty list scenarios. ```json { "result": [ { "sub_account_id": "179B5D", "email": "[email protected]", "status": "active" }, { "sub_account_id": "179B5E", "email": "[email protected]", "status": "active" }, { "sub_account_id": "179B5F", "email": "[email protected]", "status": "disable" } ] } ``` ```json { "error": { "code": 1002, "message": "Authorization is required or has been failed" } } ``` ```json { "result": [] } ``` -------------------------------- ### Wallet Balance Response Example (All Currencies) Source: https://api.exchange.cryptomkt.com/index Example JSON structure for wallet balances across multiple currencies, showing available and reserved amounts for each currency. ```json [ { "currency":"BTC", "available":"0.00005821", "reserved":"0.00001" }, { "currency":"USDT", "available":"0.01", "reserved":"0" } ] ``` -------------------------------- ### Get Subaccounts List Request Example Source: https://api.exchange.cryptomkt.com/index Example cURL request to fetch the list of subaccounts. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/sub-account" ``` -------------------------------- ### Wallet Balance Response Example (One Currency) Source: https://api.exchange.cryptomkt.com/index Example JSON structure for a single currency's wallet balance, detailing available and reserved amounts. ```json { "available":"0.00005821", "reserved":"0.00001" } ``` -------------------------------- ### Get Active Spot Orders Response Example Source: https://api.exchange.cryptomkt.com/index An example JSON payload representing the response from the `spot_get_orders` API method, showing a single active 'buy' limit order for BTCUSDT. ```json { "jsonrpc": "2.0", "result": [ { "id": 583502239480, "client_order_id": "9be4d950d3c04485854ec5d7f260b1e8", "symbol": "BTCUSDT", "side": "buy", "status": "new", "type": "limit", "time_in_force": "GTC", "quantity": "0.01000", "quantity_cumulative": "0", "price": "0.01", "post_only": false, "created_at": "2024-07-01T23:04:04.048Z", "updated_at": "2024-07-01T23:04:04.048Z", "report_type": "status" } ], "id": 123 } ``` -------------------------------- ### Get Amount Locks Response Example Source: https://api.exchange.cryptomkt.com/index Example JSON response for a successful retrieval of amount locks. ```json [ { "id": 1, "currency": "BTC", "amount": "12.023", "date_end": "", "description": "default", "canceled": false, "canceled_at": null, "cancel_description": null, "created_at": "2024-07-29T12:07:09.883538Z" } ] ``` -------------------------------- ### Check Offchain Availability Example Source: https://api.exchange.cryptomkt.com/index Example cURL command to call the check-offchain-available API endpoint with specific transaction details. ```bash curl \ -X POST \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/wallet/crypto/check-offchain-available" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ \ "currency": "USDT", \ "payment_id": "tTzrM83.VGqI9M-JQouxn-8IcBsn-5OAUzC", \ "address": "3A3MR43kUvahSAJtTsxzE8mcTz3VfL9upi" \ }' ``` -------------------------------- ### JSON Response Example: Get Currencies Source: https://api.exchange.cryptomkt.com/index Example JSON response structure when retrieving currency information from the Cryptomkt API. ```json { "BTC": { "full_name": "test", "crypto": true, "payin_enabled": true, "payout_enabled": true, "transfer_enabled": true, "sign": "฿", "qr_prefix": "bitcointestnet:", "crypto_payment_id_name": "", "crypto_explorer": "https://blockchain.info/tx/{tx}", "precision_transfer": "1", "delisted": false, "networks": [ { "code": "test123", "network": "test", "protocol": "test123", "default": true, "is_ens_available": true, "payin_enabled": true, "payout_enabled": true, "precision_payout": "1", "payout_fee": "0.000000000000", "payout_is_payment_id": false, "payin_payment_id": false, "payin_confirmations": 3 } ] }, "ETH": { "full_name": "Ethereum TST", "crypto": true, "payin_enabled": true, "payout_enabled": true, "transfer_enabled": true, "sign": "E", "qr_prefix": "ethereum:", "crypto_payment_id_name": "", "crypto_explorer": "https://www.etherchain.org/tx/{tx}", "precision_transfer": "0.000000000001", "delisted": false, "networks": [ { "code": "ETHTEST", "network_name": "ETHTEST", "network": "ETHTEST", "protocol": "", "default": true, "is_ens_available": true, "payin_enabled": true, "payout_enabled": true, "precision_payout": "0.000000000000000001", "payout_fee": "0.000000000000", "payout_is_payment_id": false, "payin_payment_id": false, "payin_confirmations": 2, "is_multichain": false } ] } } ``` -------------------------------- ### Fetch All Active Spot Orders (Python) Source: https://api.exchange.cryptomkt.com/index Example using Python requests library to fetch all active spot orders. ```python import requests session = requests.session() session.auth = ("apiKey", "secretKey") b = session.get('https://api.exchange.cryptomkt.com/api/3/spot/order').json() print(b) ``` -------------------------------- ### Fetch Spot Trading Balance (Python) Source: https://api.exchange.cryptomkt.com/index Example using Python requests library to fetch the user's spot trading balance. ```python import requests session = requests.session() session.auth = ("apiKey", "secretKey") b = session.get('https://api.exchange.cryptomkt.com/api/3/spot/balance').json() print(b) ``` -------------------------------- ### Fetch Spot Trading Balance (curl) Source: https://api.exchange.cryptomkt.com/index Example using curl to fetch the user's spot trading balance. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/balance" ``` -------------------------------- ### Check Offchain Availability Response Example Source: https://api.exchange.cryptomkt.com/index Example JSON response from the check-offchain-available API, indicating the availability of an offchain transaction. ```json { "result": true } ``` -------------------------------- ### Spot Orders History Response Example (JSON) Source: https://api.exchange.cryptomkt.com/index An example of the JSON array structure returned by the spot orders history API endpoint, showing details of individual orders. ```json [ { "id": 828680665, "client_order_id": "f4307c6e507e49019907c917b6d7a084", "symbol": "ETHBTC", "side": "sell", "status": "partiallyFilled", "type": "limit", "time_in_force": "GTC", "quantity": "13.942", "price": "0.011384", "price_average": "0.055487", "quantity_cumulative": "5.240", "created_at": "2024-04-16T14:18:47.321Z", "updated_at": "2024-04-19T15:23:54.876Z" }, { "id": 828680667, "client_order_id": "f4307c6e507e49019907c917b6d7a084", "symbol": "ETHBTC", "side": "sell", "status": "partiallyFilled", "type": "limit", "time_in_force": "GTC", "quantity": "13.942", "price": "0.011384", "price_average": "0.045000", "quantity_cumulative": "5.240", "created_at": "2024-04-16T14:18:50.321Z", "updated_at": "2024-04-19T15:23:56.876Z" } ] ``` -------------------------------- ### Fetch All Active Spot Orders (curl) Source: https://api.exchange.cryptomkt.com/index Example using curl to fetch all active spot orders. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/order" ``` -------------------------------- ### Whitelisted Addresses Response Example Source: https://api.exchange.cryptomkt.com/index Example JSON structure for whitelisted addresses, including address, currency, name, and network details. ```json { "addresses": [ { "address": "3A3MR43kUvahSAJtTsxzE8mcTz3VfL9upi", "currency": "USDT", "name": "ETH withdrawal", "network": "ETH" } ] } ``` -------------------------------- ### Freeze Subaccount Response Examples Source: https://api.exchange.cryptomkt.com/index Example JSON responses for freezing subaccounts, showing success and error cases. ```json { "result": true } ``` ```json { "error": { "code": 21003, "message": "Sub account is already frozen or disabled" } } ``` -------------------------------- ### Example Order Data Source: https://api.exchange.cryptomkt.com/index Represents a list of cryptocurrency orders with various details like symbol, side, status, and pricing. ```json [ { "time_in_force": "GTC", "quantity": "0.063", "price": "0.046016", "quantity_cumulative": "0.000", "post_only": false, "order_list_id": "d8574207d9e3b16a4a5511753eeef175", "contingency_type": "oneTriggerOneCancelOther", "created_at": "2024-04-15T17:01:05.092Z", "updated_at": "2024-04-15T17:01:05.092Z" }, { "id": 840450211, "client_order_id": "2723cdfba2d609b621d5d055e3ef9be2", "symbol": "ETHBTC", "side": "sell", "status": "new", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.050000", "quantity_cumulative": "0.000", "post_only": false, "inactive": true, "order_list_id": "d8574207d9e3b16a4a5511753eeef175", "contingency_type": "oneTriggerOneCancelOther", "created_at": "2024-04-15T17:01:05.092Z", "updated_at": "2024-04-15T17:01:05.092Z" }, { "id": 840450211, "client_order_id": "a53406ea49e160c63b620ca21e9fb634", "symbol": "ETHBTC", "side": "sell", "status": "suspended", "type": "stopMarket", "time_in_force": "GTC", "quantity": "0.063", "stop_price": "0.044050", "quantity_cumulative": "0.000", "post_only": false, "inactive": true, "order_list_id": "d8574207d9e3b16a4a5511753eeef175", "contingency_type": "oneTriggerOneCancelOther", "created_at": "2024-04-15T17:01:05.092Z", "updated_at": "2024-04-15T17:01:05.092Z" } ] ``` -------------------------------- ### Spot Trades History Response Example Source: https://api.exchange.cryptomkt.com/index Example JSON structure for spot trade history, detailing individual trades with information such as ID, symbol, side, quantity, price, and timestamp. ```json [ { "id": 9535486, "order_id": 816088377, "client_order_id": "f8dbaab336d44d5ba3ff578098a68454", "symbol": "ETHBTC", "side": "sell", "quantity": "0.061", "price": "0.045487", "fee": "0.000002775", "timestamp": "2024-04-17T12:32:57.848Z", "taker": true }, { "id": 9535437, "order_id": 816088021, "client_order_id": "27b9bfc068b44194b1f453c7af511ed6", "symbol": "ETHBTC", "side": "buy", "quantity": "0.038", "price": "0.046000", "fee": "-0.000000174", "timestamp": "2024-04-17T12:30:57.848Z", "taker": true } ] ``` -------------------------------- ### Basic Authentication Examples Source: https://api.exchange.cryptomkt.com/v2 Demonstrates how to authenticate API requests using Basic Authentication with different programming languages. API keys are required for authenticated endpoints. ```curl curl \ -u "publicKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/2/trading/balance" ``` ```python import requests session = requests.session() session.auth = ("publicKey", "secretKey") # Example usage: # response = session.get("https://api.exchange.cryptomkt.com/api/2/trading/balance") # print(response.json()) ``` ```javascript const fetch = require('node-fetch'); const credentials = Buffer.from('publicKey' + ':' + 'secretKey').toString('base64'); fetch('https://api.exchange.cryptomkt.com/api/2/trading/balance', { method: 'GET', headers: { 'Authorization': 'Basic ' + credentials } }).then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Create Spot Order using cURL Source: https://api.exchange.cryptomkt.com/index Example of creating a new spot order using the cURL command-line tool. It demonstrates the POST request with authentication and order details. ```curl curl \ -X POST \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/order" \ -d "symbol=ETHBTC&side=sell&quantity=0.063&price=0.046016" ``` -------------------------------- ### Get Amount Locks Request Example Source: https://api.exchange.cryptomkt.com/index Example cURL request to fetch amount locks for Bitcoin (BTC). ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/wallet/amount-locks?currency=BTC" ``` -------------------------------- ### Place OTO Spot Orders with Python Source: https://api.exchange.cryptomkt.com/index Demonstrates how to place One-Trigger-Other (OTO) spot orders using the Python `requests` library. It shows setting up authentication, headers, and sending the order payload to the API. ```Python import requests session = requests.session() session.auth = ("apiKey", "secretKey") headers = {'Content-Type': 'application/json'} orderData = '{"contingency_type": "oneTriggerOther", "orders": [{"client_order_id": "d8574207d9e3b16a4a5511753eeef175", "symbol": "ETHBTC", "side": "buy", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.046016", "post_only": false}, {"client_order_id": "a53406ea49e160c63b620ca21e9fb634", "symbol": "ETHBTC", "side": "sell", "type": "stopMarket", "time_in_force": "GTC", "quantity": "0.063", "stop_price": "0.044050", "post_only": false}]}' r = session.post('https://api.exchange.cryptomkt.com/api/3/spot/order/list', data = orderData, headers=headers) print(r.json()) ``` -------------------------------- ### Get Transactions History Response Example Source: https://api.exchange.cryptomkt.com/index Example JSON structure for a successful response when fetching transaction history. It includes details like transaction ID, status, type, and native transaction information. ```json [ { "id": 50844835, "created_at": "2024-04-22T21:03:04.111Z", "updated_at": "2024-04-22T21:04:41.487Z", "last_activity_at": "2024-04-30T15:42:12.274495Z", "status": "SUCCESS", "type": "WITHDRAW", "subtype": "BLOCKCHAIN", "native": { "tx_id": "27fa7f14-ca49-42fd-834a-4ce630d069d2", "index": 1071885589, "currency": "ETH", "amount": "0.01042", "fee": "0.00958", "hash": "0xfb0ba568213d11230cd34d62fddd1cc1fe11fdc173l4f2007b0e47a06ad73d20", "address": "0xd959463c3fcb222124bb7bb642d6a6573a6c5aba", "confirmations": 20 } }, { "id": 36896428, "created_at": "2024-04-12T10:27:26.135Z", "updated_at": "2024-04-12T10:42:29.065Z", "last_activity_at": "2024-04-30T15:42:13.274495Z", "status": "SUCCESS", "type": "DEPOSIT", "subtype": "BLOCKCHAIN", "native": { "tx_id": "a271ad64-5f34-4115-a63e-1cb5bbe4f67e", "index": 429625504, "currency": "BTC", "amount": "0.04836614", "hash": "4d7ae7c9d6fe84405ae167b3f0beacx8c68eb5a9d5189bckeb65d5e306427oe6", "address": "3E8WKmTJzaTsBc4kvuEJVjPNtak6vQRcRv", "confirmations": 2, "senders": [ "0xd959463c3fcb0d2124bb7ac642d6a6573a6c5aba" ] }, "operation_id": "99e78bf4-a708-43a3-ab18-e8e7618cd891" } ] ``` -------------------------------- ### Create Spot Order using Python (requests) Source: https://api.exchange.cryptomkt.com/index Python script using the 'requests' library to create a new spot order. It shows how to set up authentication and send order data in a POST request. ```python import requests session = requests.session() session.auth = ("apiKey", "secretKey") orderData = {'symbol':'ETHBTC', 'side': 'sell', 'quantity': '0.063', 'price': '0.046016' } r = session.post('https://api.exchange.cryptomkt.com/api/3/spot/order/', data = orderData) print(r.json()) ``` -------------------------------- ### Get Subaccounts List Source: https://api.exchange.cryptomkt.com/v2 Retrieves a list of all subaccounts associated with a super account. Includes example success, error, and empty list responses. ```curl curl \ -u "publicKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/2/sub-acc" ``` ```APIDOC GET /api/2/sub-acc Returns list of subaccounts per a super account. Requires no API key Access Rights. Responses: | Name | Type | Description | | --- | --- | | `id` | Number | Unique identifier of a subaccount. | | `email` | String | Email address of a subaccount. | | `status` | String | User status of a subaccount. Accepted values: `new`, `active`, `disable`. | Example Success Response: ```json { "result": [ {"id": 7988900, "email": "[email protected]", "status": "active"}, {"id": 7988906, "email": "[email protected]", "status": "active"}, {"id": 7988909, "email": "[email protected]", "status": "disable"}, {"id": 7988918, "email": "[email protected]", "status": "disable"}, {"id": 7988921, "email": "[email protected]", "status": "disable"}, {"id": 7989017, "email": "[email protected]", "status": "new"}, {"id": 8001467, "email": "[email protected]", "status": "new"} ] } ``` Example Error Response: ```json { "error": { "code": 1002, "message": "Authorization is required or has been failed" } } ``` Example Empty Subaccount List: ```json { "result": [] } ``` ``` -------------------------------- ### Place OTOCO Spot Orders with cURL Source: https://api.exchange.cryptomkt.com/index Shows how to place One-Trigger-One-Cancel-Other (OTOCO) spot orders via cURL. This command-line example includes authentication and the necessary JSON payload for the API. ```shell curl \ -X POST \ -H 'Content-Type: application/json' \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/order/list" \ -d '{ \ "order_list_id": "d8574207d9e3b16a4a5511753eeef175", \ "contingency_type": "oneTriggerOneCancelOther", \ "orders": [ \ { \ "client_order_id": "d8574207d9e3b16a4a5511753eeef175", \ "symbol": "ETHBTC", \ "side": "buy", \ "type": "limit", \ "time_in_force": "GTC", \ "quantity": "0.063", \ "price": "0.046016", \ "post_only": false \ }, \ { \ "client_order_id": "2723cdfba2d609b621d5d055e3ef9be2", \ "symbol": "ETHBTC", \ "side": "sell", \ "type": "limit", \ "time_in_force": "GTC", \ "quantity": "0.063", \ "price": "0.050000", \ "post_only": false \ }, \ { \ "client_order_id": "a53406ea49e160c63b620ca21e9fb634", \ "symbol": "ETHBTC", \ "side": "sell", \ "type": "stopMarket", \ "time_in_force": "GTC", \ "quantity": "0.063", \ "stop_price": "0.044050", \ "post_only": false \ } \ ] \ }' ``` -------------------------------- ### Get Active Subscriptions Source: https://api.exchange.cryptomkt.com/index Shows how to request a list of all currently active subscriptions on a specified channel. Includes example request and response payloads. ```json { "method": "subscriptions", "ch": "trades", "params": { "symbols": [ "ETHBTC", "BTCUSDT" ] }, "id": 123 } ``` ```json { "result": { "ch": "trades", "subscriptions": [ "ETHBTC", "BTCUSDT" ] }, "id": 123 } ``` -------------------------------- ### Create Order via Python Requests Source: https://api.exchange.cryptomkt.com/v2 Example of creating a new order using the Python requests library. It demonstrates setting up a session with authentication and sending a POST request with order data. ```python import requests session = requests.session() session.auth = ("publicKey", "secretKey") orderData = {'symbol':'ethbtc', 'side': 'sell', 'quantity': '0.063', 'price': '0.046016' } r = session.post('https://api.exchange.cryptomkt.com/api/2/order', data = orderData) print(r.json()) ``` -------------------------------- ### Get Spot Orders History (cURL) Source: https://api.exchange.cryptomkt.com/index Example cURL command to fetch historical spot orders for a specific symbol. Requires API key authentication. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/history/order?symbol=ETHBTC" ``` -------------------------------- ### Get Transactions History (curl) Source: https://api.exchange.cryptomkt.com/index Example cURL command to fetch transaction history, specifying currencies and sort order. Authentication is done via API key and secret. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/wallet/transactions?currencies=ETH,BTC&sort=DESC" ``` -------------------------------- ### CryptoMarket API Best Practices Source: https://api.exchange.cryptomkt.com/index Provides guidance on efficient API usage, including parameter passing and leveraging HTTP persistent connections. ```APIDOC BEST PRACTICES: Request Parameters: - Pass request payload (body) in POST requests and query parameters in GET requests. - Parameter passing must adhere strictly to documentation. HTTP Persistent Connection: - TCP connection is kept active for multiple requests, reducing latency. - For HTTP 1.0 clients, ensure Keep-Alive directive and 'Connection: Keep-Alive' header are used. - HTTP/1.1 and HTTP/2 enable Keep-Alive by default; ensure no other Connection header values are set. Retrieving and Updating Account State: - Use the Streaming API for real-time updates of orders, trades, and transactions. ``` -------------------------------- ### Get Transaction History (curl) Source: https://api.exchange.cryptomkt.com/v2 Example using curl to fetch transaction history from the Cryptomkt API. It demonstrates authentication, endpoint usage, and query parameters like currency and sort order. ```curl curl \ -u "publicKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/2/account/transactions?currency=ETH&sort=DESC" ``` -------------------------------- ### Get Trading Balance using Python requests Source: https://api.exchange.cryptomkt.com/v2 Retrieves the user's trading balance from the Cryptomkt API using Python's requests library. This example shows how to set up a session with basic authentication credentials. ```python import requests session = requests.session() session.auth = ("publicKey", "secretKey") b = session.get('https://api.exchange.cryptomkt.com/api/2/trading/balance').json() print(b) ``` -------------------------------- ### Create AON Spot Order List (Python) Source: https://api.exchange.cryptomkt.com/index Shows how to create an All-or-None (AON) spot order list using the cryptomkt.com API with Python's requests library. It covers session setup, authentication, headers, and sending the POST request with the order data. ```python import requests session = requests.session() session.auth = ("apiKey", "secretKey") headers = {'Content-Type': 'application/json'} orderData = '{"contingency_type": "allOrNone", "orders": [{"symbol": "ETHBTC", "side": "sell", "quantity": "0.063", "type": "market", "time_in_force": "FOK"}, {"symbol": "BTCUSDT", "side": "sell", "quantity": "0.057", "type": "market", "time_in_force": "FOK"}]}' r = session.post('https://api.exchange.cryptomkt.com/api/3/spot/order/list', data = orderData, headers=headers) print(r.json()) ``` -------------------------------- ### Freeze Subaccount Request Example Source: https://api.exchange.cryptomkt.com/index Example cURL request to freeze multiple subaccounts. ```curl curl \ -X POST \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/sub-account/freeze" \ -d "sub_account_ids=179B5D,179B5E" ``` -------------------------------- ### Create OCO Spot Order List (Python) Source: https://api.exchange.cryptomkt.com/index Demonstrates creating a One-Cancel-Other (OCO) spot order list using the cryptomkt.com API with Python's requests library. It includes setting up the session, authentication, headers, and sending the POST request with the OCO order data. ```python import requests session = requests.session() session.auth = ("apiKey", "secretKey") headers = {'Content-Type': 'application/json'} orderData = '{"contingency_type": "oneCancelOther", "orders": [{"client_order_id": "d8574207d9e3b16a4a5511753eeef175", "symbol": "ETHBTC", "side": "buy", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.046016", "post_only": false}, {"client_order_id": "a53406ea49e160c63b620ca21e9fb634", "symbol": "ETHBTC", "side": "sell", "type": "stopMarket", "time_in_force": "GTC", "quantity": "0.063", "stop_price": "0.044050", "post_only": false}]}' r = session.post('https://api.exchange.cryptomkt.com/api/3/spot/order/list', data = orderData, headers=headers) print(r.json()) ``` -------------------------------- ### Get All Trading Commissions using cURL Source: https://api.exchange.cryptomkt.com/index Shows how to retrieve personal trading commission rates for all trading symbols using a cURL GET request. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/fee" ``` -------------------------------- ### POST /api/3/spot/order/list - Create Spot Order List Source: https://api.exchange.cryptomkt.com/index Creates a new spot order list, allowing for complex order strategies like OCO or OTOCO. Requires specific API key access rights. ```APIDOC POST /api/3/spot/order/list Creates a new spot order list. Requires the "Place/cancel orders" API key Access Right. Parameters: | Name | Type | Description | | --- | --- | --- | | `order_list_id` | String | Order list identifier. If omitted, it will be generated by the system upon order list creation. Must be equal to `client_order_id` of the first order in the request. | | `contingency_type` | String | Order list type. Accepted values: `allOrNone` (AON) — all orders in the set should be executed within a single transaction or become expired otherwise; `oneCancelOther` (OCO) — all orders in the set should be canceled if one of them was executed; `oneTriggerOther` (OTO) — execution of the first (primary) order on the list activates other (secondary) orders as independent of each other; `oneTriggerOneCancelOther` (OTOCO) — the execution of the first (primary) order on the list activates the other (secondary) orders as an OCO order list. | | `orders` | []Order | Orders in the list. There must be 2 or 3 orders for `allOrNone`/`oneCancelOther`/`oneTriggerOther` and 3 — for `oneTriggerOneCancelOther`. Placing any other number of orders will result in an error. | Order model consists of: | Name | Type | Description | | --- | --- | --- | | `client_order_id` | String | Optional. Must be different from the identifiers of other orders in the list. If omitted, it will be generated by the system upon order list creation. Uniqueness must be guaranteed until the last order with the same `client_order_id` becomes inactive (canceled, expired, or fully executed) and some time after that. | | `symbol` | String | Symbol code. For a `allOrNone` order list, symbol code must be unique for each order in the list. For an `oneTriggerOneCancelOther` order list, symbol code must be the same for all orders in the list (placing orders in different order books is not supported). | | `side` | String | Trade side. Accepted values: `sell`, `buy` | | `type` | String | Optional. Order type. Accepted values: for `allOrNone` — `limit`, `market`; for `oneCancelOther` (and secondary orders in `oneTriggerOneCancelOther`) — `limit`, `stopLimit`, `stopMarket`, `takeProfitLimit`, `takeProfitMarket`; for `oneTriggerOneCancelOther` — `limit`, `market`, `stopLimit`, `stopMarket`, `takeProfitLimit`, `takeProfitMarket`. Default value: `limit` | | `time_in_force` | String | Optional (required for `allOrNone`). Time in Force instruction. Accepted values: for `allOrNone` — `FOK`; for `oneCancelOther` (and secondary orders in `oneTriggerOneCancelOther`) — `GTC`, `IOC` (except `limit` orders), `FOK` (except `limit` orders), `Day`, `GTD`; for `oneTriggerOneCancelOther` — `GTC`, `IOC`, `FOK`, `Day`, `GTD`. | | `quantity` | Number | Order quantity. | | `price` | Number | Order price. Required if `type` is `limit`, `stopLimit`, or `takeProfitLimit`. | | `stop_price` | Number | The price level that triggers order activation. Required if `type` is `stopLimit`, `stopMarket`, `takeProfitLimit`, or `takeProfitMarket`. | | `expire_time` | DateTime | Date of order expiration. Required if `time_in_force` is `GTD`. | | `strict_validate` | Boolean | Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's `tick_size` and `quantity_increment`. | ``` -------------------------------- ### API v3 Subaccounts and Initial Release Source: https://api.exchange.cryptomkt.com/index Details the introduction of subaccounts and the initial release of API v3. ```APIDOC Major Updates: - Introduced Subaccounts section. - API v3 initial release. ``` -------------------------------- ### Place New Order API Source: https://api.exchange.cryptomkt.com/v2 Allows users to place new orders on the exchange. Supports various order types like limit, market, stopLimit, and stopMarket. Requires 'Place/cancel orders' API key access. Includes detailed parameter descriptions, request/response examples, and error handling. ```APIDOC Method: newOrder Requires the "Place/cancel orders" API key Access Right. Params: | Name | Type | Description | | --- | --- | --- | | `clientOrderId` | String | Required parameter. Uniqueness must be guaranteed within a single trading day, including all active orders. | | `symbol` | String | Trading symbol | | `side` | String | Trade side. Accepted values: `sell`, `buy` | | `type` | String | Optional parameter Accepted values: `limit`, `market`, `stopLimit`, `stopMarket` Default value: `limit` | | `timeInForce` | String | Optional parameter Accepted values: `GTC`, `IOC`, `FOK`, `Day`, `GTD` Default value: `GTC` | | `quantity` | Number | Order quantity | | `price` | Number | Order price. Required for limit types | | `stopPrice` | Number | Required for stop-limit and stop-market orders | | `expireTime` | DateTime | Required for `timeInForce` = `GTD` | | `strictValidate` | Boolean | Price and quantity will be checked for incrementation within the symbol's tick size and quantity step. See the symbol's `tickSize` and `quantityIncrement` | | `postOnly` | Boolean | A post-only order is an order that does not remove liquidity. If your post-only order causes a match with a pre-existing order as a taker, then order will be canceled. | | `closePosition` | Boolean | Flag indicating a stop market order must close a margin position when executed or be canceled otherwise. Default: `false` Conditions: `quantity` is omitted. | | `takeLiquidityMarkup` | Number | Optional liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee) | | `provideLiquidityMarkup` | Number | Optional liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee) | A report notification will arrive before the request result. ``` ```JSON { "method": "newOrder", "params": { "clientOrderId": "57d5525562c945448e3cbd559bd068c4", "symbol": "ETHBTC", "side": "sell", "price": "0.059837", "quantity": "0.015" }, "id": 123 } ``` ```JSON { "jsonrpc": "2.0", "result": { "id": "4345947689", "clientOrderId": "57d5525562c945448e3cbd559bd068c4", "symbol": "ETHBTC", "side": "sell", "status": "new", "type": "limit", "timeInForce": "GTC", "quantity": "0.001", "price": "0.093837", "cumQuantity": "0.000", "postOnly": false, "createdAt": "2017-10-20T12:29:43.166Z", "updatedAt": "2017-10-20T12:29:43.166Z", "reportType": "new" }, "id": 123 } ``` ```JSON { "jsonrpc": "2.0", "error": { "code": 20001, "message": "Insufficient funds", "description": "Check that the funds are sufficient, given commissions" }, "id": 123 } ``` -------------------------------- ### Get Spot Trades History Source: https://api.exchange.cryptomkt.com/index Retrieves historical spot trading data for a specified symbol using a GET request. Requires API key authentication. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/history/trade?symbol=ETHBTC" ``` -------------------------------- ### Place OTO Spot Orders with cURL Source: https://api.exchange.cryptomkt.com/index Provides a cURL command to place One-Trigger-Other (OTO) spot orders. This example illustrates the HTTP POST request with authentication and JSON payload for the API. ```shell curl \ -X POST \ -H 'Content-Type: application/json' \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/spot/order/list" \ -d '{ \ "contingency_type": "oneTriggerOther", \ "orders": [ \ { \ "client_order_id": "d8574207d9e3b16a4a5511753eeef175", \ "symbol": "ETHBTC", \ "side": "buy", \ "type": "limit", \ "time_in_force": "GTC", \ "quantity": "0.063", \ "price": "0.046016", \ "post_only": false \ }, \ { \ "client_order_id": "a53406ea49e160c63b620ca21e9fb634", \ "symbol": "ETHBTC", \ "side": "sell", \ "type": "stopMarket", \ "time_in_force": "GTC", \ "quantity": "0.063", \ "stop_price": "0.044050", \ "post_only": false \ } \ ] \ }' ``` -------------------------------- ### API v3 Wallet Crypto Fee Estimate/Levels Endpoint Updates Source: https://api.exchange.cryptomkt.com/index Details changes to the GET /api/3/wallet/crypto/fee/estimate and GET /api/3/wallet/crypto/fee/levels endpoints, adding 'network_code' as a request parameter. ```APIDOC GET /api/3/wallet/crypto/fee/estimate - Added 'network_code' request parameter. GET /api/3/wallet/crypto/fee/levels - Added 'network_code' request parameter. ``` -------------------------------- ### Get Withdrawal Fees Hash (GET) Source: https://api.exchange.cryptomkt.com/index Retrieves a hash representing withdrawal fees. Requires API key authentication. Returns a hash value that can be used for fee-related operations. ```curl curl \ -u "apiKey:secretKey" \ "https://api.exchange.cryptomkt.com/api/3/wallet/crypto/fee/withdraw/hash" ``` ```json { "hash": "3982183395978" } ``` -------------------------------- ### Place OTOCO Spot Orders with Python Source: https://api.exchange.cryptomkt.com/index Illustrates placing One-Trigger-One-Cancel-Other (OTOCO) spot orders using Python's `requests` library. It details the request structure for contingent order placement with multiple orders. ```Python import requests session = requests.session() session.auth = ("apiKey", "secretKey") headers = {'Content-Type': 'application/json'} orderData = '{"contingency_type": "oneTriggerOneCancelOther", "orders": [{"client_order_id": "d8574207d9e3b16a4a5511753eeef175", "symbol": "ETHBTC", "side": "buy", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.046016", "post_only": false}, {"client_order_id": "2723cdfba2d609b621d5d055e3ef9be2", "symbol": "ETHBTC", "side": "sell", "type": "limit", "time_in_force": "GTC", "quantity": "0.063", "price": "0.050000", "post_only": false}, {"client_order_id": "a53406ea49e160c63b620ca21e9fb634", "symbol": "ETHBTC", "side": "sell", "type": "stopMarket", "time_in_force": "GTC", "quantity": "0.063", "stop_price": "0.044050", "post_only": false}]}' r = session.post('https://api.exchange.cryptomkt.com/api/3/spot/order/list', data = orderData, headers=headers) print(r.json()) ```