1: <?php
2: namespace Sotr\Crypto\Bitstamp;
3:
4: use RuntimeException;
5:
6: use Sotr\Crypto\AbstractApi;
7: use Sotr\Crypto\CurrencyPair;
8: use Sotr\Crypto\Ticker;
9:
10: class BitstampApi extends AbstractApi
11: {
12: public function getPublicBaseUri()
13: {
14: return 'https://www.bitstamp.net/api';
15: }
16:
17: public function getTradingBaseUri()
18: {
19: return 'https://www.bitstamp.net/api';
20: }
21:
22: public function getTicker(CurrencyPair $pair = null)
23: {
24: $response = $this->client->request('GET', $this->getPublicBaseUri() . '/ticker');
25: $data = json_decode($response->getBody()->getContents());
26: return new Ticker(
27: $data->last,
28: $data->high,
29: $data->low,
30: $data->bid,
31: $data->ask
32: );
33: }
34:
35: public function getBalance()
36: {
37: return RuntimeException('Method not allowed in this exchange');
38: }
39: }
40: