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';
|
return 'btce';
|
||||||
} else if (preg_match('/cryptsy.com/', $url)) {
|
} else if (preg_match('/cryptsy.com/', $url)) {
|
||||||
return 'cryptsy';
|
return 'cryptsy';
|
||||||
|
} else if (preg_match('/cryptorush.in/', $url)) {
|
||||||
|
return 'cryptorush';
|
||||||
}
|
}
|
||||||
$this->setErrorMessage("API URL unknown");
|
$this->setErrorMessage("API URL unknown");
|
||||||
return false;
|
return false;
|
||||||
@ -66,6 +68,7 @@ class Tools extends Base {
|
|||||||
public function getPrice() {
|
public function getPrice() {
|
||||||
$aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']);
|
$aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']);
|
||||||
$strCurrency = $this->config['currency'];
|
$strCurrency = $this->config['currency'];
|
||||||
|
$strCurrencyBTC = "$strCurrency/BTC";
|
||||||
// Check the API type for configured URL
|
// Check the API type for configured URL
|
||||||
if (!$strApiType = $this->getApiType($this->config['price']['url']))
|
if (!$strApiType = $this->getApiType($this->config['price']['url']))
|
||||||
return false;
|
return false;
|
||||||
@ -84,6 +87,9 @@ class Tools extends Base {
|
|||||||
case 'cryptsy':
|
case 'cryptsy':
|
||||||
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
|
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
|
||||||
break;
|
break;
|
||||||
|
case 'cryptorush':
|
||||||
|
return @$aData[$strCurrencyBTC]['last_trade'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->setErrorMessage("Got an invalid response from ticker API");
|
$this->setErrorMessage("Got an invalid response from ticker API");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user