1 | <?php |
||
16 | class BittrexClient |
||
17 | { |
||
18 | /** |
||
19 | * Main URL to Bittrex Exchange |
||
20 | */ |
||
21 | private const BASE_URI = 'https://api.bittrex.com'; |
||
22 | |||
23 | private const CLIENT_HEADER = [ |
||
24 | 'User-Agent' => 'r3bers/bittrex-api/1.3.1', |
||
25 | 'Accept' => 'application/json', |
||
26 | 'Content-Type' => 'application/json' |
||
27 | ]; |
||
28 | |||
29 | /** @var Client */ |
||
30 | private $publicClient; |
||
31 | |||
32 | /** @var Client */ |
||
33 | private $privateClient; |
||
34 | |||
35 | /** @var string */ |
||
36 | private $key = ''; |
||
37 | |||
38 | /** @var string */ |
||
39 | private $secret = ''; |
||
40 | |||
41 | /** |
||
42 | * @return PublicApi |
||
43 | 1 | */ |
|
44 | public function public(): PublicApi |
||
48 | |||
49 | /** |
||
50 | * @return Client |
||
51 | 1 | */ |
|
52 | private function getPublicClient(): Client |
||
56 | |||
57 | /** |
||
58 | * @return Client |
||
59 | 1 | */ |
|
60 | private function createPublicClient(): Client |
||
69 | |||
70 | /** |
||
71 | * @param string $key |
||
72 | 4 | * @param string $secret |
|
73 | * @throws InvalidCredentialException |
||
74 | */ |
||
75 | 4 | public function setCredential(string $key, string $secret): void |
|
84 | |||
85 | /** |
||
86 | 4 | * @param string $md5 |
|
87 | * @return bool |
||
88 | 4 | */ |
|
89 | public function isValidMd5(string $md5 = ''): bool |
||
93 | |||
94 | /** |
||
95 | 2 | * @return Batch |
|
96 | * @throws InvalidCredentialException |
||
97 | 2 | */ |
|
98 | public function batch(): Batch |
||
102 | |||
103 | /** |
||
104 | 4 | * @return Client |
|
105 | * @throws InvalidCredentialException |
||
106 | 4 | */ |
|
107 | private function getPrivateClient(): Client |
||
111 | |||
112 | /** |
||
113 | 4 | * @return Client |
|
114 | * @throws InvalidCredentialException |
||
115 | 4 | */ |
|
116 | 2 | private function createPrivateClient(): Client |
|
132 | |||
133 | 5 | /** |
|
134 | * @return bool |
||
135 | */ |
||
136 | public function haveValidCredentials(): bool |
||
140 | 2 | ||
141 | /** |
||
142 | 2 | * @return Market |
|
143 | * @throws InvalidCredentialException |
||
144 | 1 | */ |
|
145 | public function market(): Market |
||
149 | |||
150 | /** |
||
151 | * @return Account |
||
152 | * @throws InvalidCredentialException |
||
153 | */ |
||
154 | public function account(): Account |
||
158 | } |