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

Asymptotic Power Lib #28

Open
Zergity opened this issue May 16, 2023 · 0 comments
Open

Asymptotic Power Lib #28

Zergity opened this issue May 16, 2023 · 0 comments
Assignees

Comments

@Zergity
Copy link
Contributor

Zergity commented May 16, 2023

Derivative asset properties:

Configs (load from event)

  • K
  • TOKEN_R (reserve token)
  • ORACLE (QUOTE_TOKEN_INDEX, WINDOW, UNIV3_PAIR)
  • INIT_TIME (former TIMESTAMP)
  • HALF_LIFE (INTERST_HALF_LIFE)

Pool.getStates()

  • R (not TOKEN_R.balanceOf(pool) anymore)
  • a = s_a
  • b = s_b

InterestDecayRate: I = 2^((now-INIT_TIME)/HALF_LIFE)

Helper.getStates

  • xkA, xkB (using twap price) (see _market and _selectPrice)
  • spot.xkA, spot.xkB (use for getAmountOut only)
  • sA = TOKEN.supply(A)
  • sB = TOKEN.supply(B)
  • sC = TOKEN.supply(C)
  • rA, rB, rC

Inflection Points:

  • IPA: (I*R/2/a)^{2/K}
  • IPB: (I*R/2/b)^{2/K}

Effective+Actual+Display Leverage = R + L

  • Long L: 0 <= x <= IPA ? K/2 : K/2*(R-rA)/rB
  • Short L: IPB <= x ? K/2 : K/2*(R-rB)/rA

dailyInterestRate = 1-2^(-SECONDS_PER_DAY/HL)
HL = SECONDS_PER_DAY / Math.log2(1/(1-dailyInterestRate))

RiskFactor = (rA - rB) / rC

Premium: (RiskFactory/PremiumRate)*100% - 100%

Position Lock Discount: DiscountRate

Image

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

2 participants