Index Details

APX V2 MADETHUSD Index Details

How does it work?

drift=ļ¼ˆethCurrentPriceethLastSecondPriceāˆ’1ļ¼‰āˆ—3drift = ļ¼ˆ\frac{\mathrm{ethCurrentPrice}}{\mathrm{ethLastSecondPrice}} - 1ļ¼‰*3
Ļƒ=expectedvol3600āˆ—24āˆ—365\sigma = \frac{expected vol}{\sqrt{3600*24*365}}
norm=norminv(Random,0,1) norm = \text{norminv}\left(Random, 0, 1\right)
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]}

where:

  • Initial Sn=1000

  • dt=1

  • expected volļ¼š100%(expected vol is the expected time volatility of the MADETH)

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

Calculative process of random number:

import hashlib
from decimal import Decimal

# Assume the current ETHcoin price is 2508.3897
ethcoin_price = Decimal("2508.3897")

# Calculate the SHA-256 hash of the ETHcoin price
price_hash = hashlib.sha256(str(ethcoin_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 / (2**16)

print(random_number)

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

Last updated