APX Finance
  • 🚀What is APX Finance?
  • 🌙Brand Logo & Guidelines
  • Welcome
    • 📄$APX Token & Contracts
      • ⚡Allocation
      • 🔥Token Burn
      • 💲Tax
    • 💎ALP Liquidity Pool
      • 💡How to buy ALP?
      • 💡How to stake/unstake?
      • 💡How to sell?
      • 💡Fees for buying and selling ALP
      • ‼️Risk
    • ⛓️Trading on V2
      • ❓How does it work?
      • ⬇️How to interact directly with the contract
      • 🤝Powered by Pyth Oracle and Chainlink
      • 🐸Degen Trading Mode
        • 💰Dynamic close fee for Degen Mode
      • 🎰V2 Fees & Slippage
      • 💢MAD perpetual contracts
        • 💢MADBTCUSD
          • Index Details
        • 💢MADETHUSD
          • Index Details
        • 💢MADCAKEUSD
          • Index Details
      • 😎Dumb Mode
        • How to place orders
      • 📃DEGEN Inscriptions Airdrop
      • 📈Forex
      • 👥APX V2 Referral
      • 📖APX Testnet Walk through [Inactive]
      • 💡FAQ
        • 💡Connect wallet
        • 💡Opening a position
        • 💡How to place stop orders?
        • 💡Position management
        • 💡One click close all position feature
        • 💡Order Types
      • 📹Video Tutorials (V2)
    • 👋Trading on V1
      • 📡Pre-Launch Markets
        • BLAST Pre-Launch Futures
      • 💰Wallet Connection
      • 💡How to start trading on APX V1?
        • 💸Deposit & Withdrawal
        • 🪜Margin Mode & Leverage
        • ⬆️Position Mode
        • 💻Order Types
          • TP/SL orders (Strategy Order)
          • Trailing Stop Order
        • 🛑Closing Positions
        • 📈Grid Trading
          • 👾Set-up Your Grid Trading Strategy
          • 👾Futures Grid Trading Auto Parameters Guide
          • 👾Long/Short Grid Trading introduction
        • 💡Lite Mode
      • ❓FAQ
        • ❓Multi-Assets Mode
        • ❓How to Adjust the Margin Balance in Cross/Isolated Margin Modes
        • ❓How to Calculate the Cost of Opening a USDⓈ-M Perpetual Futures Contract Position
        • ❓Mark Price in USDⓈ-M Perpetual Futures Contracts
        • ❓Funding Rate
        • ❓Auto-Deleveraging (ADL)
        • ❓APX Futures Liquidation Protocol
        • ❓Delisting Process of A Futures Contract
        • ❓APX DEX Referral Guidelines
        • ❓How to Whitelist APX Emails?
      • 📹Video Tutorial (V1)
  • Features & Tutorials
    • ℹ️General
      • 💡What is Gas Fee?
      • 💡How to switch network?
      • 💡How to change language
      • 💡How to bind your social media account to receive notifications
    • 🖥️All about APX Web
      • 💡How to Connect Your Wallet? (Web version)
      • 💡How to find your DEX UID? (Web)
    • ⛓️Permissionless DEX Engine
      • Features and benefits of permissionless solution
      • FAQs
    • 👾Trading
      • 💡How to Buy Crypto on APX DEX via BANXA
      • 💡How to check your balance (V1)
      • 💡How to use Multi-Assets Mode
      • 💡How-to Guide: Use BONUSUSD to trade crypto futures on APX V1
  • Programs
    • 📞V2 ARB Incentive Season (Trading)
    • 📣V2 ARB Incentive Season (Weekly Bonus, ALP Staking)
    • 💰$100,000 Binance Web3 Wallet Trading Campaign Tutorial
    • 🪂Strategic Partnership with Lista DAO - Cosmic Adventure Challenge
    • 📏V2 Trading Rewards
    • ⛏️Retroactive Mining Rewards
  • APX DAO
    • 👨‍🚀How To Participate?
    • 📫DAO Staking
      • 🎫Get Voting Power
      • ⚡Staking Rewards & Repurchased Tokens
      • ⚡Trading Benefits
      • ⚡Penalty Fee
    • 🍀Governance
      • 🌡️Temperature Check
      • 🤚Standards for raising DAO proposals
  • API
    • 🖱️Create API
    • 💾API Documentation
  • Community
    • 🔗Social Media & Communities
  • About Us
    • 🗺️Roadmap
      • 🍁2023 Roadmap
      • 🍁2022 Milestones
      • 🍁2021-2022 Roadmap
    • 🔖Audit Reports
    • APX Team
    • Privacy Policy
    • Terms of Use
    • Restriction
Powered by GitBook
On this page
  1. Welcome
  2. Trading on V2
  3. MAD perpetual contracts
  4. MADCAKEUSD

Index Details

PreviousMADCAKEUSDNextDumb Mode

Last updated 1 year ago

APX V2 MADCAKEUSD Index Details

How does it work?

drift=(cakeCurrentPricecakeLastSecondPrice−1)∗3drift = (\frac{\mathrm{cakeCurrentPrice}}{\mathrm{cakeLastSecondPrice}} - 1)*3drift=(cakeLastSecondPricecakeCurrentPrice​−1)∗3
σ=expectedvol3600∗24∗365\sigma = \frac{expected vol}{\sqrt{3600*24*365}} σ=3600∗24∗365​expectedvol​
norm=norminv(Random,0,1) norm = \text{norminv}\left(Random, 0, 1\right) norm=norminv(Random,0,1)
Sn+1=Sn∗e[(drift−σ22)∗dt+σ∗dt∗norm]S_{n+1} =S_{n} * e^{\left[\left({drift} - \frac{\sigma^2}{2}\right) * dt + \sigma * \sqrt{dt} * norm\right]} Sn+1​=Sn​∗e[(drift−2σ2​)∗dt+σ∗dt​∗norm]

where:

  • Initial Sn=1000

  • dt=1

  • expected vol:100%(expected vol is the expected time volatility of the MADCAKE)

  • the "Random number" is calculated based on the current CAKE price with 8 decimal places of precision

import hashlib
from decimal import Decimal

# Assume the current Cakecoin price is 2.56788991
Cakecoin_price = Decimal("2.56788991")

# Calculate the SHA-256 hash of the Cakecoin price
price_hash = hashlib.sha256(str(Cakecoin_price).encode("utf-8")).hexdigest()

# Extract the first 4 hexadecimal digits from the hash
hash_substring = price_hash[:4]

# Convert the hexadecimal string to an integer
hash_integer = int(hash_substring, 16)

# Divide the integer by 65535 (the decimal value of the hexadecimal number FFFF), to get a number between 0 and 1
random_number = hash_integer / 65536

print(random_number)

If the random number is counted as 0, MADCAKE price will stay the same

⛓️
💢
💢