From 790617dd11e54d38ad511380c4548d98634251d6 Mon Sep 17 00:00:00 2001 From: jamieede Date: Wed, 12 Mar 2014 16:48:31 +0000 Subject: [PATCH 1/2] 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! --- public/include/classes/tools.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/include/classes/tools.class.php b/public/include/classes/tools.class.php index 8778a2004..9a39a8e46 100644 --- a/public/include/classes/tools.class.php +++ b/public/include/classes/tools.class.php @@ -55,6 +55,8 @@ private function getApiType($url) { 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 @@ private function getApiType($url) { 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 @@ public function getPrice() { 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"); From 0b765417f28f567963fc2387a9cb6aa809163e35 Mon Sep 17 00:00:00 2001 From: jamieede Date: Wed, 12 Mar 2014 17:20:22 +0000 Subject: [PATCH 2/2] The hacky way simplified. Removed variable --- public/include/classes/tools.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/include/classes/tools.class.php b/public/include/classes/tools.class.php index 9a39a8e46..230508d5d 100644 --- a/public/include/classes/tools.class.php +++ b/public/include/classes/tools.class.php @@ -68,7 +68,6 @@ private function getApiType($url) { 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; @@ -88,7 +87,7 @@ public function getPrice() { return @$aData['return']['markets'][$strCurrency]['lasttradeprice']; break; case 'cryptorush': - return @$aData[$strCurrencyBTC]['last_trade']; + return @$aData["$strCurrency/BTC"]['last_trade']; break; } } else {