1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace R3bers\BittrexApi\Api; |
6
|
|
|
|
7
|
|
|
use Exception; |
8
|
|
|
use GuzzleHttp\Exception\GuzzleException; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class PublicApi |
12
|
|
|
* @package R3bers\BittrexApi\Api |
13
|
|
|
*/ |
14
|
|
|
class PublicApi extends Api |
15
|
|
|
{ |
16
|
|
|
/** https://bittrex.github.io/api/v3#operation--markets-get |
17
|
|
|
* @return array |
18
|
|
|
* @throws Exception|GuzzleException |
19
|
|
|
*/ |
20
|
1 |
|
public function getMarkets(): array |
21
|
|
|
{ |
22
|
1 |
|
return $this->rest('GET', '/markets'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** https://bittrex.github.io/api/v3#operation--currencies-get |
26
|
|
|
* @return array |
27
|
|
|
* @throws Exception|GuzzleException |
28
|
|
|
*/ |
29
|
1 |
|
public function getCurrencies(): array |
30
|
|
|
{ |
31
|
1 |
|
return $this->rest('GET', '/currencies'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** https://bittrex.github.io/api/v3#operation--markets-tickers-get |
35
|
|
|
* @return array |
36
|
|
|
* @throws Exception|GuzzleException |
37
|
|
|
*/ |
38
|
1 |
|
public function getTickers(): array |
39
|
|
|
{ |
40
|
1 |
|
return $this->rest('GET', '/markets/tickers'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** https://bittrex.github.io/api/v3#operation--markets--marketSymbol--ticker-get |
44
|
|
|
* @param string $market |
45
|
|
|
* @return array |
46
|
|
|
* @throws Exception|GuzzleException |
47
|
|
|
*/ |
48
|
1 |
|
public function getTicker(string $market): array |
49
|
|
|
{ |
50
|
1 |
|
return $this->rest('GET', '/markets/' . $market . '/ticker'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** https://bittrex.github.io/api/v3#operation--markets-summaries-get |
54
|
|
|
* @return array |
55
|
|
|
* @throws Exception|GuzzleException |
56
|
|
|
*/ |
57
|
1 |
|
public function getMarketSummaries(): array |
58
|
|
|
{ |
59
|
1 |
|
return $this->rest('GET', '/markets/summaries'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** https://bittrex.github.io/api/v3#operation--markets--marketSymbol--summary-get |
63
|
|
|
* @param string $market |
64
|
|
|
* @return array |
65
|
|
|
* @throws Exception|GuzzleException |
66
|
|
|
*/ |
67
|
1 |
|
public function getMarketSummary(string $market): array |
68
|
|
|
{ |
69
|
1 |
|
return $this->rest('GET', '/markets/' . $market . '/summary'); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** https://bittrex.github.io/api/v3#operation--markets--marketSymbol--orderbook-get |
73
|
|
|
* @param string $market |
74
|
|
|
* @param int $depth |
75
|
|
|
* @return array |
76
|
|
|
* @throws Exception|GuzzleException |
77
|
|
|
*/ |
78
|
1 |
|
public function getOrderBook(string $market, int $depth = 25): array |
79
|
|
|
{ |
80
|
1 |
|
$options = ['query' => ['depth' => $depth]]; |
81
|
|
|
|
82
|
1 |
|
return $this->rest('GET', '/markets/' . $market . '/orderbook', $options); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** https://bittrex.github.io/api/v3#operation--markets--marketSymbol--trades-get |
86
|
|
|
* @param string $market |
87
|
|
|
* @return array |
88
|
|
|
* @throws Exception|GuzzleException |
89
|
|
|
*/ |
90
|
1 |
|
public function getMarketHistory(string $market): array |
91
|
|
|
{ |
92
|
1 |
|
return $this->rest('GET', '/markets/' . $market . '/trades'); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** https://bittrex.github.io/api/v3#operation--ping-get |
96
|
|
|
* @return array |
97
|
|
|
* @throws Exception|GuzzleException |
98
|
|
|
*/ |
99
|
1 |
|
public function ping(): array |
100
|
|
|
{ |
101
|
1 |
|
return $this->rest('GET', '/ping'); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
} |