Anchor-Protocol / anchor.js

The JavaScript SDK for Anchor Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best way to get aUST price in UST?

kallama opened this issue · comments

I've noticed that https://api.extraterrestrial.money/v1/api/prices and Mirror have slightly different rates for aUST (as of right now as I type this 1.092843 vs 1.105404.)

Is it possible to calculate how much 1 aUST is in UST using anchor.js or terra.js, and if so, what's the best way?

Hi @kallama,
You can get the exact aUST rate from the epoch-state command of market query: check the code here.
The response will be the following:

{
  exchange_rate: '1.109077188911329171',
  aterra_supply: '1378289453951152'
}

exchange_rate is what you are looking for.

Hi @kallama, You can get the exact aUST rate from the epoch-state command of market query: check the code here. The response will be the following:

{
  exchange_rate: '1.109077188911329171',
  aterra_supply: '1378289453951152'
}

exchange_rate is what you are looking for.

Thank you, this answers my question.