Introduction
In this document, we outline the key components of our system, including its architecture, deployment strategies with Kubernetes and Helm, and security practices using Ed25519 for request signing. We also cover infrastructure management with Rancher, integration of third-party services, and documentation standards with Slate. This guide serves as a comprehensive resource for understanding and effectively managing our system from deployment to maintenance.
Authentication for HTTP APIs
Function for generating the signature
import json
import time
import ed25519
import hashlib
def sign(private_key_hex, message):
"""
Sign the given message with the provided Ed25519 private key.
:param private_key_hex: Hexadecimal private key string
:param message: Message string to sign
:return: Hexadecimal signature string
"""
# Convert private key from hex to bytes and create signing key
private_key_bytes = bytes.fromhex(private_key_hex)
signing_key = ed25519.SigningKey(private_key_bytes)
# Sign the message
signature = signing_key.sign(message.encode('utf-8'))
# Return the signature as a hexadecimal string
return signature.hex()
def gen_sign(secret_key, method, url, body):
"""
Generate the signature and timestamp for the message.
:param secret_key: Private key in hex format
:param method: HTTP method (GET, POST, etc.)
:param url: API URL path
:param body: JSON string for the request body
:return: Dictionary containing the timestamp and signature
"""
# Convert body JSON string to dictionary
if not body:
body = "{}"
try:
body_dict = json.loads(body)
except json.JSONDecodeError as e:
raise ValueError(f"Invalid body format: {e}")
# Convert the dictionary back to JSON string with sorted keys
input_body = json.dumps(body_dict, separators=(',', ':'), sort_keys=True)
# Generate the timestamp
timestamp = str(int(time.time()))
# Create the message to sign
message = timestamp + method + url + input_body
# Generate the signature
signature = sign(secret_key, message)
return {
"Timestamp": timestamp,
"Signature": signature
}
Usage in API Call:
import requests
import time
params = {
"count": 20,
"from_time": 1600261657954,
"to_time": 1687261657954,
"side": "sell",
"symbols": "btc/inr,eth/inr",
"exchanges": "coinswitchx,wazirx",
"type": "limit",
"open": True
}
endpoint = "/api/v2/orders"
method = "GET"
payload = {}
# Provided by CoinSwitch
secret_key = "<secret_key>"
api_key = "<api_key>"
# Generate the signature
signature = gen_sign(secret_key, method, endpoint, params)
# Final URL and headers
url = "https://coinswitch.co" + endpoint
headers = {
'Content-Type': 'application/json',
'X-AUTH-SIGNATURE': signature,
'X-AUTH-APIKEY': api_key,
'X-AUTH-EPOCH': epoch_time
}
# API call
response = requests.request("GET", url, headers=headers, json=payload)
We use asymmetric encryption keys (public-private key pair) for user authentication and payload verification. The procedure for calling authenticated APIs is as follows:
- During onboarding, you will be provided with a pair of keys, referred to here as
public_key
andprivate_key
. Theprivate_key
is secret (similar to a password) and must be stored and shared with caution.
Request Headers for Authenticated APIs
To securely access CoinSwitch APIs, you must generate a signature and include it in the headers of each API call.
- CSX-ACCESS-KEY: Your
public_key
. - CSX-SIGNATURE: Request signature. Signature generation process is mentioned below.
- CSX-ACCESS-TIMESTAMP: Current timestamp in epoch seconds.
- X-Forwarded-For: Your (caller’s) whitelisted IP.
Request Signature Generation
In an asymmetric encryption scheme, one party can generate a signature (random string) from a message using the private_key
(from a public-private key pair). The message and the signature are passed to the other party, i.e., the CSX server. The CSX server will verify the sanctity of the message using the public_key
.
Note: CSX servers will store your public_key
, but NOT your private_key
.
Use your private_key
to sign the request as follows:
Message Formation: To generate the message for signing, you need to concatenate specific components
Current Timestamp
: The epoch time in milliseconds.HTTP Method
: The HTTP method (e.g., GET, POST, DELETE).URL Path
: The API endpoint with query parameters, if any.Request Body
: The request body in JSON format.
Example Message Format:<epoch_time><HTTP_method><url_path_with_query_params><request_body>
Profile APIs
GET /v1/me/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/me/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Send the GET request
response = requests.get(url, headers=headers)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/me/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Send the GET request
axios.get(url, { headers })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"info": {
"message": "Broker fetched successfully"
},
"brokerID": "6eeb8ad8-xxx-xxxx-xxxx-9ee139fb8b65",
"userName": "LeverageTestXYZ",
"walletAddress": [
{
"instrument": "btc",
"address": "bcxxxxxxxxxxyerp4krv8z0wmmvz7xvrews7e3ngmr"
}
]
},
"message": "Broker fetched successfully"
}
Summary: Retrieve profile details such as name, email, address, etc., that were submitted during registration.
Description: This endpoint returns the profile details of the user. The request must include valid authentication headers.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
GET /v1/me/orders/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/me/orders/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Query parameters
params = {
'onlyOpen': 'false',
'type': 'LIMIT',
'status': 'in:CANCELLED',
'side': 'in:BUY'
'count': 1
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/me/orders/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Query parameters
const params = {
onlyOpen: 'false',
type: 'LIMIT',
status: 'in:CANCELLED',
side: 'in:BUY',
count: 1
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": [
{
"averagePrice": "0",
"brokerId": "6eeb8ad8-xxxx-xxxx-xxxx-9ee139fb8b65",
"cancelledQuantity": "65000",
"clientOrderId": "",
"createdAt": "1718279799",
"filledQuantity": "0",
"filledQuoteQuantity": "0",
"instrument": "SHIB/INR",
"limitPrice": "0.00095",
"makerFee": "0.07",
"orderId": "d4b97f12-xxxx-xxxx-xxxx-a7c9e83ffd72",
"quantity": "65000",
"side": "BUY",
"status": "CANCELLED",
"takerFee": "0.07",
"tdsPerc": "0",
"updatedAt": "1720629757"
}
],
"message": "Orders fetched successfully"
}
Summary: Get all Orders
Description: Retrieve all orders created till date. The request requires valid authentication headers and supports various query parameters for filtering and sorting the orders.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
onlyOpen |
Query | String | Yes | Filter to include only open orders. |
type |
Query | String | Yes | Filter by the type of order. |
sort |
Query | String | No | Sorting criteria in the format key1:asc,key2:desc,key3:asc . |
instrument |
Query | String | No | Filter by instrument, supporting operations like in , nin , neq , gt , gte , lt , lte . |
created_at |
Query | String | No | Filter by creation date, supporting operations like in , nin , neq , gt , gte , lt , lte . |
updated_at |
Query | String | No | Filter by last update date, supporting operations like in , nin , neq , gt , gte , lt , lte . |
status |
Query | String | No | Filter by status, supporting operations like in , nin , neq , gt , gte , lt , lte . |
side |
Query | String | No | Filter by side of the order, supporting operations like in , nin , neq , gt , gte , lt , lte . |
count |
Query | String | No | Number of orders to return. |
- Usage for operations (in, nin, neq, gt, gte, lt, and lte.):-
?foo=in:a,bc,d
OR?foo=buzz&baz=quux
OR?size=gt:8
OR?created_at=gte:15:30&created_at=lt:16:00
in | CONTAINS |
nin | Does not CONTAIN |
neq | NOT EQUALS |
gt | GREATER THAN |
gte | GREATER THAN EQUAL TO |
lt | LESS THAN |
lte | LESS THAN EQUAL TO |
GET /v2/me/orders/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/me/orders/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Query parameters
params = {
'onlyOpen': 'false',
'type': 'LIMIT',
'status': 'in:CANCELLED',
'side': 'in:BUY'
'count': 1,
'cursor': 1724990006116
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/me/orders/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Query parameters
const params = {
onlyOpen: 'false',
type: 'LIMIT',
status: 'in:CANCELLED',
side: 'in:BUY',
count: 1,
cursor: 1724990006116
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"cursor": "1718279799454",
"orders": [
{
"averagePrice": "0",
"brokerId": "6eeb8ad8-xxxx-xxxx-xxxx-9ee139fb8b65",
"cancelledQuantity": "65000",
"clientOrderId": "",
"createdAt": "1718279799",
"filledQuantity": "0",
"filledQuoteQuantity": "0",
"instrument": "SHIB/INR",
"limitPrice": "0.00095",
"makerFee": "0.07",
"orderId": "d4b97f12-xxxx-xxxx-xxxx-a7c9e83ffd72",
"quantity": "65000",
"side": "BUY",
"status": "CANCELLED",
"takerFee": "0.07",
"tdsPerc": "0",
"updatedAt": "1720629757"
}
]
},
"message": "Orders fetched successfully"
}
Summary: Get all Orders
Description: Retrieve all orders created till date. The request requires valid authentication headers and supports various query parameters for filtering and sorting the orders.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
onlyOpen |
Query | String | Yes | Filter to include only open orders. |
type |
Query | String | Yes | Filter by the type of order. |
sort |
Query | String | No | Sorting criteria in the format key1:asc,key2:desc,key3:asc . |
instrument |
Query | String | No | Filter by instrument, supporting operations like in , nin , neq , gt , gte , lt , lte . |
created_at |
Query | String | No | Filter by creation date, supporting operations like in , nin , neq , gt , gte , lt , lte . |
updated_at |
Query | String | No | Filter by last update date, supporting operations like in , nin , neq , gt , gte , lt , lte . |
status |
Query | String | No | Filter by status, supporting operations like in , nin , neq , gt , gte , lt , lte . |
side |
Query | String | No | Filter by side of the order, supporting operations like in , nin , neq , gt , gte , lt , lte . |
count |
Query | String | No | Number of orders to return. |
cursor |
Query | String | No | send cursor from previous page response to get next elements. |
- Usage for operations (in, nin, neq, gt, gte, lt, and lte.):-
?foo=in:a,bc,d
OR?foo=buzz&baz=quux
OR?size=gt:8
OR?created_at=gte:15:30&created_at=lt:16:00
in | CONTAINS |
nin | Does not CONTAIN |
neq | NOT EQUALS |
gt | GREATER THAN |
gte | GREATER THAN EQUAL TO |
lt | LESS THAN |
lte | LESS THAN EQUAL TO |
GET /v1/me/balance/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/me/balance/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Query parameters
params = {
'asset': 'btc' # Replace 'btc' with the asset you want to query
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/me/balance/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Query parameters
const params = {
asset: 'btc' // Replace 'btc' with the asset you want to query
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"balance": "0.000040"
},
"message": "Balance fetched successfully"
}
Summary: Get balance for an asset
Description: Retrieve the balance for a specific asset. The request requires valid authentication headers and specifies the asset as a query parameter.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
asset |
Query | String | Yes | Name of the asset for which the balance is requested. |
GET /v2/me/balance/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v2/me/balance/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Query parameters
params = {
'asset': 'inr' # Replace 'inr' with the asset you want to query
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v2/me/balance/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Query parameters
const params = {
asset: 'inr' // Replace 'inr' with the asset you want to query
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"Available": {
"btc": "2.00030000",
"eth": "858.17420000",
"inr": "136351.83000000",
"shib": "100000000.00000000",
"usdt": "63.05488000"
},
"Locked": {
"btc": "0.00000000",
"eth": "141.80000000",
"inr": "8352.33000000"
}
},
"message": "Balance fetched successfully"
}
Summary: Get balance for an asset or all the assets
Description: Retrieve the balance for a specific asset or all the assets. The request requires valid authentication headers and specifies the asset as a query parameter.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
asset |
Query | String | No | Name of the asset for which the balance is requested. (If not provided, balance for all the assets will be returned) |
GET /v2/me/deposit
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v2/me/deposit/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Query parameters
params = {
'TxnHash': 'your_transaction_hash' # Replace with the actual transaction hash
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v2/me/deposit/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Query parameters
const params = {
TxnHash: 'your_transaction_hash' // Replace with the actual transaction hash
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"Error": null,
"Fetched": {
"51113-77b0-test-eth-18ca67428test12": "Fund deposited, Use Get balance api to fetch balance"
}
},
"message": "success"
}
Summary: Verify if a transaction is deposited or not.
Description: This endpoint checks the deposit status of a transaction for a given asset. The request must include valid authentication headers.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
TxnHash |
Query | String | Yes | The transaction hash of the deposit to verify. |
POST /v1/me/withdrawal
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/me/withdrawal"
url = f"{base_url}{endpoint}"
# Headers
headers = {
'Content-Type': 'application/json'
}
# Request body
data = {
'assetName': 'btc',
'chain': 'BTC',
'amount': 0.5,
'address': '1A1zP1xxxxMPTfTL5SLmv7DivfNa',
'subAddress': 'some_sub_address'
}
# Send the POST request
response = requests.post(url, headers=headers, json=data)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/me/withdrawal';
const url = `${baseUrl}${endpoint}`;
// Headers
const headers = {
'Content-Type': 'application/json'
};
// Request body
const data = {
assetName: 'btc',
chain: 'BTC',
amount: 0.5,
address: '1A1zP1xxxxMPTfTL5SLmv7DivfNa',
subAddress: 'some_sub_address'
};
// Send the POST request
axios.post(url, data, { headers })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"message": "Withdrawal request processed successfully. Request ID: 08875d18-0ecb-418c-b6d0-d3b6cd737516",
}
Summary: Initiate a request to withdraw funds.
Description: This endpoint allows you to initiate a withdrawal request. You need to provide details about the asset, the blockchain chain, the amount to withdraw, and the withdrawal address.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
assetName |
Body | String | Yes | The name of the asset to withdraw. |
chain |
Body | String | Yes | The blockchain chain for the asset. |
amount |
Body | number | Yes | The amount of the asset to withdraw. |
address |
Body | String | Yes | The withdrawal address. |
subAddress |
Body | String | Yes | Additional address details. |
GET /v1/master/me/NAV/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/master/me/NAV/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Query parameters
params = {
'asset': 'btc' # Replace 'bitcoin' with the asset you want to query
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/master/me/NAV/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Query parameters
const params = {
asset: 'btc' // Replace 'bitcoin' with the asset you want to query
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"info": {
"message": "NAV fetched succesfully"
},
"netAssetValue": "5382061253113.9026922",
"assetValueMap": {
"btc": {
"assetQuantity": "1000000",
"assetValueINR": "5162847800000",
"assetPrice": "5162847.8"
},
"eth": {
"assetQuantity": "1000000.006",
"assetValueINR": "219210450015.2626922",
"assetPrice": "219210.4487"
},
"inr": {
"assetQuantity": "3003098.64",
"assetValueINR": "3003098.64",
"assetPrice": "1"
}
}
},
"message": "Net asset value fetched successfully"
}
Summary: Get the net asset value (NAV) for a master account.
Description: This endpoint retrieves the net asset value for a given master account. You can specify an asset to get its NAV. The request must include valid authentication headers.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
asset |
Query | String | No | The name of the asset to get the NAV for. If not specified, it may return NAV for all assets. |
GET /v1/master/me/getBalance/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/master/me/getBalance/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Query parameters
params = {
'asset': 'btc' # Replace 'bitcoin' with the asset you want to query
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/master/me/getBalance/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Query parameters
const params = {
asset: 'bitcoin' // Replace 'bitcoin' with the asset you want to query
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"Available": {
"btc": "499999.99994000",
"eth": "500000.00000000"
},
"Locked": null
},
"message": "Balance fetched successfully"
}
Summary: Get the balance for all assets or a specific asset in a master account.
Description: This endpoint retrieves the balance for all assets or a specific asset in a master account. You can specify an asset to get its balance. If no asset is specified, it will return the balance for all assets. The request must include valid authentication headers.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
asset |
Query | String | No | The name of the asset to get the balance for. If not specified, it returns the balance for all assets. |
POST /v1/master/me/transferFunds
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v1/master/me/transferFunds"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Request body
data = {
"toID": "brokerAccount456",
"fromID": "masterAccount123",
"assetName": "USD",
"amount": "1000.50"
}
# Send the POST request
response = requests.post(url, headers=headers, json=data)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v1/master/me/transferFunds';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Request body
const data = {
toID: 'brokerAccount456',
fromID: 'masterAccount123',
assetName: 'USD',
amount: '1000.50'
};
// Send the POST request
axios.post(url, data, { headers })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"message": "Transferred funds successfully from masterAcc to broker"
}
Summary: Transfer funds from broker/master to master/broker.
Description: Transfer funds from broker/master to master/broker
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
toID |
Body | String | Yes | Broker/Master ID to which the funds are being transferred. |
fromID |
Body | String | Yes | Broker/Master ID from which the funds are being transferred. |
assetName |
Body | String | Yes | The asset being transferred. |
amount |
Body | String | Yes | The amount of the asset to be transferred. |
Order APIs
POST /v2/orders/
import requests
# Base URL
base_url = BASE_URL
# Endpoint
endpoint = "api/v2/orders/"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Request body for Limit order
data = {
"type": "LIMIT",
"side": "BUY",
"instrument": "BTC/INR",
"quantityType": "QUOTE",
"quantity": "60.5",
"bestQuantityType": "BASE",
"bestQuantity": "60.5",
"limitPrice": "11.009",
"username": "user123",
"postOnly": False,
"tdsDeducted": False,
"clientOrderId": "client123"
}
# Request body for Market order
# {
# "type": "MARKET",
# "side": "SELL",
# "instrument": "BTC/INR",
# "quantityType": "BASE",
# "quantity": "2.0",
# "bestQuantityType": "QUOTE",
# "bestQuantity": "58,000",
# "username": "user123"
# }
# Send the POST request
response = requests.post(url, headers=headers, json=data)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const endpoint = 'api/v2/orders/';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Request body for Limit order
const data = {
type: 'LIMIT',
side: 'BUY',
instrument: 'BTC/INR',
quantityType: 'QUOTE',
quantity: '60.5',
bestQuantityType: 'BASE',
bestQuantity: '60.5',
limitPrice: '11.009',
username: 'user123',
postOnly: false,
tdsDeducted: false,
clientOrderId: 'client123'
};
/*
// Request body for Market order
{
"type": "MARKET",
"side": "SELL",
"instrument": "BTC/INR",
"quantityType": "BASE",
"quantity": "2.0",
"bestQuantityType": "QUOTE",
"bestQuantity": "58,000",
"username": "user123"
}
*/
// Send the POST request
axios.post(url, data, { headers })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"averagePrice": "0",
"brokerId": "6eeb8ad8-xxxx-xxxx-xxxx-9ee139fb8b65",
"cancelledQuantity": "0",
"clientOrderId": "",
"createdAt": "1725010288",
"filledQuantity": "0",
"filledQuoteQuantity": "0",
"instrument": "BTC/INR",
"limitPrice": "2500000",
"makerFee": "0.02",
"orderId": "13805aea-xxxx-xxxx-xxxx-e3edc9d314db",
"quantity": "0.00004",
"side": "BUY",
"status": "OPEN",
"takerFee": "0.06",
"tdsPerc": "0",
"updatedAt": "1725010288"
},
"message": "Order placed successfully"
}
Summary: Create a new order
Description: Place a new order for matching. This endpoint allows you to create a new order by specifying the type, side, instrument, quantity, and other relevant details.
Limit orders and Market orders are two primary types of orders that users can use to buy or sell assets. Here's a breakdown of each:
1. Market Order:
A market order is an order to buy or sell a asset immediately at the current market price.
This type of order guarantees execution but not the price, meaning your order will be filled as soon as possible at the best available price.
When to use:
If you prioritize executing the trade quickly and are less concerned about the exact price, a market order is ideal.
Example:
You want to buy 100 units of a asset currently trading at 0.5 btc. If you place a market order, it will be filled at the best available price, which could be 0.5 btc or slightly higher or lower, depending on the market conditions at that moment.
2. Limit Order:
A limit order allows you to specify the maximum price you are willing to pay when buying, or the minimum price you are willing to accept when selling.
This order will only be executed if the market price reaches the limit price you set. Unlike a market order, there's no guarantee that a limit order will be filled.
When to use:
If you are more concerned about getting a specific price rather than the speed of the execution, a limit order is appropriate.
Example:
You want to buy 100 units of a asset, but you are only willing to pay 0.48 btc per unit. You place a limit order with a buy limit of 0.48 btc. Your order will only be filled if the stock price drops to 0.48 btc or lower.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
orderID |
Body | String | No | Unique identifier for the order. If not provided, a random uuid will be created on server. |
type |
Body | String | Yes | Type of the order, e.g., Market or Limit. |
side |
Body | String | Yes | The action of the order, indicating whether it's a Buy or Sell. |
instrument |
Body | String | Yes | The trading pair or asset involved, e.g., BTC/INR. |
quantityType |
Body | String | Yes | Indicates whether the quantity is specified in Base or Quote currency. |
quantity |
Body | String | Yes | The amount of the asset to be traded. |
bestQuantityType |
Body | String | No | Type of quantity opposite to the main quantity, required for Market orders. |
bestQuantity |
Body | String | No | Quantity associated with bestQuantityType, used as a protection price. |
limitPrice |
Body | String | No | The price limit for Limit orders. |
username |
Body | String | Yes | The username of the user for whom the order is being placed. |
postOnly |
Body | Boolean | No | Specifies if the order should be cancelled if it would execute immediately as a taker. |
tdsDeducted |
Body | Boolean | No | Indicates whether TDS (Tax Deducted at Source) has already been deducted by the broker. |
clientOrderId |
Body | String | No | Client Order ID. |
DELETE /v1/orders/{orderID}
import requests
# Base URL
base_url = BASE_URL
# Endpoint
order_id = 'your_order_id'
endpoint = f"api/v1/orders/{order_id}"
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp'
}
# Send the DELETE request
response = requests.delete(url, headers=headers)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL;
// Endpoint
const orderId = 'your_order_id';
const endpoint = `api/v1/orders/${orderId}`;
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp'
};
// Send the DELETE request
axios.delete(url, { headers })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"cancelled": true,
"info": {
"message": "Order Cancelled"
}
},
"message": "Order cancelled"
}
Summary: Cancel existing order
Description: Cancel an order if it hasn't been partially or completely filled. This endpoint allows you to cancel an existing order using its unique orderID.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
orderID |
path | String | Yes | The unique identifier of the order to be canceled. |
DELETE v1/orders/cancelAll
Summary: Cancels all orders of a specific instrument
Description: Cancels all orders for a given instrument if they haven't been completely filled. This endpoint allows you to cancel all pending orders for a specific instrument.
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/orders/cancelAll'
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key', # Replace with actual access key
'CSX-SIGNATURE': 'your_signature', # Replace with actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', # Replace with actual timestamp
}
# Query parameters
params = {
'instrument': 'BTC/INR' # Replace 'BTC/INR' with the instrument you want to query
}
# Send the DELETE request
response = requests.delete(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = BASE_URL; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/orders/cancelAll';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key', // Replace with actual access key
'CSX-SIGNATURE': 'your_signature', // Replace with actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', // Replace with actual timestamp
};
// Query parameters
const params = {
instrument: 'BTC/INR' // Replace 'BTC/INR' with the instrument you want to query
};
// Send the DELETE request
axios.delete(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": "3 open orders will be Cancelled",
"message": "Orders cancellation in progress"
}
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
instrument |
query | String | No | The instrument for which all orders should be canceled, if not provided, all orders will be cancelled |
GET /v1/orders/{orderID}
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
order_id = 'your_order_id' # Replace with the actual order ID
endpoint = f'api/v1/orders/{order_id}'
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key', # Replace with actual access key
'CSX-SIGNATURE': 'your_signature', # Replace with actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', # Replace with actual timestamp
}
# Query parameters
params = {
'isClientOrderID': True # Replace with true or false as needed
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const orderID = 'your_order_id'; // Replace with the actual order ID
const endpoint = `api/v1/orders/${orderID}`;
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key', // Replace with actual access key
'CSX-SIGNATURE': 'your_signature', // Replace with actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', // Replace with actual timestamp
};
// Query parameters
const params = {
isClientOrderID: true // Replace with true or false as needed
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"averagePrice": "0",
"brokerId": "6eeb8ad8-xxxx-xxxx-xxxx-9ee139fb8b65",
"cancelledQuantity": "0.00004",
"clientOrderId": "",
"createdAt": "1725011665",
"filledQuantity": "0",
"filledQuoteQuantity": "0",
"instrument": "BTC/INR",
"limitPrice": "2500000",
"makerFee": "0.02",
"orderId": "9843aa68-xxxx-xxxx-xxxx-3ad5fe9c7092",
"quantity": "0.00004",
"side": "SELL",
"status": "CANCELLED",
"takerFee": "0.06",
"tdsPerc": "1",
"updatedAt": "1725011668"
},
"message": "Order fetched successfully"
}
Summary: Get the details of an Order by its ID
Description: This endpoint retrieves detailed information about an order specified by its orderID. It also allows for an optional query parameter to specify if the orderID is a client order ID.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
orderID |
path | String | Yes | The unique identifier of the order. |
isClientOrderID |
Query | boolean | No | Specify if the orderID is a client order ID. |
Public APIs
GET /v1/public/health/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/public/health/'
url = f"{base_url}{endpoint}"
# Send the GET request
response = requests.get(url)
# Print the response
print(response.status_code)
print(response.text) # The response should be a plain string
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/public/health/';
const url = `${baseUrl}${endpoint}`;
// Send the GET request
axios.get(url)
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response should be a plain string
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
"OK"
Summary: Liveness endpoint
Description: This endpoint is used to check if the server is active and responding. It is a simple health check endpoint that should return a 200 OK response if the server is up and running.
GET /v1/public/trades/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/public/trades/'
url = f"{base_url}{endpoint}"
# Query parameters
params = {
'instrument': 'BTC/INR', # Replace with the instrument you want to query
'count': '2' # Replace with the number of trades to return (optional)
}
# Send the GET request
response = requests.get(url, params=params)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the latest trades data
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/public/trades/';
const url = `${baseUrl}${endpoint}`;
// Query parameters
const params = {
instrument: 'BTC/INR', // Replace with the instrument you want to query
count: '2' // Replace with the number of trades to return (optional)
};
// Send the GET request
axios.get(url, { params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the latest trades data
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": [
{
"price": "1690001",
"baseQuantity": "0.00004",
"isBuyerMaker": false,
"createdAt": {
"seconds": 1725011008,
"nanos": 313222000
}
},
{
"price": "1690001",
"baseQuantity": "0.00004",
"isBuyerMaker": false,
"createdAt": {
"seconds": 1725010288,
"nanos": 993281000
}
}
],
"message": "Trade history fetched"
}
Summary: Get latest trades
Description: This endpoint retrieves the latest trades for a specified instrument. You can specify the number of trades to return.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
instrument |
query | String | Yes | Name of the instrument. |
count |
query | String | No | Number of trades to return. |
GET /v1/public/ticker/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/public/ticker/'
url = f"{base_url}{endpoint}"
# Query parameters
params = {
'instrument': 'ETH/INR' # Replace with the instrument you want to query
}
# Send the GET request
response = requests.get(url, params=params)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the ticker data
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/public/ticker/';
const url = `${baseUrl}${endpoint}`;
// Query parameters
const params = {
instrument: 'ETH/INR' // Replace with the instrument you want to query
};
// Send the GET request
axios.get(url, { params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the ticker data
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"high24H": "0",
"instrument": "ETH/INR",
"lastTradedPrice": "0",
"lastTradedPriceChange": "0",
"lastTradedPriceChangePercent": "0",
"low24H": "0",
"open24H": "0",
"volume24HBase": "0",
"volume24HQuote": "0"
},
"message": "Ticker data fetched successfully"
}
Summary: Get ticker data
Description: This endpoint retrieves ticker data for a specified instrument.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
instrument |
query | String | Yes | Name of the instrument. |
GET /v2/public/ticker/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v2/public/ticker/'
url = f"{base_url}{endpoint}"
# Query parameters
params = {
'instrument': 'ETH/INR' # Replace with the instrument you want to query
}
# Send the GET request
response = requests.get(url, params=params)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the ticker data
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v2/public/ticker/';
const url = `${baseUrl}${endpoint}`;
// Query parameters
const params = {
instrument: 'ETH/INR' // Replace with the instrument you want to query
};
// Send the GET request
axios.get(url, { params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the ticker data
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": [
{
"High24H": "0",
"Instrument": "ETH/INR",
"LastTradedPrice": "0",
"LastTradedPriceChange": "0",
"LastTradedPriceChangePercent": "0",
"Low24H": "0",
"Open24H": "0",
"Volume24HBase": "0",
"Volume24HQuote": "0"
}
],
"message": "Ticker data fetched successfully"
}
Summary: Get ticker data
Description: Get ticker data for all or a given instrument
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
instrument |
query | String | No | Name of the instrument. |
GET /v1/public/depth/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/public/depth'
url = f"{base_url}{endpoint}"
# Query parameters
params = {
'instrument': 'SHIB/INR', # Replace with the instrument you want to query
}
# Send the GET request
response = requests.get(url, params=params)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the market depth data
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/public/depth';
const url = `${baseUrl}${endpoint}`;
// Query parameters
const params = {
instrument: 'SHIB/INR', // Replace with the instrument you want to query
};
// Send the GET request
axios.get(url, { params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the market depth data
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": [
{
"buy": [],
"sell": [
{
"price": "0.00095",
"quantity": "16222800"
},
{
"price": "0.001203",
"quantity": "124700"
},
{
"price": "0.00121",
"quantity": "450000"
},
{
"price": "0.001399",
"quantity": "159493000"
},
{
"price": "0.0014",
"quantity": "5900000"
}
]
}
],
"message": "Market depth fetched"
}
Summary: Get market depth
Description: This endpoint retrieves the market depth (order book) for a specified instrument. It provides information about the bid and ask orders in the market.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
instrument |
query | String | Yes | Name of the instrument. |
depth |
query | String | No | Order book depth size to return (max: 2000, default: 20) |
GET /v2/public/depth/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v2/public/depth'
url = f"{base_url}{endpoint}"
# Query parameters
params = {
'instrument': 'SHIB/INR', # Replace with the instrument you want to query
}
# Send the GET request
response = requests.get(url, params=params)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the market depth data
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v2/public/depth';
const url = `${baseUrl}${endpoint}`;
// Query parameters
const params = {
instrument: 'SHIB/INR', // Replace with the instrument you want to query
};
// Send the GET request
axios.get(url, { params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the market depth data
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"buy": [],
"sell": [
[
"0.00095",
"16222800"
],
[
"0.001203",
"124700"
],
[
"0.00121",
"450000"
],
[
"0.001399",
"159493000"
],
[
"0.0014",
"5900000"
]
],
"timestamp": "2024-08-30T10:27:08.340868243Z"
},
"message": "Market depth fetched"
}
Summary: Get market depth
Description: This endpoint retrieves the market depth (order book) for a specified instrument. It provides information about the bid and ask orders in the market.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
instrument |
query | String | Yes | Name of the instrument. |
depth |
query | String | No | Order book depth size to return (max: 2000, default: 20) |
GET /v1/public/instrument/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/public/instrument'
url = f"{base_url}{endpoint}"
# Send the GET request
response = requests.get(url)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the list of supported instruments
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/public/instrument';
const url = `${baseUrl}${endpoint}`;
// Send the GET request
axios.get(url)
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the list of supported instruments
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"instruments": [
{
"instrument": "1INCH/INR",
"basePrecision": "0.1",
"quotePrecision": "0.01",
"limitPrecision": "0.01"
},
{
"instrument": "AAVE/INR",
"basePrecision": "0.001",
"quotePrecision": "0.01",
"limitPrecision": "1"
},
{
"instrument": "ACE/INR",
"basePrecision": "0.001",
"quotePrecision": "0.01",
"limitPrecision": "0.01"
},
...
]
},
"message": "Instrument list fetched successfully"
}
Summary: List supported instruments
Description: This endpoint retrieves a list of all instruments that are currently supported by the system.
C2C APIs
POST /v1/conversion/order/
import requests
import json
# Base URL
base_url = 'BASE_URL'
# Endpoint
endpoint = 'api/v1/conversion/order'
url = f'{base_url}{endpoint}'
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
}
# Payload (body)
data = {
"instrument": "BTC-USD",
"side": "BUY",
"exchange": "BINANCE",
"limitPrice": "30000",
"quantity": "0.1",
"quantityType": "BASE",
"type": "LIMIT",
"clientOrderId": "12345"
}
# Send the POST request
response = requests.post(url, headers=headers, data=json.dumps(data))
# Print the response
if response.status_code == 200:
print("Order placed successfully.")
print(response.json())
else:
print(f"Error: {response.status_code}")
print(response.json())
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL';
// Endpoint
const endpoint = 'api/v1/conversion/order';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key',
'CSX-SIGNATURE': 'your_signature',
'CSX-ACCESS-TIMESTAMP': 'your_timestamp',
'Content-Type': 'application/json'
};
// Payload (body)
const data = {
instrument: "BTC-USD",
side: "BUY",
exchange: "BINANCE",
limitPrice: "30000",
quantity: "0.1",
quantityType: "BASE",
type: "LIMIT",
clientOrderId: "12345"
};
// Send the POST request
axios.post(url, data, { headers })
.then(response => {
// Print the response
console.log("Order placed successfully.");
console.log(response.data);
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(`Error: ${error.response.status}`);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"orderId": "78a73bd4-a601-43b5-865a-2b8bbb941dc0",
"orderType": "LIMIT",
"orderSide": "SELL",
"limitPrice": "2445.1",
"quantity": "0.0042",
"filledQuantity": "0",
"quoteQuantity": "10.26942",
"status": "OPEN",
"exchange": "C2C2",
"clientOrderId": "6800b45d-7ae9-4a25-8a3b-c148f52ac620",
"instrument": "ETH/USDT",
"brokerId": "6eeb8ad8-23fc-40cd-9e61-9ee139fb8b65",
"tdsPerc": "1",
"tdsAmount": "0",
"tdsCurrency": "USDT",
"totalFeesAmount": "0",
"totalFeesCurrency": "USDT",
"cancelledAmount": "0",
"cancelledCurrency": "",
"AveragePrice": "0",
"createdAt": "1725261656",
"updatedAt": "1725261656"
},
"message": "Order placed successfully"
}
Summary: Place C2C order
Description: This endpoint is used to place a new order on the exchange. The order details must be provided in the request body.
Limit orders and Market orders are two primary types of orders that users can use to buy or sell assets. Here's a breakdown of each:
1. Market Order:
A market order is an order to buy or sell a asset immediately at the current market price.
This type of order guarantees execution but not the price, meaning your order will be filled as soon as possible at the best available price.
When to use:
If you prioritize executing the trade quickly and are less concerned about the exact price, a market order is ideal.
Example:
You want to buy 100 units of a asset currently trading at 0.5 btc. If you place a market order, it will be filled at the best available price, which could be 0.5 btc or slightly higher or lower, depending on the market conditions at that moment.
2. Limit Order:
A limit order allows you to specify the maximum price you are willing to pay when buying, or the minimum price you are willing to accept when selling.
This order will only be executed if the market price reaches the limit price you set. Unlike a market order, there's no guarantee that a limit order will be filled.
When to use:
If you are more concerned about getting a specific price rather than the speed of the execution, a limit order is appropriate.
Example:
You want to buy 100 units of a asset, but you are only willing to pay 0.48 btc per unit. You place a limit order with a buy limit of 0.48 btc. Your order will only be filled if the stock price drops to 0.48 btc or lower.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
instrument |
Body | String | Yes | The currency/instrument of order |
side |
Body | String | Yes | Side of the order (Buy/Sell) |
exchange |
Body | String | Yes | Name of the exchange |
limitPrice |
Body | String | No | The limit price of the order |
quantity |
Body | String | Yes | The quantity for the order |
quantityType |
Body | String | Yes | Type of the quantity (e.g., Base) |
type |
Body | String | Yes | Type of the order (Market/Limit) |
clientOrderId |
Body | String | No | Client Order ID |
DELETE /v1/conversion/order/{orderID}
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Order ID
order_id = 'ORDER_ID' # Replace with your actual order ID
# Endpoint
endpoint = f'api/v1/conversion/order/{order_id}'
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key', # Replace with your actual access key
'CSX-SIGNATURE': 'your_signature', # Replace with your actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', # Replace with your actual timestamp
}
# Send the DELETE request
response = requests.delete(url, headers=headers)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the result of the cancellation request
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Order ID
const orderId = 'ORDER_ID'; // Replace with your actual order ID
// Endpoint
const endpoint = `api/v1/conversion/order/${orderId}`;
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key', // Replace with your actual access key
'CSX-SIGNATURE': 'your_signature', // Replace with your actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', // Replace with your actual timestamp
};
// Send the DELETE request
axios.delete(url, { headers })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the result of the cancellation request
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"message": "We will try to cancel this order"
}
Summary: Delete a C2C order by its ID.
Description: This endpoint is used to delete a order on the exchange. The order ID must be provided in the path.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
orderID |
path | String | Yes | Unique identifier of the order to be canceled. |
GET /v1/conversion/orders
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/conversion/orders'
url = f"{base_url}{endpoint}"
# Headers with necessary authentication details
headers = {
'CSX-ACCESS-KEY': 'your_access_key', # Replace with your actual access key
'CSX-SIGNATURE': 'your_signature', # Replace with your actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', # Replace with your actual timestamp
}
# Query parameters
params = {
'onlyOpen': 'true',
'cursor': 'your_cursor_value', # Optional, remove if not using pagination
'created_at': 'ge:2022-11-10<:2022-11-12', # Optional, remove if not filtering by creation date
'instrument': 'BTC-USD', # Optional, remove if not filtering by instrument
'count': '10' # Optional, specify the number of orders to return
}
# Send the GET request
response = requests.get(url, headers=headers, params=params)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the list of open orders
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/conversion/orders';
const url = `${baseUrl}${endpoint}`;
// Headers with necessary authentication details
const headers = {
'CSX-ACCESS-KEY': 'your_access_key', // Replace with your actual access key
'CSX-SIGNATURE': 'your_signature', // Replace with your actual signature
'CSX-ACCESS-TIMESTAMP': 'your_timestamp', // Replace with your actual timestamp
};
// Query parameters
const params = {
onlyOpen: true,
cursor: 'your_cursor_value', // Optional, remove if not using pagination
created_at: 'ge:2022-11-10<:2022-11-12', // Optional, remove if not filtering by creation date
instrument: 'BTC-USD', // Optional, remove if not filtering by instrument
count: '10' // Optional, specify the number of orders to return
};
// Send the GET request
axios.get(url, { headers, params })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the list of open orders
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"cursor": "3d3117fe-cbeb-49e7-8e77-595f3f0f6445&1725016947809",
"orders": [
{
"orderId": "85428096-49c7-43fb-96bc-e564248b53da",
"orderType": "LIMIT",
"orderSide": "SELL",
"limitPrice": "550",
"quantity": "9",
"filledQuantity": "0",
"quoteQuantity": "4950",
"status": "REJECTED",
"exchange": "WAZIRX",
"clientOrderId": "643a94d5-3c88-4bc1-9d26-161489f34098",
"instrument": "ETH/INR",
"brokerId": "6eeb8ad8-23fc-40cd-9e61-9ee139fb8b65",
"tdsPerc": "1",
"tdsAmount": "0",
"tdsCurrency": "INR",
"totalFeesAmount": "0",
"totalFeesCurrency": "INR",
"cancelledAmount": "0",
"cancelledCurrency": "",
"AveragePrice": "0",
"createdAt": "1725017028",
"updatedAt": "1725017028"
},
{
"orderId": "3d3117fe-cbeb-49e7-8e77-595f3f0f6445",
"orderType": "LIMIT",
"orderSide": "SELL",
"limitPrice": "550",
"quantity": "9",
"filledQuantity": "0",
"quoteQuantity": "4950",
"status": "REJECTED",
"exchange": "WAZIRX",
"clientOrderId": "ccf33d32-8ac7-4c03-a6e4-4074688f5030",
"instrument": "ETH/INR",
"brokerId": "6eeb8ad8-23fc-40cd-9e61-9ee139fb8b65",
"tdsPerc": "1",
"tdsAmount": "0",
"tdsCurrency": "INR",
"totalFeesAmount": "0",
"totalFeesCurrency": "INR",
"cancelledAmount": "0",
"cancelledCurrency": "",
"AveragePrice": "0",
"createdAt": "1725016947",
"updatedAt": "1725016947"
},
...
]
},
"message": "Order Details fetched successfully"
}
Summary: Retrieve a list of all C2C orders.
Description: This endpoint fetches all open crypto conversion orders for the user. The user can filter the results based on various criteria such as instrument, creation date, and pagination.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
onlyOpen |
Query | String | Yes | A flag to filter only open orders. |
cursor |
Query | String | No | Send cursor from previous page response to get next elements. Example: 774af8b9-cbbe-4705-b4e7-bfd5464a2422&1658322119926 |
created_at |
Query | String | No | Filter by creation date. Supported operations: gt, gte, lt, lte. Example: created_at=ge:2022-11-10&created_at=lt:2022-11-12. |
instrument |
Query | String | No | Filter by instrument. Supported operations: in, nin, neq, gt, gte, lt, lte. Example: foo=in:a,bc,d OR foo=buzz&baz=quux. |
count |
Query | String | No | Number of orders to return. |
GET /v1/conversion/order/{orderID}
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
order_id = 'ORDER_ID' # Replace with the actual order ID
endpoint = f'api/v1/conversion/order/{order_id}'
url = f"{base_url}{endpoint}"
# Headers
headers = {
'CSX-ACCESS-KEY': 'YOUR_ACCESS_KEY', # Replace with your actual access key
'CSX-SIGNATURE': 'YOUR_SIGNATURE', # Replace with your actual signature
'CSX-ACCESS-TIMESTAMP': 'YOUR_TIMESTAMP' # Replace with the actual timestamp
}
# Send the GET request
response = requests.get(url, headers=headers, params={'isClientOrderId': 'false'})
# Print the response
print(response.status_code)
print(response.json()) # The response will include the details of the order
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const orderId = 'ORDER_ID'; // Replace with the actual order ID
const endpoint = `api/v1/conversion/order/${orderId}`;
const url = `${baseUrl}${endpoint}`;
// Headers
const headers = {
'CSX-ACCESS-KEY': 'YOUR_ACCESS_KEY', // Replace with your actual access key
'CSX-SIGNATURE': 'YOUR_SIGNATURE', // Replace with your actual signature
'CSX-ACCESS-TIMESTAMP': 'YOUR_TIMESTAMP' // Replace with the actual timestamp
};
// Send the GET request
axios.get(url, { headers, params: { isClientOrderId: 'false' } })
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the details of the order
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": {
"orderId": "85428096-xxxx-xxxx-xxxx-e564248b53da",
"orderType": "LIMIT",
"orderSide": "SELL",
"limitPrice": "550",
"quantity": "9",
"filledQuantity": "0",
"quoteQuantity": "4950",
"status": "REJECTED",
"exchange": "WAZIRX",
"clientOrderId": "643a94d5-xxxx-xxxx-xxxx-161489f34098",
"instrument": "ETH/INR",
"brokerId": "6eeb8ad8-xxxx-xxxx-xxxx-9ee139fb8b65",
"tdsPerc": "1",
"tdsAmount": "0",
"tdsCurrency": "INR",
"totalFeesAmount": "0",
"totalFeesCurrency": "INR",
"cancelledAmount": "0",
"cancelledCurrency": "",
"AveragePrice": "0",
"createdAt": "1725017028",
"updatedAt": "1725017028"
},
"message": "Order Details fetched successfully"
}
Summary: Retrieve the details of a specific order using its unique orderID.
Description: This endpoint fetches the details of an order by its ID. You need to provide the orderID in the path and include necessary authentication headers. Optionally, you can specify whether to use the client order ID for the request.
Here's a table for the parameters:
Parameter | In | Type | Required | Description |
---|---|---|---|---|
CSX-ACCESS-KEY |
Header | String | Yes | Public key provided by the CSX server to authenticate API requests |
CSX-SIGNATURE |
Header | String | Yes | Request signature generated using the user's private key and the Ed25519 algorithm for security. |
CSX-ACCESS-TIMESTAMP |
Header | String | Yes | The timestamp when the request is made, in a specified format (e.g., UNIX timestamp). |
orderID |
Path | String | Yes | The unique identifier of the order for which details are to be retrieved. |
isClientOrderId |
Query | boolean | No | A flag indicating whether to use the client order ID for the request. (Default: false) |
GET /v1/conversion/public/instruments/
import requests
# Base URL
base_url = 'BASE_URL' # Replace with your actual base URL
# Endpoint
endpoint = 'api/v1/conversion/public/instruments'
url = f"{base_url}{endpoint}"
# Send the GET request
response = requests.get(url)
# Print the response
print(response.status_code)
print(response.json()) # The response will include the list of supported instruments
const axios = require('axios');
// Base URL
const baseUrl = 'BASE_URL'; // Replace with your actual base URL
// Endpoint
const endpoint = 'api/v1/conversion/public/instruments';
const url = `${baseUrl}${endpoint}`;
// Send the GET request
axios.get(url)
.then(response => {
// Print the response
console.log(response.status);
console.log(response.data); // The response will include the list of supported instruments
})
.catch(error => {
// Print the error response
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
});
The above request returns the following result
{
"data": [
{
"exchangeName": "BINANCE",
"pairs": [
"PENDLE/USDT",
"BNB/USDT",
...
],
"basePrecision": {
"BAT/USDT": "1",
"BNB/USDT": "0.001",
...
},
"quotePrecision": {
"BAT/USDT": "0.0001",
"BNB/USDT": "0.1",
...
},
"limitPrecision": {
"BAT/USDT": "0.0001",
"BNB/USDT": "0.1",
...
}
},
{
"exchangeName": "WAZIRX",
"pairs": [
"ETH/INR",
"FTM/INR",
...
],
"basePrecision": {
"BNB/INR": "0.001",
"BTC/INR": "0.00001",
...
},
"quotePrecision": {
"BNB/INR": "0.01",
"BTC/INR": "0.01",
...
},
"limitPrecision": {
"BNB/INR": "0.01",
"BTC/INR": "1",
...
}
},
...
],
"message": "Exchange List fetched successfully"
}
Summary: Retrieve a list of all supported instruments on the exchange for C2C.
Description: This endpoint provides a list of all instruments that are supported by the exchange. It does not require any parameters and returns a comprehensive list of instruments.