Back to Ccxt

Gateio Watch Balance

wiki/examples/php/gateio-watch-balance.md

4.5.571.3 KB
Original Source
php
<?php
namespace ccxt;
include_once (__DIR__.'/../../ccxt.php');
// ----------------------------------------------------------------------------

// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

// -----------------------------------------------------------------------------

error_reporting(E_ALL);
date_default_timezone_set('UTC');

use ccxt\Precise;
use React\Async;
use React\Promise;


// AUTO-TRANSPILE //
'use strict';


var_dump('CCXT Version:', $ccxt->version); // eslint-disable-line import/no-named-as-default-member


function main() {
   return Async\async(function () {
       $exchange = new \ccxt\pro\gate(array(
           'apiKey' => 'YOUR_API_KEY',
           'secret' => 'YOUR_SECRET',
       ));
       \React\Async\await($exchange->load_markets());
       $exchange->verbose = true;
       while (true) {
           try {
               $response = \React\Async\await($exchange->watch_balance());
               var_dump(new Date(), $response);
           } catch(Exception $e) {
               var_dump($e);
               \React\Async\await($exchange->sleep(1000));
           }
       }
   }) ();
}


main();