Skip to content

Instantly share code, notes, and snippets.

@bakman2
Created January 13, 2018 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakman2/2c27c2346b8dd09eb5c3eb4ac41de522 to your computer and use it in GitHub Desktop.
Save bakman2/2c27c2346b8dd09eb5c3eb4ac41de522 to your computer and use it in GitHub Desktop.
debug.php
<?php
include 'functions.php';
include platformSlashes("lib/ccxt.php");
$allcoins = file_get_contents(platformSlashes('lib/data/coinlist.json'));
$coinList = json_decode($allcoins, true);
echo "debug...";
echo sizeof($config['api']). " keys found.<br/><br/>";
if(isset($config['api']) && sizeof($config['api'])>0){
foreach ($config['api'] as $key => $value) {
$c = '\ccxt\\'.$key;
try {
$out = new $c ( array ( 'apiKey' => $config['api'][$key]['api'], 'secret' => $config['api'][$key]['secret'] ));
foreach ($out->fetch_balance()['total'] as $k => $v) {
if($v>0.0009){
if(isset($coinList['Data'][$k]['CoinName'])){
echo $key . ": symbol: ".$k." : ". $coinList['Data'][$k]['CoinName']. " balance:". $v."<br/>";
$coindata['coins'][$key][$k]['wallettype'] = 'exchange';
$coindata['coins'][$key][$k]['walletname'] = $key;
$coindata['coins'][$key][$k]['name'] = $coinList['Data'][$k]['CoinName'];
$coindata['coins'][$key][$k]['fullname'] = $coinList['Data'][$k]['FullName'];
$coindata['coins'][$key][$k]['owned'] = $v;
}
}
}
}
catch (Exception $e) {
echo $e->getMessage ();
}
}
}
if(isset($coindata) && sizeof($coindata)>0){
foreach ($coindata['coins'] as $key => $val) {
foreach ($val as $i => $v) {
if($v['owned']>0.001 || $v['walletname']=='watch'){
$output[] = array("symbol"=>$i, "name"=>$v['name'], "wallettype"=>$v['wallettype'], "walletname"=>$v['walletname'], "coinsOwned"=>$v['owned'], "fullName"=>$v['fullname'], "image"=>symbol_lookup($i));
$coins = $output;
}
}
}
}
echo "<br/>";
print_r($coins);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment