Passed
Push — master ( 420501...55c755 )
by Vladislav
04:26 queued 02:03
created

KlineRequest   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 143
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 143
rs 10
c 0
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getSymbol() 0 3 1
A setLimit() 0 4 1
A setSymbol() 0 4 1
A getStart() 0 3 1
A getCategory() 0 3 1
A getLimit() 0 3 1
A __construct() 0 7 1
A getInterval() 0 3 1
A getEnd() 0 3 1
A setInterval() 0 4 1
A setStart() 0 4 1
A setEnd() 0 4 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\Kline\Request;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
6
7
class KlineRequest extends AbstractParameters
8
{
9
    /**
10
     * Product type. linear only at now
11
     * @var string $category
12
     */
13
    protected string $category = "linear";
14
15
    /**
16
     * Symbol name
17
     * @var string $symbol
18
     */
19
    protected string $symbol;
20
21
    /**
22
     * Kline interval. 1 3 5 15 30 60 120 240 360 720 D M W
23
     * @var string $interval
24
     */
25
    protected string $interval;
26
27
    /**
28
     * The start timestamp (ms)
29
     * @var string $start
30
     */
31
    protected string $start;
32
33
    /**
34
     * The end timestamp (ms)
35
     * @var string $end
36
     */
37
    protected string $end;
38
39
    /**
40
     * Limit for data size per page. [1, 200]. Default: 200
41
     * @var int $limit
42
     */
43
    protected int $limit = 200;
44
45
    public function __construct()
46
    {
47
        $this
48
            ->setRequiredField('symbol')
49
            ->setRequiredField('interval')
50
            ->setRequiredField('start')
51
            ->setRequiredField('end');
52
    }
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 KlineRequest
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 KlineRequest
83
     */
84
    public function setInterval(string $interval): self
85
    {
86
        $this->interval = $interval;
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 KlineRequest
101
     */
102
    public function setStart(string $start): self
103
    {
104
        $this->start = DateTimeHelper::makeTimestampFromDateString($start);
105
        return $this;
106
    }
107
108
    /**
109
     * @return string
110
     */
111
    public function getStart(): string
112
    {
113
        return $this->start;
114
    }
115
116
    /**
117
     * @param string $end
118
     * @return KlineRequest
119
     */
120
    public function setEnd(string $end): self
121
    {
122
        $this->end = DateTimeHelper::makeTimestampFromDateString($end);
123
        return $this;
124
    }
125
126
    /**
127
     * @return string
128
     */
129
    public function getEnd(): string
130
    {
131
        return $this->end;
132
    }
133
134
    /**
135
     * @param int $limit
136
     * @return KlineRequest
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
}