Rates methods
Rate object
- left string
The base currency.
- right string
The quote currency.
- bid string
The current bid price.
- ask string
The current ask price.
- exp number
The currency precision, that is the number of digits after the decimal separator, for the
bid
andask
fields.- created_at string
The date and time when a rate was received.
- expired_at string
The date and time of rate expiration.
RATE OBJECT
{
"type": "rate",
"id": "0",
"attributes": {
"left": "ZRX",
"right": "USDC",
"bid": "0.381855018600000000",
"ask": "0.389670322000000000",
"exp": 18,
"expired_at": "2024-02-28T09:45:48.314413Z",
"created_at": "2024-02-28T09:40:48.314413Z"
}
}
Get rates
Request
Rates can be filtered by the the left
and right
parameters according to the JSON API Specification.
For example, the response body will only contain the rates with the BTC base currency: /rates?filter[left]=BTC
.
GET[base]/rates/
curl --request GET \
--url [base]/rates/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json'
import requests
url = '[base]/rates/'
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/vnd.api+json',
}
requests.get(url, headers=headers)
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new GuzzleHttp\Client();
try {
$res = $client->get('[base]/rates/', [
'headers' => [
'Authorization' => 'Bearer <token>',
'Content-Type' => 'application/vnd.api+json',
],
]);
echo $res->getBody();
} catch (RequestException $e) {}
Response
In case of success, the response body contains an array of rate objects.
Response codes
200 Success.
400 Bad request.
500 Internal server error.
502 Bad gateway.
503 Service unavailable.
504 Gateway timeout.
5xx Other server errors.