Rates methods
Rate object
- left string
Base currency.
- right string
Quote currency.
- bid string
Bid price.
- ask string
Ask price.
- exp number
Currency precision (number of digits after the decimal separator) for the
bid
andask
fields.- created_at string
The time of the rate creation.
- expired_at string
The time when the rate will be replaced with a more relevant one.
RATE OBJECT
{
"data": {
"type": "rate",
"id": "0",
"attributes": {
"left": "USDC",
"right": "AAVE",
"bid": "0.005647783672770837",
"ask": "0.005765169244819909",
"exp": 18,
"expired_at": "2022-04-15T06:12:42.549998Z",
"created_at": "2022-04-15T06:11:42.549998Z"
}
}
}
Get rates
Request
Rates can be filtered by the the left
and right
parameter according to the JSON API Specification.
For example, the response body will only contain rates with BTC base currency: /rates?filter[left]=BTC
GET[base]/rates/
$ curl --request GET \
--url https://[base]/rates/ \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLC...' \
--header 'content-type: application/vnd.api+json'
import requests
url = 'https://[base]/rates/'
headers = {
'authorization': 'Bearer <Change to your access 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('https://[base]/rates/', [
'headers' => [
'Authorization' => 'Bearer <Change to your access token>',
'Content-Type' => 'application/vnd.api+json',
],
]);
echo $res->getBody();
} catch (RequestException $e) {}
Response
In case of a successful response, an array of rate objects is returned.
HTTP status codes
200 Success.
400 Bad request.