forked from f0cii/bitmexwrap
/
order_new_parameters.go
634 lines (515 loc) · 15.5 KB
/
order_new_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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
// 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"
)
// NewOrderNewParams creates a new OrderNewParams object
// with the default values initialized.
func NewOrderNewParams() *OrderNewParams {
var (
ordTypeDefault = string("Limit")
)
return &OrderNewParams{
OrdType: &ordTypeDefault,
timeout: cr.DefaultTimeout,
}
}
// NewOrderNewParamsWithTimeout creates a new OrderNewParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewOrderNewParamsWithTimeout(timeout time.Duration) *OrderNewParams {
var (
ordTypeDefault = string("Limit")
)
return &OrderNewParams{
OrdType: &ordTypeDefault,
timeout: timeout,
}
}
// NewOrderNewParamsWithContext creates a new OrderNewParams object
// with the default values initialized, and the ability to set a context for a request
func NewOrderNewParamsWithContext(ctx context.Context) *OrderNewParams {
var (
ordTypeDefault = string("Limit")
)
return &OrderNewParams{
OrdType: &ordTypeDefault,
Context: ctx,
}
}
// NewOrderNewParamsWithHTTPClient creates a new OrderNewParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewOrderNewParamsWithHTTPClient(client *http.Client) *OrderNewParams {
var (
ordTypeDefault = string("Limit")
)
return &OrderNewParams{
OrdType: &ordTypeDefault,
HTTPClient: client,
}
}
/*OrderNewParams contains all the parameters to send to the API endpoint
for the order new operation typically these are written to a http.Request
*/
type OrderNewParams struct {
/*ClOrdID
Optional Client Order ID. This clOrdID will come back on the order and any related executions.
*/
ClOrdID *string
/*ClOrdLinkID
Optional Client Order Link ID for contingent orders.
*/
ClOrdLinkID *string
/*ContingencyType
Optional contingency type for use with `clOrdLinkID`. Valid options: OneCancelsTheOther, OneTriggersTheOther, OneUpdatesTheOtherAbsolute, OneUpdatesTheOtherProportional.
*/
ContingencyType *string
/*DisplayQty
Optional quantity to display in the book. Use 0 for a fully hidden order.
*/
DisplayQty *int32
/*ExecInst
Optional execution instructions. Valid options: ParticipateDoNotInitiate, AllOrNone, MarkPrice, IndexPrice, LastPrice, Close, ReduceOnly, Fixed. 'AllOrNone' instruction requires `displayQty` to be 0. 'MarkPrice', 'IndexPrice' or 'LastPrice' instruction valid for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders.
*/
ExecInst *string
/*OrdType
Order type. Valid options: Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, MarketWithLeftOverAsLimit, Pegged. Defaults to 'Limit' when `price` is specified. Defaults to 'Stop' when `stopPx` is specified. Defaults to 'StopLimit' when `price` and `stopPx` are specified.
*/
OrdType *string
/*OrderQty
Order quantity in units of the instrument (i.e. contracts).
*/
OrderQty *int32
/*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
/*PegPriceType
Optional peg price type. Valid options: LastPeg, MidPricePeg, MarketPeg, PrimaryPeg, TrailingStopPeg.
*/
PegPriceType *string
/*Price
Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.
*/
Price *float64
/*Side
Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless `orderQty` or `simpleOrderQty` is negative.
*/
Side *string
/*SimpleOrderQty
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. Use `execInst` of 'MarkPrice' or 'LastPrice' to define the current price used for triggering.
*/
StopPx *float64
/*Symbol
Instrument symbol. e.g. 'XBTUSD'.
*/
Symbol string
/*Text
Optional order annotation. e.g. 'Take profit'.
*/
Text *string
/*TimeInForce
Time in force. Valid options: Day, GoodTillCancel, ImmediateOrCancel, FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit', 'LimitIfTouched', and 'MarketWithLeftOverAsLimit' orders.
*/
TimeInForce *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the order new params
func (o *OrderNewParams) WithTimeout(timeout time.Duration) *OrderNewParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the order new params
func (o *OrderNewParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the order new params
func (o *OrderNewParams) WithContext(ctx context.Context) *OrderNewParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the order new params
func (o *OrderNewParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the order new params
func (o *OrderNewParams) WithHTTPClient(client *http.Client) *OrderNewParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the order new params
func (o *OrderNewParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithClOrdID adds the clOrdID to the order new params
func (o *OrderNewParams) WithClOrdID(clOrdID *string) *OrderNewParams {
o.SetClOrdID(clOrdID)
return o
}
// SetClOrdID adds the clOrdId to the order new params
func (o *OrderNewParams) SetClOrdID(clOrdID *string) {
o.ClOrdID = clOrdID
}
// WithClOrdLinkID adds the clOrdLinkID to the order new params
func (o *OrderNewParams) WithClOrdLinkID(clOrdLinkID *string) *OrderNewParams {
o.SetClOrdLinkID(clOrdLinkID)
return o
}
// SetClOrdLinkID adds the clOrdLinkId to the order new params
func (o *OrderNewParams) SetClOrdLinkID(clOrdLinkID *string) {
o.ClOrdLinkID = clOrdLinkID
}
// WithContingencyType adds the contingencyType to the order new params
func (o *OrderNewParams) WithContingencyType(contingencyType *string) *OrderNewParams {
o.SetContingencyType(contingencyType)
return o
}
// SetContingencyType adds the contingencyType to the order new params
func (o *OrderNewParams) SetContingencyType(contingencyType *string) {
o.ContingencyType = contingencyType
}
// WithDisplayQty adds the displayQty to the order new params
func (o *OrderNewParams) WithDisplayQty(displayQty *int32) *OrderNewParams {
o.SetDisplayQty(displayQty)
return o
}
// SetDisplayQty adds the displayQty to the order new params
func (o *OrderNewParams) SetDisplayQty(displayQty *int32) {
o.DisplayQty = displayQty
}
// WithExecInst adds the execInst to the order new params
func (o *OrderNewParams) WithExecInst(execInst *string) *OrderNewParams {
o.SetExecInst(execInst)
return o
}
// SetExecInst adds the execInst to the order new params
func (o *OrderNewParams) SetExecInst(execInst *string) {
o.ExecInst = execInst
}
// WithOrdType adds the ordType to the order new params
func (o *OrderNewParams) WithOrdType(ordType *string) *OrderNewParams {
o.SetOrdType(ordType)
return o
}
// SetOrdType adds the ordType to the order new params
func (o *OrderNewParams) SetOrdType(ordType *string) {
o.OrdType = ordType
}
// WithOrderQty adds the orderQty to the order new params
func (o *OrderNewParams) WithOrderQty(orderQty *int32) *OrderNewParams {
o.SetOrderQty(orderQty)
return o
}
// SetOrderQty adds the orderQty to the order new params
func (o *OrderNewParams) SetOrderQty(orderQty *int32) {
o.OrderQty = orderQty
}
// WithPegOffsetValue adds the pegOffsetValue to the order new params
func (o *OrderNewParams) WithPegOffsetValue(pegOffsetValue *float64) *OrderNewParams {
o.SetPegOffsetValue(pegOffsetValue)
return o
}
// SetPegOffsetValue adds the pegOffsetValue to the order new params
func (o *OrderNewParams) SetPegOffsetValue(pegOffsetValue *float64) {
o.PegOffsetValue = pegOffsetValue
}
// WithPegPriceType adds the pegPriceType to the order new params
func (o *OrderNewParams) WithPegPriceType(pegPriceType *string) *OrderNewParams {
o.SetPegPriceType(pegPriceType)
return o
}
// SetPegPriceType adds the pegPriceType to the order new params
func (o *OrderNewParams) SetPegPriceType(pegPriceType *string) {
o.PegPriceType = pegPriceType
}
// WithPrice adds the price to the order new params
func (o *OrderNewParams) WithPrice(price *float64) *OrderNewParams {
o.SetPrice(price)
return o
}
// SetPrice adds the price to the order new params
func (o *OrderNewParams) SetPrice(price *float64) {
o.Price = price
}
// WithSide adds the side to the order new params
func (o *OrderNewParams) WithSide(side *string) *OrderNewParams {
o.SetSide(side)
return o
}
// SetSide adds the side to the order new params
func (o *OrderNewParams) SetSide(side *string) {
o.Side = side
}
// WithSimpleOrderQty adds the simpleOrderQty to the order new params
func (o *OrderNewParams) WithSimpleOrderQty(simpleOrderQty *float64) *OrderNewParams {
o.SetSimpleOrderQty(simpleOrderQty)
return o
}
// SetSimpleOrderQty adds the simpleOrderQty to the order new params
func (o *OrderNewParams) SetSimpleOrderQty(simpleOrderQty *float64) {
o.SimpleOrderQty = simpleOrderQty
}
// WithStopPx adds the stopPx to the order new params
func (o *OrderNewParams) WithStopPx(stopPx *float64) *OrderNewParams {
o.SetStopPx(stopPx)
return o
}
// SetStopPx adds the stopPx to the order new params
func (o *OrderNewParams) SetStopPx(stopPx *float64) {
o.StopPx = stopPx
}
// WithSymbol adds the symbol to the order new params
func (o *OrderNewParams) WithSymbol(symbol string) *OrderNewParams {
o.SetSymbol(symbol)
return o
}
// SetSymbol adds the symbol to the order new params
func (o *OrderNewParams) SetSymbol(symbol string) {
o.Symbol = symbol
}
// WithText adds the text to the order new params
func (o *OrderNewParams) WithText(text *string) *OrderNewParams {
o.SetText(text)
return o
}
// SetText adds the text to the order new params
func (o *OrderNewParams) SetText(text *string) {
o.Text = text
}
// WithTimeInForce adds the timeInForce to the order new params
func (o *OrderNewParams) WithTimeInForce(timeInForce *string) *OrderNewParams {
o.SetTimeInForce(timeInForce)
return o
}
// SetTimeInForce adds the timeInForce to the order new params
func (o *OrderNewParams) SetTimeInForce(timeInForce *string) {
o.TimeInForce = timeInForce
}
// WriteToRequest writes these params to a swagger request
func (o *OrderNewParams) 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.ClOrdLinkID != nil {
// form param clOrdLinkID
var frClOrdLinkID string
if o.ClOrdLinkID != nil {
frClOrdLinkID = *o.ClOrdLinkID
}
fClOrdLinkID := frClOrdLinkID
if fClOrdLinkID != "" {
if err := r.SetFormParam("clOrdLinkID", fClOrdLinkID); err != nil {
return err
}
}
}
if o.ContingencyType != nil {
// form param contingencyType
var frContingencyType string
if o.ContingencyType != nil {
frContingencyType = *o.ContingencyType
}
fContingencyType := frContingencyType
if fContingencyType != "" {
if err := r.SetFormParam("contingencyType", fContingencyType); err != nil {
return err
}
}
}
if o.DisplayQty != nil {
// form param displayQty
var frDisplayQty int32
if o.DisplayQty != nil {
frDisplayQty = *o.DisplayQty
}
fDisplayQty := swag.FormatInt32(frDisplayQty)
if fDisplayQty != "" {
if err := r.SetFormParam("displayQty", fDisplayQty); err != nil {
return err
}
}
}
if o.ExecInst != nil {
// form param execInst
var frExecInst string
if o.ExecInst != nil {
frExecInst = *o.ExecInst
}
fExecInst := frExecInst
if fExecInst != "" {
if err := r.SetFormParam("execInst", fExecInst); err != nil {
return err
}
}
}
if o.OrdType != nil {
// form param ordType
var frOrdType string
if o.OrdType != nil {
frOrdType = *o.OrdType
}
fOrdType := frOrdType
if fOrdType != "" {
if err := r.SetFormParam("ordType", fOrdType); 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.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.PegPriceType != nil {
// form param pegPriceType
var frPegPriceType string
if o.PegPriceType != nil {
frPegPriceType = *o.PegPriceType
}
fPegPriceType := frPegPriceType
if fPegPriceType != "" {
if err := r.SetFormParam("pegPriceType", fPegPriceType); 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.Side != nil {
// form param side
var frSide string
if o.Side != nil {
frSide = *o.Side
}
fSide := frSide
if fSide != "" {
if err := r.SetFormParam("side", fSide); 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
}
}
}
// form param symbol
frSymbol := o.Symbol
fSymbol := frSymbol
if fSymbol != "" {
if err := r.SetFormParam("symbol", fSymbol); 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 o.TimeInForce != nil {
// form param timeInForce
var frTimeInForce string
if o.TimeInForce != nil {
frTimeInForce = *o.TimeInForce
}
fTimeInForce := frTimeInForce
if fTimeInForce != "" {
if err := r.SetFormParam("timeInForce", fTimeInForce); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}