Market   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 11
c 1
b 0
f 0
dl 0
loc 56
ccs 14
cts 14
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A buyLimit() 0 5 1
A sellLimit() 0 5 1
A cancel() 0 5 1
A getOpenOrders() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Codenixsv\BittrexApi\Api;
6
7
use Exception;
8
9
/**
10
 * Class Market
11
 * @package Codenixsv\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 1
    public function buyLimit(string $market, float $quantity, float $rate): array
23
    {
24 1
        $parameters = ['market' => $market, 'quantity' => $quantity, 'rate' => $rate];
25
26 1
        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 1
    public function sellLimit(string $market, float $quantity, float $rate): array
37
    {
38 1
        $parameters = ['market' => $market, 'quantity' => $quantity, 'rate' => $rate];
39
40 1
        return $this->get('/market/selllimit', $parameters);
41
    }
42
43
    /**
44
     * @param string $uuid
45
     * @return array
46
     * @throws Exception
47
     */
48 1
    public function cancel(string $uuid): array
49
    {
50 1
        $parameters = ['uuid' => $uuid];
51
52 1
        return $this->get('/market/cancel', $parameters);
53
    }
54
55
    /**
56
     * @param string|null $market
57
     * @return array
58
     * @throws Exception
59
     */
60 2
    public function getOpenOrders(?string $market = null): array
61
    {
62 2
        $parameters = [];
63
64 2
        if (!is_null($market)) {
65 1
            $parameters['market'] = $market;
66
        }
67
68 2
        return $this->get('/market/getopenorders', $parameters);
69
    }
70
}
71