Test Failed
Push — master ( 912b2a...b3ee71 )
by Vladislav
25:05 queued 22:30
created

PlaceOrderRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\Trade\PlaceOrder\Request;
4
5
use Carpenstar\ByBitAPI\Core\Enums\EnumOrderType;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
7
use Carpenstar\ByBitAPI\Spot\Trade\PlaceOrder\Interfaces\IPlaceOrderRequestInterface;
8
9
/**
10
 * Warning: Do not use the duplicate orderLinkId in normal order & TP/SL order
11
 */
12
class PlaceOrderRequest extends AbstractParameters implements IPlaceOrderRequestInterface
13
{
14
    /**
15
     * Name of the trading pair
16
     * @var string $symbol
17
     * @required true
18
     */
19
    protected string $symbol;
20
21
    /**
22
     * Order type
23
     * @var string $orderType
24
     * @required true
25
     */
26
    protected string $orderType = EnumOrderType::MARKET;
27
28
    /**
29
     * Side. BUY, SELL
30
     * @var string $side
31
     * @required true
32
     */
33
    protected string $side;
34
35
    /**
36
     * User-generated order ID
37
     * @var string $orderLinkId
38
     * @required false
39
     */
40
    protected string $orderLinkId;
41
42
    /**
43
     * Order price. When the type field is MARKET, the price field is optional.
44
     * When the type field is LIMIT or LIMIT_MAKER, the price field is required
45
     * @var float $orderPrice
46
     * @required false
47
     */
48
    protected float $orderPrice;
49
50
    /**
51
     * Time in force. E.q. EnumTimeInForce::GOOD_TILL_CANCELED
52
     * @var string $timeInForce
53
     * @required false
54
     */
55
    protected string $timeInForce;
56
57
    /**
58
     * Order qty. When you place a MARKET BUY order, this param means quote amount. e.g.,
59
     * MARKET BUY BTCUSDT, orderQty should be 200 USDT
60
     * @var float $orderQty
61
     * @required true
62
     */
63
    protected float $orderQty;
64
65
    /**
66
     * Order category. 0:normal order by default; 1:TP/SL order, Required for TP/SL order.
67
     * @var string
68
     * @required false
69
     */
70
    protected string $orderCategory;
71
72
    /**
73
     * Trigger price. Used for TP/SL order
74
     * @var float $triggerPrice
75
     * @required false
76
     */
77
    protected float $triggerPrice;
78
79
    /**
80
     * @param string $symbol
81
     * @return $this
82
     */
83
    public function setSymbol(string $symbol): self
84
    {
85
        $this->symbol = $symbol;
86
        return $this;
87
    }
88
89
    /**
90
     * @return string
91
     */
92
    public function getSymbol(): ?string
93
    {
94
        return $this->symbol;
95
    }
96
97
    /**
98
     * @param string $orderType
99
     * @return $this
100
     */
101
    public function setOrderType(string $orderType): self
102
    {
103
        $this->orderType = $orderType;
104
        return $this;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getOrderType(): ?string
111
    {
112
        return $this->orderType;
113
    }
114
115
    /**
116
     * @param string $side
117
     * @return $this
118
     */
119
    public function setSide(string $side): self
120
    {
121
        $this->side = $side;
122
        return $this;
123
    }
124
125
    /**
126
     * @return string
127
     */
128
    public function getSide(): ?string
129
    {
130
        return $this->side;
131
    }
132
133
    /**
134
     * @param string $orderLinkId
135
     * @return $this
136
     */
137
    public function setOrderLinkId(string $orderLinkId): self
138
    {
139
        $this->orderLinkId = $orderLinkId;
140
        return $this;
141
    }
142
143
    /**
144
     * @return string
145
     */
146
    public function getOrderLinkId(): ?string
147
    {
148
        return $this->orderLinkId;
149
    }
150
151
    /**
152
     * @param float $orderQty
153
     * @return $this
154
     */
155
    public function setOrderQty(float $orderQty): self
156
    {
157
        $this->orderQty = $orderQty;
158
        return $this;
159
    }
160
161
    /**
162
     * @return string
163
     */
164
    public function getOrderQty(): ?string
165
    {
166
        return $this->orderQty;
167
    }
168
169
    /**
170
     * @param float $orderPrice
171
     * @return $this
172
     */
173
    public function setOrderPrice(float $orderPrice): self
174
    {
175
        $this->orderPrice = $orderPrice;
176
        return $this;
177
    }
178
179
    /**
180
     * @return float
181
     */
182
    public function getOrderPrice(): ?float
183
    {
184
        return $this->orderPrice;
185
    }
186
187
    /**
188
     * @param string $timeInForce
189
     * @return $this
190
     */
191
    public function setTimeInForce(string $timeInForce): self
192
    {
193
        $this->timeInForce = $timeInForce;
194
        return $this;
195
    }
196
197
    /**
198
     * @return string
199
     */
200
    public function getTimeInForce(): ?string
201
    {
202
        return $this->timeInForce;
203
    }
204
205
    /**
206
     * @param string $orderCategory
207
     * @return PlaceOrderRequest
208
     */
209
    public function setOrderCategory(string $orderCategory): self
210
    {
211
        $this->orderCategory = $orderCategory;
212
        return $this;
213
    }
214
215
    /**
216
     * @return string
217
     */
218
    public function getOrderCategory(): ?string
219
    {
220
        return $this->orderCategory;
221
    }
222
223
    /**
224
     * @param float $triggerPrice
225
     * @return PlaceOrderRequest
226
     */
227
    public function setTriggerPrice(float $triggerPrice): self
228
    {
229
        $this->triggerPrice = $triggerPrice;
230
        return $this;
231
    }
232
233
    /**
234
     * @return float
235
     */
236
    public function getTriggerPrice(): ?float
237
    {
238
        return $this->triggerPrice;
239
    }
240
}
241