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

Account::getDepositAddress()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace R3bers\BittrexApi\Api;
6
7
use Exception;
8
9
/**
10
 * Class Account
11
 * @package R3bers\BittrexApi\Api
12
 */
13
class Account extends Api
14
{
15
    /**
16
     * @return array
17
     * @throws Exception
18
     */
19
    public function getBalances(): array
20
    {
21
        return $this->get('/account/getbalances');
22
    }
23
24
    /**
25
     * @param string $currency
26
     * @return array
27
     * @throws Exception
28
     */
29
    public function getBalance(string $currency): array
30
    {
31
        $parameters = ['currency' => $currency];
32
33
        return $this->get('/account/getbalance', $parameters);
34
    }
35
36
    /**
37
     * @param string $currency
38
     * @return array
39
     * @throws Exception
40
     */
41
    public function getDepositAddress(string $currency): array
42
    {
43
        $parameters = ['currency' => $currency];
44
45
        return $this->get('/account/getdepositaddress', $parameters);
46
    }
47
48
    /**
49
     * @param string $currency
50
     * @param float $quantity
51
     * @param string $address
52
     * @param string|null $paymentId
53
     * @return array
54
     * @throws Exception
55
     */
56
    public function withdraw(string $currency, float $quantity, string $address, ?string $paymentId = null): array
57
    {
58
        $parameters = ['currency' => $currency, 'quantity' => (string)$quantity, 'address' => $address];
59
60
        if (!is_null($paymentId)) {
61
            $parameters['paymentid'] = $paymentId;
62
        }
63
64
        return $this->get('/account/withdraw', $parameters);
65
    }
66
67
    /**
68
     * @param string $uuid
69
     * @return array
70
     * @throws Exception
71
     */
72
    public function getOrder(string $uuid): array
73
    {
74
        $parameters = ['uuid' => $uuid];
75
76
        return $this->get('/account/getorder', $parameters);
77
    }
78
79
    /**
80
     * @param string|null $market
81
     * @return array
82
     * @throws Exception
83
     */
84
    public function getOrderHistory(?string $market = null): array
85
    {
86
        $parameters = [];
87
88
        if (!is_null($market)) {
89
            $parameters['market'] = $market;
90
        }
91
92
        return $this->get('/account/getorderhistory', $parameters);
93
    }
94
95
    /**
96
     * @param string|null $currency
97
     * @return array
98
     * @throws Exception
99
     */
100
    public function getWithdrawalHistory(string $currency = null): array
101
    {
102
        $parameters = [];
103
104
        if (!is_null($currency)) {
105
            $parameters['currency'] = $currency;
106
        }
107
108
        return $this->get('/account/getwithdrawalhistory', $parameters);
109
    }
110
111
    /**
112
     * @param string|null $currency
113
     * @return array
114
     * @throws Exception
115
     */
116
    public function getDepositHistory(?string $currency = null): array
117
    {
118
        $parameters = [];
119
120
        if (!is_null($currency)) {
121
            $parameters['currency'] = $currency;
122
        }
123
124
        return $this->get('/account/getdeposithistory', $parameters);
125
    }
126
}
127