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

Compute slippage #9

Open
AngelaKTE opened this issue Jan 14, 2021 · 1 comment
Open

Compute slippage #9

AngelaKTE opened this issue Jan 14, 2021 · 1 comment
Assignees
Labels
model logic (concept) all issues related to model logic, how we'll translate a mechanism to our model

Comments

@AngelaKTE
Copy link
Contributor

  • slippage in % # over time, calculated based on ?
    pls add how calculate slippage in case of liquidity provision! (see above)
@AngelaKTE AngelaKTE added the model logic (concept) all issues related to model logic, how we'll translate a mechanism to our model label Jan 14, 2021
@AngelaKTE AngelaKTE changed the title Calculate slippage Compute slippage Jan 14, 2021
@VasilySumanov
Copy link
Collaborator

VasilySumanov commented Jan 20, 2021

A function for computing slippage in case of single-side liquidity provision for token_amount_in (number of tokens) tokens of token_in type - slippage_in:

  1. Calculate the lp_token_value_in by multiplying token_amount_in on current ?USD price of token_in type
  2. Call join_swap_extern_amount_in with token_in and token_amount_in input parameters.
    The function will return pool_amount_out, which is defined as lp_pool_out in our Naming Convention
  3. Calculate the current value of received BPT Tokens lp_pool_value using the algorithm presented in Issue 3
  4. The absolute slippage in decimal: (lp_token_value_in - lp_pool_value)/lp_token_value_in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
model logic (concept) all issues related to model logic, how we'll translate a mechanism to our model
Projects
None yet
Development

No branches or pull requests

2 participants