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
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
|
|
public function getCategory(): string |
64
|
|
|
{ |
65
|
|
|
return $this->category; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param string $symbol |
70
|
|
|
* @return IndexPriceKlineRequest |
71
|
|
|
*/ |
72
|
|
|
public function setSymbol(string $symbol): self |
73
|
|
|
{ |
74
|
|
|
$this->symbol = $symbol; |
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return string |
80
|
|
|
*/ |
81
|
|
|
public function getSymbol(): string |
82
|
|
|
{ |
83
|
|
|
return $this->symbol; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param string $interval |
88
|
|
|
* @return IndexPriceKlineRequest |
89
|
|
|
*/ |
90
|
|
|
public function setInterval(string $interval): self |
91
|
|
|
{ |
92
|
|
|
$this->interval = StringHelper::clearInterval($interval); |
93
|
|
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getInterval(): string |
100
|
|
|
{ |
101
|
|
|
return $this->interval; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param int $startTime |
106
|
|
|
* @return IndexPriceKlineRequest |
107
|
|
|
*/ |
108
|
|
|
public function setStartTime(int $startTime): self |
109
|
|
|
{ |
110
|
|
|
$this->startTime = DateTimeHelper::makeFromTimestamp($startTime); |
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return \DateTime |
116
|
|
|
*/ |
117
|
|
|
public function getStartTime(): \DateTime |
118
|
|
|
{ |
119
|
|
|
return $this->startTime; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @param int $endTime |
124
|
|
|
* @return IndexPriceKlineRequest |
125
|
|
|
*/ |
126
|
|
|
public function setEndTime(int $endTime): self |
127
|
|
|
{ |
128
|
|
|
$this->endTime = DateTimeHelper::makeFromTimestamp($endTime); |
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return \DateTime |
134
|
|
|
*/ |
135
|
|
|
public function getEndTime(): \DateTime |
136
|
|
|
{ |
137
|
|
|
return $this->endTime; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param int $limit |
142
|
|
|
* @return IndexPriceKlineRequest |
143
|
|
|
*/ |
144
|
|
|
public function setLimit(int $limit): self |
145
|
|
|
{ |
146
|
|
|
$this->limit = $limit; |
147
|
|
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return int |
152
|
|
|
*/ |
153
|
|
|
public function getLimit(): int |
154
|
|
|
{ |
155
|
|
|
return $this->limit; |
156
|
|
|
} |
157
|
|
|
} |
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