anchor-earn icon indicating copy to clipboard operation
anchor-earn copied to clipboard

Returned APY is wrong

Open rschef opened this issue 2 years ago • 0 comments

Hi, running the code below returns 16.5% as the Anchor APY, while the official website states 17.97%.

Which one is correct?

https://app.anchorprotocol.com/earn

Code:

import {
  AnchorEarn,
  NETWORKS,
  CHAINS,
  DENOMS,
} from '@anchor-protocol/anchor-earn' // yarn add @anchor-protocol/[email protected]

const anchorEarn = new AnchorEarn({
  chain: CHAINS.TERRA,
  network: NETWORKS.COLUMBUS_5,
  address: 'terra1mqs59fdv2t0cc3pmrtrgn83azvqv8dqz8q4063'
});

const checkMarket = async () => {
  const market = await anchorEarn.market({ // .balance
    currencies: [DENOMS.UST],
  })

  return market
}

console.log(await checkMarket())

// node test.mjs

Response:

MarketOutput {
  chain: 'terra',
  network: 'columbus-5',
  height: 7491758,
  markets: [
    {
      currency: 'UST',
      liquidity: '10914277436.565453',
      APY: '0.165471511176329490'
    }
  ],
  timestamp: 2022-05-03T12:15:49.748Z
}

rschef avatar May 04 '22 12:05 rschef