IndexPriceKlineRequest::getInterval()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Request;
4
5
use Carpenstar\ByBitAPI\Core\Enums\EnumDerivativesCategory;
6
use Carpenstar\ByBitAPI\Core\Enums\EnumIntervals;
7
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
8
use Carpenstar\ByBitAPI\Core\Helpers\StringHelper;
9
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
10
use Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Interfaces\IIndexPriceKlineRequestInterface;
11
12
class IndexPriceKlineRequest extends AbstractParameters implements IIndexPriceKlineRequestInterface
13
{
14
    /**
15
     * Product type. linear,inverse. Default: linear, but in the response category shows
16
     * @var string $category
17
     */
18
    protected string $category = EnumDerivativesCategory::CATEGORY_PRODUCT_LINEAR;
19
20
    /**
21
     * Symbol name
22
     * @var string $symbol
23
     */
24
    protected string $symbol;
25
26
    /**
27
     * Kline interval. 1 3 5 15 30 60 120 240 360 720 D M W
28
     * @var string $interval
29
     */
30
    protected string $interval = EnumIntervals::MINUTE1;
31
32
    /**
33
     * The start timestamp (ms)
34
     * @var int $start
35
     */
36
    protected int $start;
37
38
    /**
39
     * The end timestamp (ms)
40
     * @var int $end
41
     */
42
    protected int $end;
43
44
    /**
45
     * Limit for data size per page. [1, 200]. Default: 200
46
     * @var int $limit
47
     */
48
    protected int $limit = 200;
49
50
    /**
51
     * @return string
52
     */
53
    public function getCategory(): string
54
    {
55
        return $this->category;
56
    }
57
58
    /**
59
     * @param string $symbol
60
     * @return IndexPriceKlineRequest
61
     */
62
    public function setSymbol(string $symbol): self
63
    {
64
        $this->symbol = $symbol;
65
        return $this;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getSymbol(): string
72
    {
73
        return $this->symbol;
74
    }
75
76
    /**
77
     * @param string $interval
78
     * @return IndexPriceKlineRequest
79
     */
80
    public function setInterval(string $interval): self
81
    {
82
        $this->interval = StringHelper::clearInterval($interval);
83
        return $this;
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function getInterval(): string
90
    {
91
        return $this->interval;
92
    }
93
94
    /**
95
     * @param string $start
96
     * @return IndexPriceKlineRequest
97
     */
98
    public function setStart(string $start): self
99
    {
100
        $this->start = DateTimeHelper::makeTimestampFromDateString($start);
101
        return $this;
102
    }
103
104
    /**
105
     * @return int
106
     */
107
    public function getStart(): int
108
    {
109
        return $this->start;
110
    }
111
112
    /**
113
     * @param string $end
114
     * @return IndexPriceKlineRequest
115
     */
116
    public function setEnd(string $end): self
117
    {
118
        $this->end = DateTimeHelper::makeTimestampFromDateString($end);
119
        return $this;
120
    }
121
122
    /**
123
     * @return int
124
     */
125
    public function getEnd(): int
126
    {
127
        return $this->end;
128
    }
129
130
    /**
131
     * @param int $limit
132
     * @return IndexPriceKlineRequest
133
     */
134
    public function setLimit(int $limit): self
135
    {
136
        $this->limit = $limit;
137
        return $this;
138
    }
139
140
    /**
141
     * @return int
142
     */
143
    public function getLimit(): int
144
    {
145
        return $this->limit;
146
    }
147
}
148