1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetClosedPnL\Request; |
4
|
|
|
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper; |
6
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters; |
7
|
|
|
use Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetClosedPnL\Interfaces\IGetClosedPnLRequestInterface; |
8
|
|
|
|
9
|
|
|
class GetClosedPnLRequest extends AbstractParameters implements IGetClosedPnLRequestInterface |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Symbol name |
13
|
|
|
* @var string $symbol |
14
|
|
|
*/ |
15
|
|
|
protected string $symbol; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The start timestamp (ms) |
19
|
|
|
* @var \DateTime $startTime |
20
|
|
|
*/ |
21
|
|
|
protected \DateTime $startTime; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* The end timestamp (ms) |
25
|
|
|
* @var \DateTime $endTime |
26
|
|
|
*/ |
27
|
|
|
protected \DateTime $endTime; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Limit for data size per page. [1, 200]. Default: 50 |
31
|
|
|
* @var int $limit |
32
|
|
|
*/ |
33
|
|
|
protected int $limit = 50; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Cursor. Use the nextPageCursor token from the response to retrieve the next page of the result set |
37
|
|
|
* @var string $cursor |
38
|
|
|
*/ |
39
|
|
|
protected string $cursor; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return string |
43
|
|
|
*/ |
44
|
|
|
public function getSymbol(): string |
45
|
|
|
{ |
46
|
|
|
return $this->symbol; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string $symbol |
51
|
|
|
* @return GetClosedPnLRequest |
52
|
|
|
*/ |
53
|
|
|
public function setSymbol(string $symbol): self |
54
|
|
|
{ |
55
|
|
|
$this->symbol = $symbol; |
56
|
|
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return \DateTime |
61
|
|
|
*/ |
62
|
|
|
public function getStartTime(): \DateTime |
63
|
|
|
{ |
64
|
|
|
return $this->startTime; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param string $startTime |
69
|
|
|
* @return GetClosedPnLRequest |
70
|
|
|
*/ |
71
|
|
|
public function setStartTime(string $startTime): self |
72
|
|
|
{ |
73
|
|
|
$this->startTime = DateTimeHelper::makeDateTimeFromDateString($startTime); |
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return \DateTime |
79
|
|
|
*/ |
80
|
|
|
public function getEndTime(): \DateTime |
81
|
|
|
{ |
82
|
|
|
return $this->endTime; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param string $endTime |
87
|
|
|
* @return GetClosedPnLRequest |
88
|
|
|
*/ |
89
|
|
|
public function setEndTime(string $endTime): self |
90
|
|
|
{ |
91
|
|
|
$this->endTime = DateTimeHelper::makeDateTimeFromDateString($endTime); |
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return int |
97
|
|
|
*/ |
98
|
|
|
public function getLimit(): int |
99
|
|
|
{ |
100
|
|
|
return $this->limit; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param int $limit |
105
|
|
|
* @return GetClosedPnLRequest |
106
|
|
|
*/ |
107
|
|
|
public function setLimit(int $limit): self |
108
|
|
|
{ |
109
|
|
|
$this->limit = $limit; |
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @return string |
115
|
|
|
*/ |
116
|
|
|
public function getCursor(): string |
117
|
|
|
{ |
118
|
|
|
return $this->cursor; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param string $cursor |
123
|
|
|
* @return GetClosedPnLRequest |
124
|
|
|
*/ |
125
|
|
|
public function setCursor(string $cursor): self |
126
|
|
|
{ |
127
|
|
|
$this->cursor = $cursor; |
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
|
132
|
|
|
} |
133
|
|
|
|