1
|
|
|
<?php |
2
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Request; |
3
|
|
|
|
4
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\DerivativesCategoryEnum; |
|
|
|
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumDerivativesCategory; |
6
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumIntervals; |
7
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\IntervalEnum; |
|
|
|
|
8
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper; |
9
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\StringHelper; |
10
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters; |
11
|
|
|
use Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Interfaces\IIndexPriceKlineRequest; |
12
|
|
|
|
13
|
|
|
class IndexPriceKlineRequest extends AbstractParameters implements IIndexPriceKlineRequest |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* Product type. linear,inverse. Default: linear, but in the response category shows |
17
|
|
|
* @var string $category |
18
|
|
|
*/ |
19
|
|
|
protected string $category = EnumDerivativesCategory::CATEGORY_PRODUCT_LINEAR; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Symbol name |
23
|
|
|
* @var string $symbol |
24
|
|
|
*/ |
25
|
|
|
protected string $symbol; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Kline interval. 1 3 5 15 30 60 120 240 360 720 D M W |
29
|
|
|
* @var string $interval |
30
|
|
|
*/ |
31
|
|
|
protected string $interval = EnumIntervals::MINUTE1; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* The start timestamp (ms) |
35
|
|
|
* @var \DateTime $startTime |
36
|
|
|
*/ |
37
|
|
|
protected \DateTime $startTime; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* The end timestamp (ms) |
41
|
|
|
* @var \DateTime $endTime |
42
|
|
|
*/ |
43
|
|
|
protected \DateTime $endTime; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Limit for data size per page. [1, 200]. Default: 200 |
47
|
|
|
* @var int $limit |
48
|
|
|
*/ |
49
|
|
|
protected int $limit = 200; |
50
|
|
|
|
51
|
|
|
public function __construct() |
52
|
|
|
{ |
53
|
|
|
$this |
54
|
|
|
->setRequiredField('symbol') |
55
|
|
|
->setRequiredField('interval') |
56
|
|
|
->setRequiredField('startTime') |
57
|
|
|
->setRequiredField('endTime'); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $category |
62
|
|
|
* @return $this |
63
|
|
|
*/ |
64
|
|
|
public function setCategory(string $category): self |
65
|
|
|
{ |
66
|
|
|
$this->category = $category; |
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public function getCategory(): string |
74
|
|
|
{ |
75
|
|
|
return $this->category; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string $symbol |
80
|
|
|
* @return IndexPriceKlineRequest |
81
|
|
|
*/ |
82
|
|
|
public function setSymbol(string $symbol): self |
83
|
|
|
{ |
84
|
|
|
$this->symbol = $symbol; |
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
|
|
public function getSymbol(): string |
92
|
|
|
{ |
93
|
|
|
return $this->symbol; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param string $interval |
98
|
|
|
* @return IndexPriceKlineRequest |
99
|
|
|
*/ |
100
|
|
|
public function setInterval(string $interval): self |
101
|
|
|
{ |
102
|
|
|
$this->interval = StringHelper::clearInterval($interval); |
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
|
|
public function getInterval(): string |
110
|
|
|
{ |
111
|
|
|
return $this->interval; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param int $startTime |
116
|
|
|
* @return IndexPriceKlineRequest |
117
|
|
|
*/ |
118
|
|
|
public function setStartTime(int $startTime): self |
119
|
|
|
{ |
120
|
|
|
$this->startTime = DateTimeHelper::makeFromTimestamp($startTime); |
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return \DateTime |
126
|
|
|
*/ |
127
|
|
|
public function getStartTime(): \DateTime |
128
|
|
|
{ |
129
|
|
|
return $this->startTime; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param int $endTime |
134
|
|
|
* @return IndexPriceKlineRequest |
135
|
|
|
*/ |
136
|
|
|
public function setEndTime(int $endTime): self |
137
|
|
|
{ |
138
|
|
|
$this->endTime = DateTimeHelper::makeFromTimestamp($endTime); |
139
|
|
|
return $this; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @return \DateTime |
144
|
|
|
*/ |
145
|
|
|
public function getEndTime(): \DateTime |
146
|
|
|
{ |
147
|
|
|
return $this->endTime; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @param int $limit |
152
|
|
|
* @return IndexPriceKlineRequest |
153
|
|
|
*/ |
154
|
|
|
public function setLimit(int $limit): self |
155
|
|
|
{ |
156
|
|
|
$this->limit = $limit; |
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return int |
162
|
|
|
*/ |
163
|
|
|
public function getLimit(): int |
164
|
|
|
{ |
165
|
|
|
return $this->limit; |
166
|
|
|
} |
167
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths