1
|
|
|
<?php |
2
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\MarkPriceKline\Request; |
3
|
|
|
|
4
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper; |
5
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters; |
6
|
|
|
|
7
|
|
|
class MarkPriceKlineRequest extends AbstractParameters |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Product type. linear |
11
|
|
|
* @var string $category |
12
|
|
|
*/ |
13
|
|
|
protected string $category; |
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 int $start |
30
|
|
|
*/ |
31
|
|
|
protected int $start; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* The end timestamp (ms) |
35
|
|
|
* @var int $end |
36
|
|
|
*/ |
37
|
|
|
protected int $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
|
|
|
* @param string $category |
56
|
|
|
* @return MarkPriceKlineRequest |
57
|
|
|
*/ |
58
|
|
|
public function setCategory(string $category): self |
|
|
|
|
59
|
|
|
{ |
60
|
|
|
$this->category = "linear"; // supports only linear category |
61
|
|
|
return $this; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
|
|
public function getCategory(): string |
68
|
|
|
{ |
69
|
|
|
return $this->category; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param string $symbol |
74
|
|
|
* @return MarkPriceKlineRequest |
75
|
|
|
*/ |
76
|
|
|
public function setSymbol(string $symbol): self |
77
|
|
|
{ |
78
|
|
|
$this->symbol = $symbol; |
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
|
|
public function getSymbol(): string |
86
|
|
|
{ |
87
|
|
|
return $this->symbol; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param string $interval |
92
|
|
|
* @return MarkPriceKlineRequest |
93
|
|
|
*/ |
94
|
|
|
public function setInterval(string $interval): self |
95
|
|
|
{ |
96
|
|
|
$this->interval = $interval; |
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function getInterval(): string |
104
|
|
|
{ |
105
|
|
|
return $this->interval; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param string $start |
110
|
|
|
* @return MarkPriceKlineRequest |
111
|
|
|
*/ |
112
|
|
|
public function setStart(string $start): self |
113
|
|
|
{ |
114
|
|
|
$this->start = DateTimeHelper::makeTimestampFromDateString($start); |
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return int |
120
|
|
|
*/ |
121
|
|
|
public function getStart(): int |
122
|
|
|
{ |
123
|
|
|
return $this->start; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param string $end |
128
|
|
|
* @return MarkPriceKlineRequest |
129
|
|
|
*/ |
130
|
|
|
public function setEnd(string $end): self |
131
|
|
|
{ |
132
|
|
|
$this->end = DateTimeHelper::makeTimestampFromDateString($end); |
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return int |
138
|
|
|
*/ |
139
|
|
|
public function getEnd(): int |
140
|
|
|
{ |
141
|
|
|
return $this->end; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param int $limit |
146
|
|
|
* @return MarkPriceKlineRequest |
147
|
|
|
*/ |
148
|
|
|
public function setLimit(int $limit): self |
149
|
|
|
{ |
150
|
|
|
$this->limit = $limit; |
151
|
|
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return int |
156
|
|
|
*/ |
157
|
|
|
public function getLimit(): int |
158
|
|
|
{ |
159
|
|
|
return $this->limit; |
160
|
|
|
} |
161
|
|
|
} |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.