ftx api key bilginizi girerek bakiyenizi sorgulayabilirsiniz. öyle sınıf fonksiyon hepsinin amk. al direk temiz kullan. api key ve secret bilginizi girmeyi unutmayınız.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
<?php // API keys. $keys = array( 'apiKey'=> '', 'secretKey'=> '' ); // Get current time * 1000 to make sure I get a timestamp in milliseconds. API asks for it this way. $timestamp = time() * 1000; // Base url for all api calls. $baseURL = 'https://ftx.com/api'; // Specified url endpoint. This comes after the baseUrl. $endPoint = '/wallet/balances'; // Data that should be added to the encryption of the keys. $signature = $timestamp . 'GET/api' . $endPoint; // Hashing the secret key. $secret = hash_hmac('sha256', $signature, $keys['secretKey']); // For account data $url = $baseURL . $endPoint; // Init session for CURL. $ch = curl_init(); // Options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_FAILONERROR, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Init headers for access to the FTX API signed data. $headers = array(); $headers[] = 'Accept: application/json'; $headers[] = 'Content-Type: application/json'; $headers[] = 'FTX-KEY: ' . $keys['apiKey']; $headers[] = 'FTX-SIGN: ' . $secret; $headers[] = 'FTX-TS: ' . $timestamp; // Setting headers curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Execute request. $result = curl_exec($ch); if (curl_errno($ch)) { echo(curl_error($ch)); exit(); } // Ends the CURL session, frees all resources and deletes the curl (ch). curl_close($ch); echo($result); ?> |