Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the math #2

Open
fbenedett opened this issue Mar 3, 2021 · 3 comments
Open

Question about the math #2

fbenedett opened this issue Mar 3, 2021 · 3 comments

Comments

@fbenedett
Copy link

Hello, I was trying to calculate with my own means, when to compound my interest. I wrote a post on stackoverflow about it, but I didn't have answers (yet). The post is this one: https://stackoverflow.com/questions/66457308/calculate-best-compounding-period-cryptocurrency
So, my question is very simple. Which logic have you used to estimate the best compounding period?

@cmoore1776
Copy link

@fbenedett
Copy link
Author

Hi, thanks for the line of code. Unfortunately, I don't understand your logic.
You write me:
const periodInterestRate = ((this.apyToCalc / 365 / 24) * hours) / 100 + 1
I don't know Javascript. But again, I fail to see how do you get "this.apyToCalc". I tried to follow a bit the code, in particular:
async getAPY() seems the function related to the APY. But the APY formula:
APY= (1+ APR/N)^N -1
depends on "N" the number of times you compound your interests. In theory, the larger is the N the larger is the APY, but when compounding cakes we have to consider also the fees. I can't see where you do that...

@RadNi
Copy link

RadNi commented Mar 25, 2021

Hi.
I am a little bit confused about your problem, anyway I'll share my findings with you.
The getAPY function at https://github.com/amendez/cakecalc/blob/master/src/pages/Index.vue#L535 only calculates the original APY of CAKE syrup pool. However, the user earnings are calculated in https://github.com/amendez/cakecalc/blob/master/src/pages/Index.vue#L535 as @shamelesscookie indicated.
In the same file, the line number 541 calculates the cumulated amount of fee
const totalFeeCost = networkFee * periodCount
and finally is subtracted from final result
const result = (investedAmount * composedInterestRate - totalFeeCost - investedAmount)
The doCalc function also is called with different number of compounding from doCalcs function. Probably somewhere else in the code, they find the maximum value among them.
Tell me if it still doesn't addressed your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants