<?php 

$apiKey = 'ZwEzFeiqnVo356Our9';
$apiSecret = 'pKpGWLUSjwnXP3A2QXEhTuc5O30cSvXwoSMp';
$curl = curl_init();
$url="https://api.bybit.com";
function http_req($endpoint,$method,$params,$Info)
{
    global $apiKey, $apiSecret, $url, $curl;
    $timestamp = time() * 1000;
    $params_for_signature= $timestamp . $apiKey . "5000" . $params;
    $signature = hash_hmac('sha256', $params_for_signature, $apiSecret);
    if($method=="GET")
    {
        $endpoint=$endpoint . "?" . $params;
    }

    curl_setopt_array($curl, array(
        CURLOPT_URL => $url . $endpoint,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => $method,
        CURLOPT_POSTFIELDS => $params,
        CURLOPT_HTTPHEADER => array(
          "X-BAPI-API-KEY: $apiKey",
          "X-BAPI-SIGN: $signature",
          "X-BAPI-SIGN-TYPE: 2",
          "X-BAPI-TIMESTAMP: $timestamp",
          "X-BAPI-RECV-WINDOW: 5000",
          "Content-Type: application/json"
        ),
      ));
    if($method=="GET")
    {
      curl_setopt($curl, CURLOPT_HTTPGET, true);
    }
   // echo $Info . "\n";
    $response = curl_exec($curl);
  
    return $response;
}


#Get Order List
$endpoint="/v5/account/wallet-balance";
$method="GET";
$params="accountType=UNIFIED";

$result=http_req($endpoint,$method,$params,"Account Balance");

echo $result;
$result=json_decode($result,true);
$list=$result['list'];
echo '<pre>';
print_r($list);
echo '</pre>';
?>