<?php 


$api_key = 'ATKpagYXMd22yzPfCm';
$secret_key = 'rTj3hThcJ5gvo4yRwB29bvXDQB90xh3tRuQI';
$timestamp = round(microtime(true) * 1000); // Current timestamp in milliseconds

$params = [
    'accountType' => 'UNIFIED',
    'api_key' => $api_key,
    'coin' => 'BOME',
    'timestamp' => $timestamp,
];

// Sort the parameters by key
ksort($params);

// Build the query string
$query_string = http_build_query($params, '', '&', PHP_QUERY_RFC3986);

// Generate the signature
$sign = hash_hmac('sha256', $query_string, $secret_key);

// Add the signature to the parameters
$params['sign'] = $sign;

// Build the final URL
$url = "https://api.bybit.com/v5/account/wallet-balance?" . http_build_query($params);

// Initialize cURL session
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the request
$response = curl_exec($ch);
curl_close($ch);

// Display the response
$response_data = json_decode($response, true);

$walletBalance = $response_data['result']['list'][0]['coin'][0]['walletBalance'];

echo 'Wallet Balance : '.$walletBalance;
echo '<pre>';
print_r($response_data);



?>