-
Notifications
You must be signed in to change notification settings - Fork 789
/
bitfinex_types.go
855 lines (772 loc) · 25.1 KB
/
bitfinex_types.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
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
package bitfinex
import (
"errors"
"sync"
"time"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
)
var (
errSetCannotBeEmpty = errors.New("set cannot be empty")
errNoSeqNo = errors.New("no sequence number")
errUnknownError = errors.New("unknown error")
errParamNotAllowed = errors.New("param not allowed")
errParsingWSField = errors.New("error parsing WS field")
errTickerInvalidSymbol = errors.New("invalid ticker symbol")
errTickerInvalidResp = errors.New("invalid ticker response format")
errTickerInvalidFieldCount = errors.New("invalid ticker response field count")
)
// AccountV2Data stores account v2 data
type AccountV2Data struct {
ID int64
Email string
Username string
MTSAccountCreate int64
Verified int64
Timezone string
}
// MarginInfoV2 stores V2 margin data
type MarginInfoV2 struct {
Symbol string
UserPNL float64
UserSwaps float64
MarginBalance float64
MarginNet float64
MarginMin float64
TradableBalance float64
GrossBalance float64
BestAskAmount float64
BestBidAmount float64
}
// WalletDataV2 stores wallet data for v2
type WalletDataV2 struct {
WalletType string
Currency string
Balance float64
UnsettledInterest float64
}
// AcceptedOrderType defines the accepted market types, exchange strings denote non-contract order types.
var AcceptedOrderType = []string{"market", "limit", "stop", "trailing-stop",
"fill-or-kill", "exchange market", "exchange limit", "exchange stop",
"exchange trailing-stop", "exchange fill-or-kill"}
// AcceptedWalletNames defines different wallets supported by the exchange
var AcceptedWalletNames = []string{"trading", "exchange", "deposit", "margin",
"funding"}
type acceptableMethodStore struct {
a map[string][]string
m sync.RWMutex
}
// acceptableMethods holds the available acceptable deposit and withdraw methods
var acceptableMethods acceptableMethodStore
func (a *acceptableMethodStore) lookup(curr currency.Code) []string {
a.m.RLock()
defer a.m.RUnlock()
var methods []string
for k, v := range a.a {
if common.StringDataCompareInsensitive(v, curr.Upper().String()) {
methods = append(methods, k)
}
}
return methods
}
func (a *acceptableMethodStore) load(data map[string][]string) {
a.m.Lock()
defer a.m.Unlock()
a.a = data
}
func (a *acceptableMethodStore) loaded() bool {
a.m.RLock()
defer a.m.RUnlock()
return len(a.a) > 0
}
// MarginV2FundingData stores margin funding data
type MarginV2FundingData struct {
Symbol string
RateAverage float64
AmountAverage float64
}
// MarginFundingDataV2 stores margin funding data
type MarginFundingDataV2 struct {
Sym string
Symbol string
Data struct {
YieldLoan float64
YieldLend float64
DurationLoan float64
DurationLend float64
}
}
// MarginFundingData stores data for margin funding
type MarginFundingData struct {
ID int64
Symbol string
MTSCreated int64
MTSUpdated int64
Amount float64
AmountOrig float64
OrderType string
OfferStatus string
Active string
Rate float64
Period float64
Notify bool
Renew bool
}
// Ticker holds ticker information
type Ticker struct {
FlashReturnRate float64
Bid float64
BidPeriod int64
BidSize float64
Ask float64
AskPeriod int64
AskSize float64
DailyChange float64
DailyChangePerc float64
Last float64
Volume float64
High float64
Low float64
FFRAmountAvailable float64
}
// DerivativeDataResponse stores data for queried derivative
type DerivativeDataResponse struct {
Key string
MTS float64
DerivPrice float64
SpotPrice float64
MarkPrice float64
InsuranceFundBalance float64
NextFundingEventTS float64
NextFundingAccrued float64
NextFundingStep float64
CurrentFunding float64
OpenInterest float64
}
// Stat holds individual statistics from exchange
type Stat struct {
Period int64 `json:"period"`
Volume float64 `json:"volume,string"`
}
// FundingBook holds current the full margin funding book
type FundingBook struct {
Bids []FundingBookItem `json:"bids"`
Asks []FundingBookItem `json:"asks"`
}
// Book holds the orderbook item
type Book struct {
OrderID int64
Price float64
Rate float64
Period float64
Count int64
Amount float64
}
// Orderbook holds orderbook information from bid and ask sides
type Orderbook struct {
Bids []Book
Asks []Book
}
// Trade holds resp information
type Trade struct {
Timestamp int64
TID int64
Price float64
Amount float64
Exchange string
Rate float64
Period int64
Type string
Side order.Side
}
// Lendbook holds most recent funding data for a relevant currency
type Lendbook struct {
Bids []Book `json:"bids"`
Asks []Book `json:"asks"`
}
// FundingBookItem is a generalised sub-type to hold book information
type FundingBookItem struct {
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Period int `json:"period"`
Timestamp string `json:"timestamp"`
FlashReturnRate string `json:"frr"`
}
// Lends holds the lent information by currency
type Lends struct {
Rate float64 `json:"rate,string"`
AmountLent float64 `json:"amount_lent,string"`
AmountUsed float64 `json:"amount_used,string"`
Timestamp int64 `json:"timestamp"`
}
// AccountInfoFull adds the error message to Account info
type AccountInfoFull struct {
Info []AccountInfo
Message string `json:"message"`
}
// AccountInfo general account information with fees
type AccountInfo struct {
MakerFees float64 `json:"maker_fees,string"`
TakerFees float64 `json:"taker_fees,string"`
Fees []AccountInfoFees `json:"fees"`
Message string `json:"message"`
}
// AccountInfoFees general account information with fees
type AccountInfoFees struct {
Pairs string `json:"pairs"`
MakerFees float64 `json:"maker_fees,string"`
TakerFees float64 `json:"taker_fees,string"`
}
// AccountFees stores withdrawal account fee data from Bitfinex
type AccountFees struct {
Withdraw map[string]interface{} `json:"withdraw"`
}
// AccountSummary holds account summary data
type AccountSummary struct {
TradeVolumePer30D []Currency `json:"trade_vol_30d"`
FundingProfit30D []Currency `json:"funding_profit_30d"`
MakerFee float64 `json:"maker_fee"`
TakerFee float64 `json:"taker_fee"`
}
// Currency is a sub-type for AccountSummary data
type Currency struct {
Currency string `json:"curr"`
Volume float64 `json:"vol,string"`
Amount float64 `json:"amount,string"`
}
// Deposit holds the deposit address info
type Deposit struct {
Method string
CurrencyCode string
Address string // Deposit address (instead of the address, this field will show Tag/Memo/Payment_ID for currencies that require it)
PoolAddress string // Pool address (for currencies that require a Tag/Memo/Payment_ID)
}
// KeyPermissions holds the key permissions for the API key set
type KeyPermissions struct {
Account Permission `json:"account"`
History Permission `json:"history"`
Orders Permission `json:"orders"`
Positions Permission `json:"positions"`
Funding Permission `json:"funding"`
Wallets Permission `json:"wallets"`
Withdraw Permission `json:"withdraw"`
}
// Permission sub-type for KeyPermissions
type Permission struct {
Read bool `json:"read"`
Write bool `json:"write"`
}
// MarginInfo holds metadata for margin information from bitfinex
type MarginInfo struct {
Info MarginData
Message string `json:"message"`
}
// MarginData holds wallet information for margin trading
type MarginData struct {
MarginBalance float64 `json:"margin_balance,string"`
TradableBalance float64 `json:"tradable_balance,string"`
UnrealizedPL int64 `json:"unrealized_pl"`
UnrealizedSwap int64 `json:"unrealized_swap"`
NetValue float64 `json:"net_value,string"`
RequiredMargin int64 `json:"required_margin"`
Leverage float64 `json:"leverage,string"`
MarginRequirement float64 `json:"margin_requirement,string"`
MarginLimits []MarginLimits `json:"margin_limits"`
}
// MarginLimits holds limit data per pair
type MarginLimits struct {
OnPair string `json:"on_pair"`
InitialMargin float64 `json:"initial_margin,string"`
MarginRequirement float64 `json:"margin_requirement,string"`
TradableBalance float64 `json:"tradable_balance,string"`
}
// Balance holds current balance data
type Balance struct {
Type string `json:"type"`
Currency string `json:"currency"`
Amount float64 `json:"amount,string"`
Available float64 `json:"available,string"`
}
// WalletTransfer holds status of wallet to wallet content transfer on exchange
type WalletTransfer struct {
Status string `json:"status"`
Message string `json:"message"`
}
// Withdrawal holds withdrawal status information
type Withdrawal struct {
Status string `json:"status"`
Message string `json:"message"`
WithdrawalID int64 `json:"withdrawal_id"`
Fees string `json:"fees"`
WalletType string `json:"wallettype"`
Method string `json:"method"`
Address string `json:"address"`
Invoice string `json:"invoice"`
PaymentID string `json:"payment_id"`
Amount float64 `json:"amount,string"`
}
// Order holds order information when an order is in the market
type Order struct {
ID int64 `json:"id"`
Symbol string `json:"symbol"`
Exchange string `json:"exchange"`
Price float64 `json:"price,string"`
AverageExecutionPrice float64 `json:"avg_execution_price,string"`
Side string `json:"side"`
Type string `json:"type"`
Timestamp string `json:"timestamp"`
IsLive bool `json:"is_live"`
IsCancelled bool `json:"is_cancelled"`
IsHidden bool `json:"is_hidden"`
WasForced bool `json:"was_forced"`
OriginalAmount float64 `json:"original_amount,string"`
RemainingAmount float64 `json:"remaining_amount,string"`
ExecutedAmount float64 `json:"executed_amount,string"`
OrderID int64 `json:"order_id,omitempty"`
}
// OrderMultiResponse holds order information on the executed orders
type OrderMultiResponse struct {
Orders []Order `json:"order_ids"`
Status string `json:"status"`
}
// PlaceOrder is used for order placement
type PlaceOrder struct {
Symbol string `json:"symbol"`
Amount float64 `json:"amount,string"`
Price float64 `json:"price,string"`
Exchange string `json:"exchange"`
Side string `json:"side"`
Type string `json:"type"`
}
// GenericResponse holds the result for a generic response
type GenericResponse struct {
Result string `json:"result"`
}
// Position holds position information
type Position struct {
ID int64 `json:"id"`
Symbol string `json:"string"`
Status string `json:"active"`
Base float64 `json:"base,string"`
Amount float64 `json:"amount,string"`
Timestamp string `json:"timestamp"`
Swap float64 `json:"swap,string"`
PL float64 `json:"pl,string"`
}
// BalanceHistory holds balance history information
type BalanceHistory struct {
Currency string `json:"currency"`
Amount float64 `json:"amount,string"`
Balance float64 `json:"balance,string"`
Description string `json:"description"`
Timestamp string `json:"timestamp"`
}
// MovementHistory holds deposit and withdrawal history data
type MovementHistory struct {
ID int64 `json:"id"`
TxID string `json:"txid"`
Currency string `json:"currency"`
Method string `json:"method"`
Type string `json:"withdrawal"`
Amount float64 `json:"amount,string"`
Description string `json:"description"`
Address string `json:"address"`
Status string `json:"status"`
Timestamp float64 `json:"timestamp"`
TimestampCreated float64 `json:"timestamp_created"`
Fee float64 `json:"fee"`
}
// TradeHistory holds trade history data
type TradeHistory struct {
Price float64 `json:"price,string"`
Amount float64 `json:"amount,string"`
Timestamp int64 `json:"timestamp"`
Exchange string `json:"exchange"`
Type string `json:"type"`
FeeCurrency string `json:"fee_currency"`
FeeAmount float64 `json:"fee_amount,string"`
TID int64 `json:"tid"`
OrderID int64 `json:"order_id"`
}
// Offer holds offer information
type Offer struct {
ID int64 `json:"id"`
Currency string `json:"currency"`
Rate float64 `json:"rate,string"`
Period int64 `json:"period"`
Direction string `json:"direction"`
Timestamp string `json:"timestamp"`
Type string `json:"type"`
IsLive bool `json:"is_live"`
IsCancelled bool `json:"is_cancelled"`
OriginalAmount float64 `json:"original_amount,string"`
RemainingAmount float64 `json:"remaining_amount,string"`
ExecutedAmount float64 `json:"executed_amount,string"`
}
// MarginFunds holds active funding information used in a margin position
type MarginFunds struct {
ID int64 `json:"id"`
PositionID int64 `json:"position_id"`
Currency string `json:"currency"`
Rate float64 `json:"rate,string"`
Period int `json:"period"`
Amount float64 `json:"amount,string"`
Timestamp string `json:"timestamp"`
AutoClose bool `json:"auto_close"`
}
// MarginTotalTakenFunds holds position funding including sum of active backing
// as total swaps
type MarginTotalTakenFunds struct {
PositionPair string `json:"position_pair"`
TotalSwaps float64 `json:"total_swaps,string"`
}
// Fee holds fee data for a specified currency
type Fee struct {
Currency string
TakerFees float64
MakerFees float64
}
// WebsocketBook holds booking information
type WebsocketBook struct {
ID int64
Price float64
Amount float64
Period int64
}
// WebsocketTrade holds trade information
type WebsocketTrade struct {
ID int64
Timestamp int64
Price float64
Amount float64
// Funding rate of the trade
Rate float64
// Funding offer period in days
Period int64
}
// Candle holds OHLC data
type Candle struct {
Timestamp time.Time
Open float64
Close float64
High float64
Low float64
Volume float64
}
// Leaderboard keys
const (
LeaderboardUnrealisedProfitPeriodDelta = "plu_diff"
LeaderboardUnrealisedProfitInception = "plu"
LeaderboardVolume = "vol"
LeaderbookRealisedProfit = "plr"
)
// LeaderboardEntry holds leaderboard data
type LeaderboardEntry struct {
Timestamp time.Time
Username string
Ranking int
Value float64
TwitterHandle string
}
// WebsocketTicker holds ticker information
type WebsocketTicker struct {
Bid float64
BidSize float64
Ask float64
AskSize float64
DailyChange float64
DialyChangePerc float64
LastPrice float64
Volume float64
}
// WebsocketPosition holds position information
type WebsocketPosition struct {
Pair string
Status string
Amount float64
Price float64
MarginFunding float64
MarginFundingType int64
ProfitLoss float64
ProfitLossPercent float64
LiquidationPrice float64
Leverage float64
}
// WebsocketWallet holds wallet information
type WebsocketWallet struct {
Name string
Currency string
Balance float64
UnsettledInterest float64
}
// WebsocketOrder holds order data
type WebsocketOrder struct {
OrderID int64
Pair string
Amount float64
OrigAmount float64
OrderType string
Status string
Price float64
PriceAvg float64
Timestamp int64
Notify int
}
// WebsocketTradeExecuted holds executed trade data
type WebsocketTradeExecuted struct {
TradeID int64
Pair string
Timestamp int64
OrderID int64
AmountExecuted float64
PriceExecuted float64
}
// WebsocketTradeData holds executed trade data
type WebsocketTradeData struct {
TradeID int64
Pair string
Timestamp int64
OrderID int64
AmountExecuted float64
PriceExecuted float64
OrderType string
OrderPrice float64
Maker bool
Fee float64
FeeCurrency string
}
// ErrorCapture is a simple type for returned errors from Bitfinex
type ErrorCapture struct {
Message string `json:"message"`
}
// WebsocketHandshake defines the communication between the websocket API for
// initial connection
type WebsocketHandshake struct {
Event string `json:"event"`
Code int64 `json:"code"`
Version float64 `json:"version"`
}
const (
authenticatedBitfinexWebsocketEndpoint = "wss://api.bitfinex.com/ws/2"
publicBitfinexWebsocketEndpoint = "wss://api-pub.bitfinex.com/ws/2"
pong = "pong"
wsHeartbeat = "hb"
wsChecksum = "cs"
wsPositionSnapshot = "ps"
wsPositionNew = "pn"
wsPositionUpdate = "pu"
wsPositionClose = "pc"
wsWalletSnapshot = "ws"
wsWalletUpdate = "wu"
wsTradeExecutionUpdate = "tu"
wsTradeExecuted = "te"
wsFundingCreditSnapshot = "fcs"
wsFundingCreditNew = "fcn"
wsFundingCreditUpdate = "fcu"
wsFundingCreditCancel = "fcc"
wsFundingLoanSnapshot = "fls"
wsFundingLoanNew = "fln"
wsFundingLoanUpdate = "flu"
wsFundingLoanCancel = "flc"
wsFundingTradeExecuted = "fte"
wsFundingTradeUpdate = "ftu"
wsFundingInfoUpdate = "fiu"
wsBalanceUpdate = "bu"
wsMarginInfoUpdate = "miu"
wsNotification = "n"
wsOrderSnapshot = "os"
wsOrderNew = "on"
wsOrderUpdate = "ou"
wsOrderCancel = "oc"
wsRequest = "-req"
wsOrderNewRequest = wsOrderNew + wsRequest
wsOrderUpdateRequest = wsOrderUpdate + wsRequest
wsOrderCancelRequest = wsOrderCancel + wsRequest
wsFundingOfferSnapshot = "fos"
wsFundingOfferNew = "fon"
wsFundingOfferUpdate = "fou"
wsFundingOfferCancel = "foc"
wsFundingOfferNewRequest = wsFundingOfferNew + wsRequest
wsFundingOfferUpdateRequest = wsFundingOfferUpdate + wsRequest
wsFundingOfferCancelRequest = wsFundingOfferCancel + wsRequest
wsCancelMultipleOrders = "oc_multi"
wsBook = "book"
wsCandles = "candles"
wsTicker = "ticker"
wsTrades = "trades"
wsError = "error"
wsEventSubscribed = "subscribed"
wsEventUnsubscribed = "unsubscribed"
wsEventAuth = "auth"
wsEventError = "error"
wsEventConf = "conf"
wsEventInfo = "info"
)
// WsAuthRequest container for WS auth request
type WsAuthRequest struct {
Event string `json:"event"`
APIKey string `json:"apiKey"`
AuthPayload string `json:"authPayload"`
AuthSig string `json:"authSig"`
AuthNonce string `json:"authNonce"`
DeadManSwitch int64 `json:"dms,omitempty"`
}
// WsFundingOffer funding offer received via websocket
type WsFundingOffer struct {
ID int64
Symbol string
Created time.Time
Updated time.Time
Amount float64
OriginalAmount float64
Type string
Flags interface{}
Status string
Rate float64
Period int64
Notify bool
Hidden bool
Insure bool
Renew bool
RateReal float64
}
// WsCredit credit details received via websocket
type WsCredit struct {
ID int64
Symbol string
Side int8 // 1 if you are the lender, 0 if you are both the lender and borrower, -1 if you're the borrower
Created time.Time
Updated time.Time
Amount float64
Flags interface{} // Future params object (stay tuned)
Status string
Rate float64
Period int64
Opened time.Time
LastPayout time.Time
Notify bool
Hidden bool
Renew bool
RateReal float64
NoClose bool
PositionPair string
}
// WsWallet wallet update details received via websocket
type WsWallet struct {
Type string
Currency string
Balance float64
UnsettledInterest float64
BalanceAvailable float64
}
// WsBalanceInfo the total and net assets in your account received via websocket
type WsBalanceInfo struct {
TotalAssetsUnderManagement float64
NetAssetsUnderManagement float64
}
// WsFundingInfo account funding info received via websocket
type WsFundingInfo struct {
Symbol string
YieldLoan float64
YieldLend float64
DurationLoan float64
DurationLend float64
}
// WsMarginInfoBase account margin info received via websocket
type WsMarginInfoBase struct {
UserProfitLoss float64
UserSwaps float64
MarginBalance float64
MarginNet float64
MarginRequired float64
}
// WsFundingTrade recent funding trades received via websocket
type WsFundingTrade struct {
ID int64
Symbol string
MTSCreated time.Time
OfferID int64
Amount float64
Rate float64
Period int64
Maker bool
}
// WsNewOrderRequest new order request...
type WsNewOrderRequest struct {
GroupID int64 `json:"gid,omitempty"`
CustomID int64 `json:"cid,omitempty"`
Type string `json:"type"`
Symbol string `json:"symbol"`
Amount float64 `json:"amount,string"`
Price float64 `json:"price,string"`
Leverage int64 `json:"lev,omitempty"`
TrailingPrice float64 `json:"price_trailing,string,omitempty"`
AuxiliaryLimitPrice float64 `json:"price_aux_limit,string,omitempty"`
StopPrice float64 `json:"price_oco_stop,string,omitempty"`
Flags int64 `json:"flags,omitempty"`
TimeInForce string `json:"tif,omitempty"`
}
// WsUpdateOrderRequest update order request...
type WsUpdateOrderRequest struct {
OrderID int64 `json:"id,omitempty"`
CustomID int64 `json:"cid,omitempty"`
CustomIDDate string `json:"cid_date,omitempty"`
GroupID int64 `json:"gid,omitempty"`
Price float64 `json:"price,string,omitempty"`
Amount float64 `json:"amount,string,omitempty"`
Leverage int64 `json:"lev,omitempty"`
Delta float64 `json:"delta,string,omitempty"`
AuxiliaryLimitPrice float64 `json:"price_aux_limit,string,omitempty"`
TrailingPrice float64 `json:"price_trailing,string,omitempty"`
Flags int64 `json:"flags,omitempty"`
TimeInForce string `json:"tif,omitempty"`
}
// WsCancelOrderRequest cancel order request...
type WsCancelOrderRequest struct {
OrderID int64 `json:"id,omitempty"`
CustomID int64 `json:"cid,omitempty"`
CustomIDDate string `json:"cid_date,omitempty"`
}
// WsCancelGroupOrdersRequest cancel orders request...
type WsCancelGroupOrdersRequest struct {
OrderID []int64 `json:"id,omitempty"`
CustomID [][]int64 `json:"cid,omitempty"`
GroupOrderID []int64 `json:"gid,omitempty"`
}
// WsNewOfferRequest new offer request
type WsNewOfferRequest struct {
Type string `json:"type,omitempty"`
Symbol string `json:"symbol,omitempty"`
Amount float64 `json:"amount,string,omitempty"`
Rate float64 `json:"rate,string,omitempty"`
Period float64 `json:"period,omitempty"`
Flags int64 `json:"flags,omitempty"`
}
// WsCancelOfferRequest cancel offer request
type WsCancelOfferRequest struct {
OrderID int64 `json:"id"`
}
// WsCancelAllOrdersRequest cancel all orders request
type WsCancelAllOrdersRequest struct {
All int64 `json:"all"`
}
// CancelMultiOrderResponse holds v2 cancelled order data
type CancelMultiOrderResponse struct {
OrderID string
ClientOrderID string
GroupOrderID string
Symbol string
CreatedTime time.Time
UpdatedTime time.Time
Amount float64
OriginalAmount float64
OrderType string
OriginalOrderType string
OrderFlags string
OrderStatus string
Price float64
AveragePrice float64
TrailingPrice float64
AuxLimitPrice float64
}