Cryptorush API Price Ticker
Simple yet effective way to get ticker cron to use the Cryptorush.in API via get=all parameter. Just enter on your global cfg file: $config['price']['url'] = 'https://cryptorush.in'; $config['price']['target'] = '/api.php?get=all&key=YOUR_API_KEY&id=YOUR_USER_ID'; $config['price']['currency'] = 'COIN'; and run the cron. Enjoy!
This commit is contained in:
parent
af3f164daa
commit
790617dd11
@ -55,6 +55,8 @@ class Tools extends Base {
|
||||
return 'btce';
|
||||
} else if (preg_match('/cryptsy.com/', $url)) {
|
||||
return 'cryptsy';
|
||||
} else if (preg_match('/cryptorush.in/', $url)) {
|
||||
return 'cryptorush';
|
||||
}
|
||||
$this->setErrorMessage("API URL unknown");
|
||||
return false;
|
||||
@ -66,6 +68,7 @@ class Tools extends Base {
|
||||
public function getPrice() {
|
||||
$aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']);
|
||||
$strCurrency = $this->config['currency'];
|
||||
$strCurrencyBTC = "$strCurrency/BTC";
|
||||
// Check the API type for configured URL
|
||||
if (!$strApiType = $this->getApiType($this->config['price']['url']))
|
||||
return false;
|
||||
@ -84,6 +87,9 @@ class Tools extends Base {
|
||||
case 'cryptsy':
|
||||
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
|
||||
break;
|
||||
case 'cryptorush':
|
||||
return @$aData[$strCurrencyBTC]['last_trade'];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$this->setErrorMessage("Got an invalid response from ticker API");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user