Swap Calculate
This endpoint allows you to instantly calculate how much cryptocurrency you'll receive when swapping one currency for another. Designed for ease of use, it provides real-time rates to ensure accurate calculations. Simply integrate this feature into your app to access the latest rates anytime. Whether you're buying or selling, this endpoint simplifies the process by giving you quick and precise swap amounts for your desired currency.
Your General API Key for authentication and authorization.
application/jsonSpecify the currency symbol you want to swap from.
Specify the currency symbol you want to swap to.
Specify the amount of currency you want to swap.
Successful operation
A message containing additional information about the result of the request.
The status of the request response. Typically provided as a numeric code (e.g., 200 for success or other codes for errors).
The version of the API being used.
Bad request
import requests
import json
url = 'https://api.oxapay.com/v1/general/swap/calculate'
data = {
"amount": 12,
"from_currency": "USDT",
"to_currency": "TRX"
}
headers = {
'general_api_key': 'YOUR_GENERAL_API_KEY',
'Content-Type': 'application/json'
}
response = requests.post(url, data=json.dumps(data), headers=headers)
result = response.json()
print(result){
"data": {
"to_amount": 94763.06,
"rate": 94763.06,
"amount": 1
},
"message": "Operation completed successfully!",
"error": {},
"status": 200,
"version": "1.0.0"
}Last updated