mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
- [Coinbase Fetch All Balances](./examples/php/)
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
include './ccxt.php';
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$exchange = new \ccxt\coinbase(array(
|
||||
'apiKey' => 'YOUR_API_KEY',
|
||||
'secret' => 'YOUR_SECRET',
|
||||
// 'verbose' => true, // uncomment for debugging
|
||||
));
|
||||
|
||||
$exchange->load_markets();
|
||||
|
||||
// $exchange->verbose = true; // uncomment for debugging
|
||||
|
||||
$result = array();
|
||||
$params = array();
|
||||
$loop = true;
|
||||
do {
|
||||
$balance = $exchange->fetch_balance($params);
|
||||
$pagination = $exchange->safe_value($balance['info'], 'pagination');
|
||||
if ($pagination === null) {
|
||||
$loop = false;
|
||||
} else {
|
||||
$next_starting_after = $exchange->safe_string ($pagination, 'next_starting_after');
|
||||
if ($next_starting_after !== null) {
|
||||
$params['starting_after'] = $next_starting_after;
|
||||
} else {
|
||||
$loop = false;
|
||||
}
|
||||
}
|
||||
echo $exchange->iso8601($exchange->milliseconds()) . "\n";
|
||||
$result = $exchange->deep_extend($result, $balance);
|
||||
} while ($loop);
|
||||
|
||||
echo "======================================================================\n";
|
||||
var_dump($result);
|
||||
|
||||
?>
|
||||
```
|
||||
Reference in New Issue
Block a user