Perguntas Frequentes do MADBTCUSD
Como o índice MADBTCUSD é calculado?
MADBTCUSD é calculado com base na seguinte fórmula:
Índice MADBTCUSD
Onde:
Initial Sn=1000
dt=1
vol esperado: 100% (vol esperado é a volatilidade de tempo esperada do MADBTC)
o "número aleatório" é calculado com base no preço atual do BTC com 8 casas decimais de precisão
Cálculo do número aleatório:
import hashlib
from decimal import Decimal
# Assume the current price of Bitcoin is 48923.56789101
bitcoin_price = Decimal("48923.56789101")
# Calculate the SHA-256 hash of the Bitcoin price
price_hash = hashlib.sha256(str(bitcoin_price).encode('utf-8')).hexdigest()
# Extract the first 8 hexadecimal numbers from the hash
hash_substring = price_hash[:8]
# Converts a hexadecimal string to an integer
hash_integer = int(hash_substring, 16)
# Divide the integer by 4294967296 (the decimal number corresponding to the hexadecimal number FFFFFFFF) to get a num
random_number = hash_integer / 4294967296
# Print the random number
print(random_number)
Se o número aleatório determinado for 0, ele será recalculado novamente
Onde posso verificar o preço histórico do BTC e do MADBTCUSD?
O feed de preços BTC e MADBTCUSD pode ser encontrado aqui:
Dados históricos de backtest de BTC e MADBTC
Para verificar os preços históricos do BTC e MADBTC, fornecemos um gráfico de backtest abaixo.

Last updated
Was this helpful?