How should I get the ICP/USDT rate in real time for IC's project and can I check the price history?

As far as I know there doesn’t seem to be a proper price oracle that can do it, is it only possible with front-end calls to the api of the exchange?

You can use the exchange rate canister, by passing a unix time stamp you can get historical data
(see e.g., Exchange rate canister - Internet Computer Wiki for more details)

1 Like

Since you mentioned “real time”, note that the exchange rate canister has a granularity of 1 minute, so there is no point in requesting an exchange rate more frequently than once every minute.

Thanks for the reply, this is really useful, but is there a front end API that I can call?
For example, my current application scenario is that I don’t need a quote that reliable, just data that works.

The exchange rate canister is really meant as an exchange rate oracle for other canisters. If you need a certain exchange rate in a front end, you have several options. For example, you can just query the rate from a centralized exchange of your choice (this is a reasonable approach if you don’t need the data to be reliable) or you can build a back end (canister) that periodically retrieves the rate from the exchange rate canister and makes it available to your front end through a query call.


Thanks for the reply, I understand.