Market::sellLimit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
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