/
order_amend_parameters.go
469 lines (378 loc) · 11.3 KB
/
order_amend_parameters.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
// Code generated by go-swagger; DO NOT EDIT.
package order
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewOrderAmendParams creates a new OrderAmendParams object
// with the default values initialized.
func NewOrderAmendParams() *OrderAmendParams {
var ()
return &OrderAmendParams{
timeout: cr.DefaultTimeout,
}
}
// NewOrderAmendParamsWithTimeout creates a new OrderAmendParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewOrderAmendParamsWithTimeout(timeout time.Duration) *OrderAmendParams {
var ()
return &OrderAmendParams{
timeout: timeout,
}
}
// NewOrderAmendParamsWithContext creates a new OrderAmendParams object
// with the default values initialized, and the ability to set a context for a request
func NewOrderAmendParamsWithContext(ctx context.Context) *OrderAmendParams {
var ()
return &OrderAmendParams{
Context: ctx,
}
}
// NewOrderAmendParamsWithHTTPClient creates a new OrderAmendParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewOrderAmendParamsWithHTTPClient(client *http.Client) *OrderAmendParams {
var ()
return &OrderAmendParams{
HTTPClient: client,
}
}
/*OrderAmendParams contains all the parameters to send to the API endpoint
for the order amend operation typically these are written to a http.Request
*/
type OrderAmendParams struct {
/*ClOrdID
Optional new Client Order ID, requires `origClOrdID`.
*/
ClOrdID *string
/*LeavesQty
Optional leaves quantity in units of the instrument (i.e. contracts). Useful for amending partially filled orders.
*/
LeavesQty *int32
/*OrderID
Order ID
*/
OrderID *string
/*OrderQty
Optional order quantity in units of the instrument (i.e. contracts).
*/
OrderQty *int32
/*OrigClOrdID
Client Order ID. See POST /order.
*/
OrigClOrdID *string
/*PegOffsetValue
Optional trailing offset from the current price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for 'Pegged' orders.
*/
PegOffsetValue *float64
/*Price
Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.
*/
Price *float64
/*SimpleLeavesQty
Optional leaves quantity in units of the underlying instrument (i.e. Bitcoin). Useful for amending partially filled orders.
*/
SimpleLeavesQty *float64
/*SimpleOrderQty
Optional order quantity in units of the underlying instrument (i.e. Bitcoin).
*/
SimpleOrderQty *float64
/*StopPx
Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. Use a price below the current price for stop-sell orders and buy-if-touched orders.
*/
StopPx *float64
/*Text
Optional amend annotation. e.g. 'Adjust skew'.
*/
Text *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the order amend params
func (o *OrderAmendParams) WithTimeout(timeout time.Duration) *OrderAmendParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the order amend params
func (o *OrderAmendParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the order amend params
func (o *OrderAmendParams) WithContext(ctx context.Context) *OrderAmendParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the order amend params
func (o *OrderAmendParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the order amend params
func (o *OrderAmendParams) WithHTTPClient(client *http.Client) *OrderAmendParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the order amend params
func (o *OrderAmendParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithClOrdID adds the clOrdID to the order amend params
func (o *OrderAmendParams) WithClOrdID(clOrdID *string) *OrderAmendParams {
o.SetClOrdID(clOrdID)
return o
}
// SetClOrdID adds the clOrdId to the order amend params
func (o *OrderAmendParams) SetClOrdID(clOrdID *string) {
o.ClOrdID = clOrdID
}
// WithLeavesQty adds the leavesQty to the order amend params
func (o *OrderAmendParams) WithLeavesQty(leavesQty *int32) *OrderAmendParams {
o.SetLeavesQty(leavesQty)
return o
}
// SetLeavesQty adds the leavesQty to the order amend params
func (o *OrderAmendParams) SetLeavesQty(leavesQty *int32) {
o.LeavesQty = leavesQty
}
// WithOrderID adds the orderID to the order amend params
func (o *OrderAmendParams) WithOrderID(orderID *string) *OrderAmendParams {
o.SetOrderID(orderID)
return o
}
// SetOrderID adds the orderId to the order amend params
func (o *OrderAmendParams) SetOrderID(orderID *string) {
o.OrderID = orderID
}
// WithOrderQty adds the orderQty to the order amend params
func (o *OrderAmendParams) WithOrderQty(orderQty *int32) *OrderAmendParams {
o.SetOrderQty(orderQty)
return o
}
// SetOrderQty adds the orderQty to the order amend params
func (o *OrderAmendParams) SetOrderQty(orderQty *int32) {
o.OrderQty = orderQty
}
// WithOrigClOrdID adds the origClOrdID to the order amend params
func (o *OrderAmendParams) WithOrigClOrdID(origClOrdID *string) *OrderAmendParams {
o.SetOrigClOrdID(origClOrdID)
return o
}
// SetOrigClOrdID adds the origClOrdId to the order amend params
func (o *OrderAmendParams) SetOrigClOrdID(origClOrdID *string) {
o.OrigClOrdID = origClOrdID
}
// WithPegOffsetValue adds the pegOffsetValue to the order amend params
func (o *OrderAmendParams) WithPegOffsetValue(pegOffsetValue *float64) *OrderAmendParams {
o.SetPegOffsetValue(pegOffsetValue)
return o
}
// SetPegOffsetValue adds the pegOffsetValue to the order amend params
func (o *OrderAmendParams) SetPegOffsetValue(pegOffsetValue *float64) {
o.PegOffsetValue = pegOffsetValue
}
// WithPrice adds the price to the order amend params
func (o *OrderAmendParams) WithPrice(price *float64) *OrderAmendParams {
o.SetPrice(price)
return o
}
// SetPrice adds the price to the order amend params
func (o *OrderAmendParams) SetPrice(price *float64) {
o.Price = price
}
// WithSimpleLeavesQty adds the simpleLeavesQty to the order amend params
func (o *OrderAmendParams) WithSimpleLeavesQty(simpleLeavesQty *float64) *OrderAmendParams {
o.SetSimpleLeavesQty(simpleLeavesQty)
return o
}
// SetSimpleLeavesQty adds the simpleLeavesQty to the order amend params
func (o *OrderAmendParams) SetSimpleLeavesQty(simpleLeavesQty *float64) {
o.SimpleLeavesQty = simpleLeavesQty
}
// WithSimpleOrderQty adds the simpleOrderQty to the order amend params
func (o *OrderAmendParams) WithSimpleOrderQty(simpleOrderQty *float64) *OrderAmendParams {
o.SetSimpleOrderQty(simpleOrderQty)
return o
}
// SetSimpleOrderQty adds the simpleOrderQty to the order amend params
func (o *OrderAmendParams) SetSimpleOrderQty(simpleOrderQty *float64) {
o.SimpleOrderQty = simpleOrderQty
}
// WithStopPx adds the stopPx to the order amend params
func (o *OrderAmendParams) WithStopPx(stopPx *float64) *OrderAmendParams {
o.SetStopPx(stopPx)
return o
}
// SetStopPx adds the stopPx to the order amend params
func (o *OrderAmendParams) SetStopPx(stopPx *float64) {
o.StopPx = stopPx
}
// WithText adds the text to the order amend params
func (o *OrderAmendParams) WithText(text *string) *OrderAmendParams {
o.SetText(text)
return o
}
// SetText adds the text to the order amend params
func (o *OrderAmendParams) SetText(text *string) {
o.Text = text
}
// WriteToRequest writes these params to a swagger request
func (o *OrderAmendParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.ClOrdID != nil {
// form param clOrdID
var frClOrdID string
if o.ClOrdID != nil {
frClOrdID = *o.ClOrdID
}
fClOrdID := frClOrdID
if fClOrdID != "" {
if err := r.SetFormParam("clOrdID", fClOrdID); err != nil {
return err
}
}
}
if o.LeavesQty != nil {
// form param leavesQty
var frLeavesQty int32
if o.LeavesQty != nil {
frLeavesQty = *o.LeavesQty
}
fLeavesQty := swag.FormatInt32(frLeavesQty)
if fLeavesQty != "" {
if err := r.SetFormParam("leavesQty", fLeavesQty); err != nil {
return err
}
}
}
if o.OrderID != nil {
// form param orderID
var frOrderID string
if o.OrderID != nil {
frOrderID = *o.OrderID
}
fOrderID := frOrderID
if fOrderID != "" {
if err := r.SetFormParam("orderID", fOrderID); err != nil {
return err
}
}
}
if o.OrderQty != nil {
// form param orderQty
var frOrderQty int32
if o.OrderQty != nil {
frOrderQty = *o.OrderQty
}
fOrderQty := swag.FormatInt32(frOrderQty)
if fOrderQty != "" {
if err := r.SetFormParam("orderQty", fOrderQty); err != nil {
return err
}
}
}
if o.OrigClOrdID != nil {
// form param origClOrdID
var frOrigClOrdID string
if o.OrigClOrdID != nil {
frOrigClOrdID = *o.OrigClOrdID
}
fOrigClOrdID := frOrigClOrdID
if fOrigClOrdID != "" {
if err := r.SetFormParam("origClOrdID", fOrigClOrdID); err != nil {
return err
}
}
}
if o.PegOffsetValue != nil {
// form param pegOffsetValue
var frPegOffsetValue float64
if o.PegOffsetValue != nil {
frPegOffsetValue = *o.PegOffsetValue
}
fPegOffsetValue := swag.FormatFloat64(frPegOffsetValue)
if fPegOffsetValue != "" {
if err := r.SetFormParam("pegOffsetValue", fPegOffsetValue); err != nil {
return err
}
}
}
if o.Price != nil {
// form param price
var frPrice float64
if o.Price != nil {
frPrice = *o.Price
}
fPrice := swag.FormatFloat64(frPrice)
if fPrice != "" {
if err := r.SetFormParam("price", fPrice); err != nil {
return err
}
}
}
if o.SimpleLeavesQty != nil {
// form param simpleLeavesQty
var frSimpleLeavesQty float64
if o.SimpleLeavesQty != nil {
frSimpleLeavesQty = *o.SimpleLeavesQty
}
fSimpleLeavesQty := swag.FormatFloat64(frSimpleLeavesQty)
if fSimpleLeavesQty != "" {
if err := r.SetFormParam("simpleLeavesQty", fSimpleLeavesQty); err != nil {
return err
}
}
}
if o.SimpleOrderQty != nil {
// form param simpleOrderQty
var frSimpleOrderQty float64
if o.SimpleOrderQty != nil {
frSimpleOrderQty = *o.SimpleOrderQty
}
fSimpleOrderQty := swag.FormatFloat64(frSimpleOrderQty)
if fSimpleOrderQty != "" {
if err := r.SetFormParam("simpleOrderQty", fSimpleOrderQty); err != nil {
return err
}
}
}
if o.StopPx != nil {
// form param stopPx
var frStopPx float64
if o.StopPx != nil {
frStopPx = *o.StopPx
}
fStopPx := swag.FormatFloat64(frStopPx)
if fStopPx != "" {
if err := r.SetFormParam("stopPx", fStopPx); err != nil {
return err
}
}
}
if o.Text != nil {
// form param text
var frText string
if o.Text != nil {
frText = *o.Text
}
fText := frText
if fText != "" {
if err := r.SetFormParam("text", fText); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}