Query Currency Prices
Query the prices of all currencies available in the SOFA system.
The prices provided by the API are averages for some exchanges and may not be real-time and accurate, so please be aware of the risk of possible price fluctuations when using the API.
Request
VIEW
GET /v1/sofa/currency/prices?convert=currency
The API code must be a read-only API code. Use wallet ID 0 to register API code with the mock server.
Query Parameters
Field | Type | Note | Description |
---|---|---|---|
convert | string | optional, default USD |
The legal tender to be converted, concats with “,” |
All legal tender currencies supported are AUD, BRL, CAD, EUR, GBP, INR, JPY, KRW, NZD, PLN, RUB, SEK, SGD, THB, TWD, USD, ZAR.
Response Body
Field | Type | Description |
---|---|---|
currency | int64 | Registered coin types. Refer to Currency Definition |
token_address | string | Token contract address |
prices | key-value | Currency-Price pair |
last_refresh_attempt_time | int64 | Last attempt to update prices (unix time in UTC) |
last_refresh_success_time | int64 | Last successful price update time (unix time in UTC) |
Error Code
HTTP Code | Error Code | Error | Message | Description |
---|---|---|---|---|
403 | - | Forbidden. Invalid wallet ID | - | No wallet ID found |
403 | - | Forbidden. Header not found | - | Missing X-API-CODE , X-CHECKSUM header or query param t |
403 | - | Forbidden. Invalid timestamp | - | The timestamp t is not in the valid time range |
403 | - | Forbidden. Invalid checksum | - | The request is considered a replay request |
403 | - | Forbidden. Invalid API code | - | X-API-CODE header contains invalid API code |
403 | - | Invalid API code for wallet {WALLET_ID} | - | The API code mismatched |
403 | - | Forbidden. Checksum unmatch | - | X-CHECKSUM header contains wrong checksum |
403 | - | Forbidden. Call too frequently ({THROTTLING_COUNT} calls/minute) | - | Send requests too frequently |
403 | 385 | API Secret not valid | - | Invalid API code permission |
Sample Request
API
/v1/sofa/wallets/readonly/walletlist
Post Body
{
"total": 2,
"wallets": [
{
"address": "2NAnSkEp6SpUPLsdP3ChvN6K5qPMZyoB3RF",
"currency": 0,
"currency_name": "BTC",
"decimals": "8",
"type": 2,
"wallet_id": 101645
},
{
"address": "0x85AfD8F88C0347aFF89AFc6C0749322719396616",
"currency": 60,
"currency_name": "ETH",
"decimals": "18",
"token_contract_address": "0xdf2ce4af00b10644d00316b3d99e029d82d5d2f3",
"token_decimals": "18",
"token_name": "JGB2",
"token_symbol": "JGB2",
"type": 0,
"wallet_id": 118970
}
]
}
Sample cURL Command
Designed for the mock server
curl http://localhost:8889/v1/mock/wallets/readonly/walletlist