Closed DannyDelott closed 2 months ago
Getting strange output for calculate_implied_rate.. 1255.82% seems really high! 😛
Using this: https://github.com/delvtech/hyperdrive/blob/1576e4c4368dd9c21b2df60274f223271e793d46/crates/hyperdrive-math/src/short/open.rs#L160-L165
I'm calling it with these args:
bond_amount: 1000000000000000000 // "1" open_vault_share_price: 1005446844189634821 // "1.005446844189634821" variable_apy: 130000000000000000 // "0.13"
We get back: 12563492079684959896 // "12.563492079684959896"
12563492079684959896 // "12.563492079684959896"
Formatted and rendered in the ui under Implied Variable Rate:
We just need to adjust the variable rate here (since this term is shorter than a year): https://github.com/delvtech/hyperdrive/blob/1576e4c4368dd9c21b2df60274f223271e793d46/crates/hyperdrive-math/src/short/open.rs#L167.
https://discord.com/channels/754739461707006013/1224785900073128080/1233120393938604142
Getting strange output for calculate_implied_rate.. 1255.82% seems really high! 😛
Reproduction
Using this: https://github.com/delvtech/hyperdrive/blob/1576e4c4368dd9c21b2df60274f223271e793d46/crates/hyperdrive-math/src/short/open.rs#L160-L165
I'm calling it with these args:
We get back:
12563492079684959896 // "12.563492079684959896"
Formatted and rendered in the ui under Implied Variable Rate:![image](https://github.com/delvtech/hyperdrive/assets/4524175/93b64847-703a-4f3b-939b-4937ed764061)
Solution
We just need to adjust the variable rate here (since this term is shorter than a year): https://github.com/delvtech/hyperdrive/blob/1576e4c4368dd9c21b2df60274f223271e793d46/crates/hyperdrive-math/src/short/open.rs#L167.
Reference
https://discord.com/channels/754739461707006013/1224785900073128080/1233120393938604142