Back to Ccxt

Hyperliquid Load Hip3 Dexes

wiki/examples/php/hyperliquid-load-hip3-dexes.md

4.5.521.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 //
function example() {
   return Async\async(function () {
       $exchange = new \ccxt\async\hyperliquid(array(
           'options' => array(
               'fetchMarkets' => array(
                   'hip3' => array(
                       'dexes' => ['flx', 'xyz'],
                       'limit' => 10,
                   ),
               ),
           ),
       ));
       Async\await($exchange->load_markets());
       $markets = is_array($exchange->markets) ? array_values($exchange->markets) : array();
       for ($i = 0; $i < count($markets); $i++) {
           $market = $markets[$i];
           if ($market['info']['hip3']) {
               var_dump($market['symbol'], 'from DEX');
           }
       }
   }) ();
}


Async\await(example());