Completed
Push — master ( c44990...b4ec9a )
by Mikhail
01:07
created

Market   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 58
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A buyLimit() 0 6 1
A sellLimit() 0 6 1
A cancel() 0 6 1
A getOpenOrders() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace R3bers\BittrexApi\Api;
6
7
use Exception;
8
9
/**
10
 * Class Market
11
 * @package R3bers\BittrexApi\Api
12
 */
13
class Market extends Api
14
{
15
    /**
16
     * @param string $market
17
     * @param float $quantity
18
     * @param float $rate
19
     * @return array
20
     * @throws Exception
21
     */
22
    public function buyLimit(string $market, float $quantity, float $rate): array
23
    {
24
        $parameters = ['market' => $market, 'quantity' => $quantity, 'rate' => $rate];
25
26
        return $this->get('/market/buylimit', $parameters);
27
    }
28
29
    /**
30
     * @param string $market
31
     * @param float $quantity
32
     * @param float $rate
33
     * @return array
34
     * @throws Exception
35
     */
36
    public function sellLimit(string $market, float $quantity, float $rate): array
37
    {
38
        $parameters = ['market' => $market, 'quantity' => $quantity, 'rate' => $rate];
39
40
        return $this->get('/market/selllimit', $parameters);
41
    }
42
43
    /**
44
     * @param string $uuid
45
     * @return array
46
     * @throws Exception
47
     */
48
    public function cancel(string $uuid): array
49
    {
50
        $parameters = ['uuid' => $uuid];
51
52
        return $this->get('/market/cancel', $parameters);
53
    }
54
55
    /**
56
     * @param string|null $market
57
     * @return array
58
     * @throws Exception
59
     */
60
    public function getOpenOrders(?string $market = null): array
61
    {
62
        $parameters = [];
63
64
        if (!is_null($market)) {
65
            $parameters['market'] = $market;
66
        }
67
68
        return $this->get('/market/getopenorders', $parameters);
69
    }
70
}
71