yanyan ho
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ## evidence ![](https://i.imgur.com/Nn7mwWs.png) # 风控设计 答疑 $$ Slip = -\beta\dfrac{vUSD}{L} $$ 1.币种配置规范,前端是否控制(包括ticksize、最大输入价格、最小下单手数、最大单手开平仓量等) 2.百分百下单估算公式 - 见下方最大开仓量计算 3.滑点容忍度比率(这可能最高不能是100%,因为还有手续费考虑)- 先定5%,后续看运营反馈 4.资金费用的计算方式 - TBD 5.预计强平价格(这里可能需要添加手续费因子)- 见下方强平价格计算 6.price impact的公式,Vusd方向问题, beta值范围,标记价格使用TWAP价格还是池子当前价格 1. 计算资金费率的两种价格,怎么计算 2. 交易费率0.1% 还是动态可配置 3. 关于最大开仓量的公式,当用户已有持仓要加仓的情况下,是否也用这个公式来计算?是的话,那这时候的 Margin(acc) 具体是指哪个呢?用户要新增的保证金还是持仓单里的保证金?而最后计算结果的 vUSD(acc.max) 是否也包括持仓单里的已开仓量呢? # 强平价格 强平价格 (默认),注意这里的 vUSD 和 vETH 为交易用户余额 $$ LiqPrice_{nett}=-\dfrac{vUSD}{vETH + FundingAccrual} $$ 平仓滑点 $$ Slip = -\beta\dfrac{vUSD}{L} $$ - $L$ 为系统流动性,基于AMM池的 vETH (x) 和 vUSD (y) 仓位计算: $L=\sqrt{xy}$ - $\beta$ 为风控变量,最低为0.5,常规取1,+越高LP的buffer越大。 强平价格 (考虑滑点) $$ LiqPrice_{buffer}=(\sqrt{LiqPrice_{mark}}-Slip)^2 $$ 将中间变量展开:(beta) $$ LiqPrice_{buffer}=(\sqrt{-\dfrac{vUSD}{vETH + FundingAccrual}}-\beta\dfrac{vUSD}{\sqrt{xy}})^2 $$ 开多: vUSD为负,价格下跌即亏损, 带buffer强平价格需要大于强平价格;即下跌到强平价格之前就必须平仓; 开空:vUSD为正, 价格上涨即亏损,带buff强平价格需要小于强平价格;即上涨到强平价格之前就必须平仓; 精确公式(代码实现): $$ LiqPrice_{buffer}=(\sqrt{\dfrac{vUSD^2}{4xy}-\dfrac{vUSD}{vETH + FundingAccrual}}-\beta\dfrac{vUSD}{\sqrt{xy}})^2 $$ # 标记价格及滑点 最简单的标记价格取值为AMM当前交易价格,正式实现需考虑价格操作和TWAP(1分钟)。 $$ MarkPrice=\dfrac{y}{x} $$ 杠杆账户需要以调整后的标记价格判断是否强平,可由上述强平价格逻辑反推。当以标记价格计算账户的负债率达到100%时,可被强平 $$ AccountSpecificMarkPrice=(\sqrt{MarkPrice}+\beta\dfrac{vUSD}{\sqrt{xy}})^2 $$ 化简得到(代码计算) $$ AccountSpecificMarkPrice=(\dfrac{{y}+\beta*{vUSD}}{\sqrt{xy}})^2 $$ 取近似(舍掉二次项): $$ MarkPrice_{acc}=MarkPrice(1+2\beta\dfrac{{vUSD}_{acc}}{vUSD_{pool}}) $$ - 当 $vUSD_{acc}$为负时,交易账户做多 ,**标记价格(带滑点的用户标记价格)低于当前价格**,仓位越大幅度越大。注意此时是平多。 - 当 $vUSD_{acc}$为正时,交易账户做空,标记价格高于高于当前价格,仓位越大幅度越大。注意此时其实是在平空。 - 正常运营中 $vUSD_{pool}$一直为正:当该数值下降时,账户滑点将迅速上升,阻止整体仓位继续失衡。 P.S. 上式括号中第二项可视为仓位滑点,注意滑点方向与$vUSD_{acc}$正负有关 # 最大开仓量 $$ Slippage_{acc}=2\beta\dfrac{{vUSD}_{acc}}{vUSD_{pool}} $$ 运营层面设计初始开仓保证金率$MarginRate_{open}=0.1$ (10x开仓杠杆) 用户开仓前的可用保证金,为其钱包里BaseAsset的余额 $Margin_{acc}$ 用户初始杠杆限制 **开多情况:** $$ MarginRate_{open} = \dfrac{Margin_{acc}*MarkPrice_{acc}}{-vUSD_{acc.max}} $$ **开空情况:** $$ MarginRate_{open} = \dfrac{Margin_{acc}*MarkPrice_{acc}}{vUSD_{acc.max}} $$ 上式可推出: 开多(买入):其中*vUSDacc.max* 为负数; $$ vUSD_{acc.max} = -({\dfrac{MarginRate_{open}}{Margin_{acc}*MarkPrice}+\dfrac{2\beta}{vUSD_{pool}}})^{-1} $$ 开空:**vUSDacc.max** 为正数; $$ vUSD_{acc.max} = ({\dfrac{MarginRate_{open}}{Margin_{acc}*MarkPrice}-\dfrac{2\beta}{vUSD_{pool}}})^{-1} (原始公式) $$ 由于需要保证beta越大,需要保证vUSDacc.max越小,所以修正开空公式: $$ vUSD_{acc.max} = ({\dfrac{MarginRate_{open}}{Margin_{acc}*MarkPrice}+\dfrac{2\beta}{vUSD_{pool}}})^{-1} (修正公式) $$ - 当 $Margin_{acc}$较小时,最大开仓量主要由开仓保证金率决定 - 随着 $Margin_{acc}$提高,第二项对最大开仓量的限制逐步增大,使用户实际可开杠杆随着资金量增大而减小 - 当交易对流动性增加(i.e. $vUSD_{pool}$增大),第二项对开仓量的限制会相应减少 ### 推导过程: 假设用户仓位为(a ETH,b VUSD) 做多情况下: a>0 && b<0 $$ MarginRate = {\dfrac{a*MarkPrice+b}{-b}} $$ 做空情况下:a<0 && b>0 $$ MarginRate = {\dfrac{a*MarkPrice+b}{b}} $$ 其中 $$ Margin_{acc} * MarkPrice_{acc} = {a*MarkPrice+b} $$ **参考:** ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b1580fc7-9fa9-4a88-805d-a350a30a917d/Untitled.png) ![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4bd91a57-527f-479f-a1b7-6f6ebef86b54/Untitled.png) ## info https://pacific-tuck-372.notion.site/Info-List-64d3bc57f281477594353a29a1774428 **Ver. 0.1** *Please consult Jerry before sharing outside of ApeX R&D.* # Creation - $BANA (Banana Power) is minted by locking up 150,000,000 $APEX (5%*3) from ApeX Treasury for min. 12-month. - After 12-month lock-up, remaining $BANA can be redeemed pro-rata back to $APEX. - Additional $BANA supply has to be approved by $APEX stakers via governance. It shall only happen if Trade-to-Earn is highly successful and $BANA are burnt faster than expected.( Additional $BANA will be minted at the current $BANA and $APEX locked ratio after buyback. ) # Trade-to-Earn Trade-to-Earn campaign will be conducted in **weekly** epochs (pending further discussion). ApeX Pro traders will earn $BANA based on a Cobb-Douglas function with fees + open interests + $BANA stake. $$ w = (f_t^\alpha × p^\beta+(f_r × \theta)^{\alpha+\beta}) × [Max(100, s)]^\gamma $$ $$ r = R × \dfrac{w}{W} $$ | Term | Definition | | --- | --- | | r | Reward for a specific trader. | | R | Total reward to be split between all traders for the epoch. | | w | Individual trader score | | W | Sum of all trader scores in this epoch | | f(t) | Total fees paid by a trader in this epoch | | f(r) | Total after-rebate fees paid by the trader’s referrals | | p | A trader’s average open interest across all markets in this epoch | | s | A trader’s average $BANA holding throughout the epoch | | α | 0.80 | | β | 0.15 | | γ | 0.05 | | θ | 0.10 | *Mostly following [dYdX’s design](https://docs.dydx.community/dydx-governance/rewards/trading-rewards), so that traders can easily migrate to ApeX.* # Distribution $BANA rewards for each epoch will be determined by a dynamic model: $$ R_t = R_{t-1} × \bigg(\dfrac{F_t}{F_{t-1}}\bigg)^\delta $$ $$ ⁍ $$ | Term | Definition | | --- | --- | | R(t) | Total reward to be distributed for this epoch | | R(t-1) | Total reward distributed for the previous epoch | | F(t) | Total fees paid by all traders in this epoch | | F(t-1) | Total fees paid by all traders in the previous epoch | | δ | 0.50 | *Higher fees → higher token rewards, with diminishing effect (δ < 1). Dynamic distribution will smoothen $BANA’s supply curve.* # Buy & Burn 50% of ApeX Pro fees will be put in a Buy & Burn Pool (BBP). The BBP will keep buying back $BANA, preferably via TWAMM swaps. All $BANA bought back will be burnt by default. Within each epoch, BBP’s buying activity shall be constant over time when measured in (USDT/s), i.e. the Buying Rate. The pool’s balance and Buying Rate shall be viewable and easily verifiable by all traders. The Buying Rate has to be determined before each epoch starts, based on data observed in previous 2 epochs. $$ B_t = B_{t-1} × \bigg(\dfrac{P_{t-2}}{P_{t-1}}\bigg)^\epsilon × \bigg(\dfrac{R_{t-1}}{R_{t-2}}\bigg)^\zeta $$ $$ B_3 = B_{2} × \bigg(\dfrac{P_{1}}{P_{2}}\bigg)^\epsilon × \bigg(\dfrac{R_{2}}{R_{1}}\bigg)^\zeta $$ | Term | Definition | | --- | --- | | B(t) | Buying Rate for the upcoming epoch | | B(t-1) | Buying Rate for the previous epoch | | P( ) | $BANA price after the end of the epoch | | R( ) | Total rewards distributed for the epoch | | ε | 1.00 | | ζ | 0.50 | *Price drop → higher buying rate; Higher emission → higher buying rate* # Paying Fees by $BANA $BANA holders can receive a significant discount (e.g. 30%) for using $BANA to pay for trading fees. $BANA paid as fees will be burnt. Fees paid by $BANA will not be counted into Trade-To-Earn or Affiliate programs. # **Ape Jackpot* - 20% of $BANA bought back on each epoch will be put into an Ape Jackpot. - Traders may lock up their $BANA at the start of each epoch for the chances to win the Jackpot: more $BANA locked = higher chance. - $BANA won via Ape Jackpot will be released at the end of the campaign (12-month after $BANA launch). # **Ape Avatar* *Trader may have a non-transferrable Ape avatar bonded to each address (soul-binding token). The Ape avatar may grow by feeding $BANA.* *More thought needed to make Ape avatar more entertaining.* # **Affiliates* - $APEX stakers and APEX NFT holders may earn commissions on their referred users. - Affiliate income on each epoch will be capped according to the account’s $APEX stake. - The excess income can be converted into fixed-term $APEX stake, and added to the affiliate’s account. *Typical fee-based affiliate program on top of Trade-to-Earn may form a fallacy of composition: traders will use affiliate commissions to reduce fee expense on the cost of APEX holders.* *Need further inputs from Bybit Affiliate operation to tailor ApeX’s program.*

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully