Get current rates for multiple crypto assets at once
This endpoint allows you to obtain current exchange rates between fiat/crypto or fiat/fiat.
The
getExchangeRates()
method in our API provides a powerful solution similar to the "Get current rate" method. It enables you to obtain current exchange rate information, along with timestamps and the source of the data.
One notable feature of this method is the ability to request multiple exchange pairs simultaneously. This means you can retrieve exchange rates for various cryptocurrencies all in one API call, saving time and reducing complexity.1
// yarn add @tatumio/tatum
2
3
import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
4
5
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
6
7
const rates = tatum.rates.getCurrentRateBatch(
8
[{
9
currency: "BTC",
10
basePair: "EUR",
11
batchId: "0"
12
}, {
13
currency: "ETH",
14
basePair: "EUR",
15
batchId: "1"
16
}])
1
// array of
2
export class RateBatchDto {
3
// fiat
4
basePair: Fiat
5
6
// crypto currency/fiat
7
currency: Fiat | Currency
8
9
// used to identify pair in batch calls
10
batchId?: string
11
}
1
// array of
2
export class Rate {
3
// used to identify pair in batch calls
4
batchId?: string
5
6
// crypto currency/fiat
7
_id: Fiat | Currency
8
9
// the amount of basePair that can be exchanged for 1 _id (crypto currency/fiat)
10
value: string
11
12
// fiat
13
basePair: Fiat
14
15
// timestamp of rate information from source
16
timestamp: number
17
18
// source of rate
19
source: string
20
}
21
Last modified 1mo ago