Completed
Push — master ( aa3009...686c2f )
by Mikhail
02:10
created

PublicApi::ping()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace R3bers\BittrexApi\Api;
6
7
use Exception;
8
9
/**
10
 * Class PublicApi
11
 * @package R3bers\BittrexApi\Api
12
 */
13
class PublicApi extends Api
14
{
15
    /**
16
     * @return array
17
     * @throws Exception
18
     */
19 1
    public function getMarkets(): array
20
    {
21 1
        return $this->rest('GET', '/markets');
22
    }
23
24
    /**
25
     * @return array
26
     * @throws Exception
27
     */
28 1
    public function getCurrencies(): array
29
    {
30 1
        return $this->rest('GET', '/currencies');
31
    }
32
33
    /**
34
     * @param string $market
35
     * @return array
36
     * @throws Exception
37
     */
38 1
    public function getTicker(string $market): array
39
    {
40 1
        return $this->rest('GET', '/markets/' . $market . '/ticker');
41
    }
42
43
    /**
44
     * @return array
45
     * @throws Exception
46
     */
47 1
    public function getMarketSummaries(): array
48
    {
49 1
        return $this->rest('GET', '/markets/summaries');
50
    }
51
52
    /**
53
     * @param string $market
54
     * @return array
55
     * @throws Exception
56
     */
57 1
    public function getMarketSummary(string $market): array
58
    {
59 1
        return $this->rest('GET', '/markets/' . $market . '/summary');
60
    }
61
62
    /**
63
     * @param string $market
64
     * @param int $depth
65
     * @return array
66
     * @throws Exception
67
     */
68 1
    public function getOrderBook(string $market, $depth = 25): array
69
    {
70 1
        $options = ['query' => ['depth' => $depth]];
71
72 1
        return $this->rest('GET', '/markets/' . $market . '/orderbook', $options);
73
    }
74
75
    /**
76
     * @param string $market
77
     * @return array
78
     * @throws Exception
79
     */
80 1
    public function getMarketHistory(string $market)
81
    {
82 1
        return $this->rest('GET', '/markets/' . $market . '/trades');
83
    }
84
85
    /**
86
     * @return array
87
     * @throws Exception
88
     */
89 1
    public function ping(): array
90
    {
91 1
        return $this->rest('GET', '/ping');
92
    }
93
94
}
95