Test Failed
Pull Request — master (#21)
by Vladislav
15:25 queued 07:09
created

OpenInterestRequest   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 158
rs 10
c 0
b 0
f 0
wmc 13

13 Methods

Rating   Name   Duplication   Size   Complexity  
A getCategory() 0 3 1
A setInterval() 0 4 1
A setSymbol() 0 4 1
A getCursor() 0 3 1
A getInterval() 0 3 1
A getStart() 0 3 1
A getLimit() 0 3 1
A getSymbol() 0 3 1
A setEnd() 0 4 1
A setLimit() 0 4 1
A setCursor() 0 4 1
A getEnd() 0 3 1
A setStart() 0 4 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\OpenInterest\Request;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Helpers\StringHelper;
7
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
8
use Carpenstar\ByBitAPI\Derivatives\MarketData\OpenInterest\Interfaces\IOpenInterestRequestInterface;
9
10
class OpenInterestRequest extends AbstractParameters implements IOpenInterestRequestInterface
11
{
12
    /**
13
     *
14
     * @var string $category
15
     */
16
    protected string $category = "linear";
17
18
    /**
19
     * Symbol name
20
     * @var string $symbol
21
     */
22
    protected string $symbol;
23
24
    /**
25
     * Interval. 5min 15min 30min 1h 4h 1d
26
     * @var string $interval
27
     */
28
    protected string $interval;
29
30
    /**
31
     * The start datetime
32
     * @var string $start
33
     */
34
    protected int $start;
35
36
    /**
37
     * The end datetime
38
     * @var string $end
39
     */
40
    protected int $end;
41
42
    /**
43
     * Limit for data size per page. [1, 200]. Default: 50
44
     * @var int $limit
45
     */
46
    protected int $limit = 50;
47
48
    /**
49
     * Cursor. Used for pagination
50
     * @var string $cursor
51
     */
52
    protected string $cursor;
53
54
    /**
55
     * @return string
56
     */
57
    public function getCategory(): string
58
    {
59
        return $this->category;
60
    }
61
62
    /**
63
     * @param string $symbol
64
     * @return OpenInterestRequest
65
     */
66
    public function setSymbol(string $symbol): self
67
    {
68
        $this->symbol = $symbol;
69
        return $this;
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function getSymbol(): string
76
    {
77
        return $this->symbol;
78
    }
79
80
    /**
81
     * @param string $interval
82
     * @return OpenInterestRequest
83
     */
84
    public function setInterval(string $interval): self
85
    {
86
        $this->interval = StringHelper::clearInterval($interval) . "min";
87
        return $this;
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getInterval(): string
94
    {
95
        return $this->interval;
96
    }
97
98
    /**
99
     * @param string $start
100
     * @return OpenInterestRequest
101
     */
102
    public function setStart(string $start): self
103
    {
104
        $this->start = DateTimeHelper::makeTimestampFromDateString($start);
105
        return $this;
106
    }
107
108
    /**
109
     * @return int
110
     */
111
    public function getStart(): int
112
    {
113
        return $this->start;
114
    }
115
116
    /**
117
     * @param string $end
118
     * @return OpenInterestRequest
119
     */
120
    public function setEnd(string $end): self
121
    {
122
        $this->end = DateTimeHelper::makeTimestampFromDateString($end);
123
        return $this;
124
    }
125
126
    /**
127
     * @return int
128
     */
129
    public function getEnd(): int
130
    {
131
        return $this->end;
132
    }
133
134
    /**
135
     * @param int $limit
136
     * @return OpenInterestRequest
137
     */
138
    public function setLimit(int $limit): self
139
    {
140
        $this->limit = $limit;
141
        return $this;
142
    }
143
144
    /**
145
     * @return int
146
     */
147
    public function getLimit(): int
148
    {
149
        return $this->limit;
150
    }
151
152
    /**
153
     * @param string $cursor
154
     * @return OpenInterestRequest
155
     */
156
    public function setCursor(string $cursor): self
157
    {
158
        $this->cursor = $cursor;
159
        return $this;
160
    }
161
162
    /**
163
     * @return string
164
     */
165
    public function getCursor(): string
166
    {
167
        return $this->cursor;
168
    }
169
}
170