Docs
Oracle

Oracle

Get real-time currency rates.

This Oracle includes enhanced details in the response, with also more granularity in the parameter settings. You can now add multiple currency pairs, get the exact amount expected after conversion, and also the timeout which indicates for how long a given rate will be valid.

Path Parameters

pair
required
string

BRLUSDT / USDTBRL / ARSBRL / BRLARS / USDTARS. The first pair is the one we put the amount for, and the second is the amount expected as output

type
required
'charge' | 'pay'

When you are receiving a payment is 'charge', if you are paying is 'pay'

amount
required
float

Floating number

exchange
optional
string

If you are using ARSBRL pair, you can add what specific rate from a local exchange you want to use. Default value will be taken from Yadio Average but if you want to select a specific local exchange you can add the key exchange=xxxx and you can type fiwind, lemoncash, belo, etc.

chain
optional
string

Default value is polygon, but if you are operating with Tron you can also select Tron. While rates are the same it's safer to use the right chain in case there are are policy changes in future.

Response include:

The total amount you quoted and the expected amount after conversion. For instance, if I use 100 BRLUSDT, then I'll get total_brl: 100, and total_usdt: 19.37 meaning that this will be the amount I would get after receiving the payment.

Similarly if instead of charge you use type=pay, and you put BRLUSDT it means that you will be setting the exact amount to be paid and it'll out put the amount of USDt you need to send. If you put USDTBRL, You are defining how much USDt you want to send and it'll output how much BRL it'll be paid

Timeout only available for BRL-USDT Pairs, it indicates the time in seconds left until the rate is updated.

const pair = "BRLUSDT"
const type = "charge"
const amount = 100
 
const url = `${baseURL}/v2/oracle?pair=${pair}&type=${type}&amount=${amount}`
 
const response = await fetch(url, {
    method: "GET",
    headers: {
      Authorization: `Bearer ${access_token}`,
      "Content-Type": "application/json",
    },
});

Response samples

{
  "status_code": 200,
  "msg": "Request ok",
  "data": {
    "total_brl": 100.0,
    "total_usdt": 19.37735,
    "rate": 0.193773,
    "timeout": 178
}