Passed
Pull Request — master (#7)
by Vladislav
03:08
created

PlaceOrderRequest::getSymbol()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Spot\Trade\PlaceOrder\Request;
3
4
use Carpenstar\ByBitAPI\Core\Enums\EnumOrderType;
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
6
use Carpenstar\ByBitAPI\Core\Objects\OptionsEntity;
0 ignored issues
show
Bug introduced by
The type Carpenstar\ByBitAPI\Core\Objects\OptionsEntity was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

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