Hi Dfinity Team, do we have an interface/canister for how to get the ckbtc exchange rate? (Or can we get the dollar price of BTC from the specific canister?)
Since there is a 1:1 correspondence between BTC and ckBTC, you can just get the BTC/USD rate.
As you might know, you can get this rate conveniently by querying the exchange rate canister.
Thanks, THLO, I know something about the exchange rate canister, but it consumes a lot of cycles for each. query, so do you know some other ways to query BTC price without cycles? (Maybe we can query from CEX?)
Yes, you can query the rate yourself from a centralized exchange using HTTPS outcalls.
However, note that you introduce a single point of failure if you always get the rate from the same exchange (the exchange rate canister handles this complexity for you). Moreover, HTTPS outcalls also consume cycles.
There is some good news: HTTPS outcalls will become cheaper very soon. We will then also propose to update the pricing for the exchange rate canister accordingly.
The exchange rate canister does not offer a query method, only an update method. Is that intentional? Without it frontends who want the exchange rate have to go directly to the sources or make an update request which isn’t ideal for the purpose. Would be nice to have a query method so that the frontend can get the same data as canisters get.
Yes, this is intentional AFAIK. If it’s an update call, you can either use a cached rate, or you can fetch the rate from the exchanges. If it’s only a query call you can only serve cached answers since making an HTTPS outcall is only available in update calls
Ah, I had assumed that delivering responses and fetching the data with http outcalls were independent things and that the exchange rate canister always replies based on cached answers. But I see now in the wiki that that’s not the case.