VAI vault APY and XVS pending

Hi all,
I need to get the APY from VAI staking vault and XVS pending(for account) programmatically. It would be best if I achieve that by bsc reading smart contract.
Any suggestions will be appreciated.

Edit: Found a way to calculate APY from: venusVAIVaultRate * blocks_per_year * price / total_supply