Merge pull request #496 from obigal/cryptsy-api

Cryptsy api
This commit is contained in:
Sebastian Grewe 2013-07-21 22:31:11 -07:00
commit 9b091def60
2 changed files with 10 additions and 0 deletions

View File

@ -48,6 +48,8 @@ class Tools extends Base {
return 'coinchose'; return 'coinchose';
} else if (preg_match('/btc-e.com/', $url)) { } else if (preg_match('/btc-e.com/', $url)) {
return 'btce'; return 'btce';
} else if (preg_match('/cryptsy.com/', $url)) {
return 'cryptsy';
} }
$this->setErrorMessage("API URL unknown"); $this->setErrorMessage("API URL unknown");
return false; return false;
@ -73,6 +75,9 @@ class Tools extends Base {
case 'btce': case 'btce':
return $aData['ticker']['last']; return $aData['ticker']['last'];
break; break;
case 'cryptsy':
return $aData['return']['markets'][$strCurrency]['lasttradeprice'];
break;
} }
// Catchall, we have no data extractor for this API url // Catchall, we have no data extractor for this API url
$this->setErrorMessage("Undefined API to getPrice() on URL " . $this->config['price']['url']); $this->setErrorMessage("Undefined API to getPrice() on URL " . $this->config['price']['url']);

View File

@ -73,6 +73,11 @@ $config['wallet']['password'] = 'testnet';
* url = `http://www.coinchoose.com` * url = `http://www.coinchoose.com`
* target = `/api.php` * target = `/api.php`
* currency = `BTC` * currency = `BTC`
*
* Optional (cryptsy.com):
* url = `https://www.cryptsy.com`
* target = `/api.php?method=marketdata`
* currency = `BTC`
**/ **/
$config['price']['url'] = 'https://btc-e.com'; $config['price']['url'] = 'https://btc-e.com';
$config['price']['target'] = '/api/2/ltc_usd/ticker'; $config['price']['target'] = '/api/2/ltc_usd/ticker';