Anchor-Protocol / anchor-earn

The Earn JavaScript SDK for Anchor Protocol.
Apache License 2.0
45 stars 24 forks source link

Returned APY is wrong #34

Open rschef opened 2 years ago

rschef commented 2 years ago

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/anchor-earn@2.0.0

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
}