-
Notifications
You must be signed in to change notification settings - Fork 2
/
futures_types.go
845 lines (796 loc) · 28.6 KB
/
futures_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
package huobi
// FContractInfoData gets contract info data for futures
type FContractInfoData struct {
Data []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
ContractSize float64 `json:"contract_size"`
PriceTick float64 `json:"price_tick"`
DeliveryDate string `json:"delivery_date"`
CreateDate string `json:"create_date"`
ContractStatus int64 `json:"contract_status"`
}
}
// FContractIndexPriceInfo stores contract index price
type FContractIndexPriceInfo struct {
Data []struct {
Symbol string `json:"symbol"`
IndexPrice float64 `json:"index_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FContractPriceLimits gets limits for futures contracts
type FContractPriceLimits struct {
Data struct {
Symbol string `json:"symbol"`
HighLimit float64 `json:"high_limit"`
LowLimit float64 `json:"low_limit"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FContractOIData stores open interest data for futures contracts
type FContractOIData struct {
Data []struct {
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
Volume float64 `json:"volume"`
Amount float64 `json:"amount"`
ContractCode string `json:"contract_code"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FEstimatedDeliveryPriceInfo stores estimated delivery price data for futures
type FEstimatedDeliveryPriceInfo struct {
Data struct {
DeliveryPrice float64 `json:"delivery_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FMarketDepth gets orderbook data for futures
type FMarketDepth struct {
Ch string `json:"ch"`
Timestamp int64 `json:"ts"`
Tick struct {
MRID int64 `json:"mrid"`
ID int64 `json:"id"`
Bids [][2]float64 `json:"bids"`
Asks [][2]float64 `json:"asks"`
Timestamp int64 `json:"ts"`
Version int64 `json:"version"`
Ch string `json:"ch"`
} `json:"tick"`
}
// OBData stores market depth data
type OBData struct {
Symbol string
Asks []obItem
Bids []obItem
}
type obItem struct {
Price float64
Quantity float64
}
// FKlineData stores kline data for futures
type FKlineData struct {
Ch string `json:"ch"`
Data []struct {
Vol float64 `json:"vol"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
ID int64 `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Amount float64 `json:"amount"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FMarketOverviewData stores overview data for futures
type FMarketOverviewData struct {
Ch string `json:"ch"`
Tick struct {
Vol float64 `json:"vol,string"`
Ask [2]float64
Bid [2]float64
Close float64 `json:"close,string"`
Count float64 `json:"count"`
High float64 `json:"high,string"`
ID int64 `jso:"id"`
Low float64 `json:"low,string"`
Open float64 `json:"open,string"`
Timestamp int64 `json:"ts"`
Amount float64 `json:"amount,string"`
} `json:"tick"`
Timestamp int64 `json:"ts"`
}
// FLastTradeData stores last trade's data for a contract
type FLastTradeData struct {
Ch string `json:"ch"`
Tick struct {
Data []struct {
Amount float64 `json:"amount,string"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price,string"`
Timestamp int64 `json:"ts"`
} `json:"data"`
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
} `json:"tick"`
Timestamp int64 `json:"ts"`
}
// FBatchTradesForContractData stores batch of trades data for a contract
type FBatchTradesForContractData struct {
Ch string `json:"ch"`
Timestamp int64 `json:"ts"`
Data []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Data []struct {
Amount float64 `json:"amount"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Timestamp int64 `json:"ts"`
} `json:"data"`
} `json:"data"`
}
// FClawbackRateAndInsuranceData stores clawback rate and insurance data for futures
type FClawbackRateAndInsuranceData struct {
Timestamp int64 `json:"ts"`
Data []struct {
Symbol string `json:"symbol"`
InsuranceFund float64 `json:"insurance_fund"`
EstimatedClawback float64 `json:"estimated_clawback"`
} `json:"data"`
}
// FHistoricalInsuranceRecordsData stores historical records of insurance fund balances for futures
type FHistoricalInsuranceRecordsData struct {
Timestamp int64 `json:"timestamp"`
Data struct {
Symbol string `json:"symbol"`
Tick []struct {
InsuranceFund float64 `json:"insurance_fund"`
Timestamp int64 `json:"ts"`
} `json:"tick"`
} `json:"data"`
}
// FTieredAdjustmentFactorInfo stores info on adjustment factor for futures
type FTieredAdjustmentFactorInfo struct {
Data []struct {
Symbol string `json:"symbol"`
List []struct {
LeverageRate float64 `json:"lever_rate"`
Ladders []struct {
Ladder int64 `json:"ladder"`
MinSize float64 `json:"min_size"`
MaxSize float64 `json:"max_size"`
AdjustFactor float64 `json:"adjust_factor"`
} `json:"ladders"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FOIData gets oi data on futures
type FOIData struct {
Data struct {
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
Tick []struct {
Volume float64 `json:"volume,string"`
AmountType int64 `json:"amount_type"`
Timestamp int64 `json:"ts"`
} `json:"tick"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FInfoSystemStatusData stores system status info for futures
type FInfoSystemStatusData struct {
Data []struct {
Symbol string `json:"symbol"`
Open int64 `json:"open"`
Close int64 `json:"close"`
Cancel int64 `json:"cancel"`
TransferIn int64 `json:"transfer_in"`
TransferOut int64 `json:"transfer_out"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FTopAccountsLongShortRatio stores long/short ratio for top futures accounts
type FTopAccountsLongShortRatio struct {
Data struct {
List []struct {
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
LockedRatio float64 `json:"locked_ratio"`
Timestamp int64 `json:"ts"`
} `json:"list"`
Symbol string `json:"symbol"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FTopPositionsLongShortRatio stores long short ratio for top futures positions
type FTopPositionsLongShortRatio struct {
Data struct {
Symbol string `json:"symbol"`
List []struct {
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
Timestamp int64 `json:"timestamp"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
}
// FLiquidationOrdersInfo stores data of futures liquidation orders
type FLiquidationOrdersInfo struct {
Data struct {
Orders []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Direction string `json:"direction"`
Offset string `json:"offset"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
CreatedAt int64 `json:"created_at"`
} `json:"orders"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FIndexKlineData stores index kline data for futures
type FIndexKlineData struct {
Ch string `json:"ch"`
Data []struct {
Vol float64 `json:"vol"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
ID int64 `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Amount float64 `json:"amount"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FBasisData stores basis data for futures
type FBasisData struct {
Ch string `json:"ch"`
Data []struct {
Basis float64 `json:"basis,string"`
BasisRate float64 `json:"basis_rate,string"`
ContractPrice float64 `json:"contract_price,string"`
ID int64 `json:"id"`
IndexPrice float64 `json:"index_price,string"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FUserAccountData stores user account data info for futures
type FUserAccountData struct {
AccData []struct {
Symbol string `json:"symbol"`
MarginBalance float64 `json:"margin_balance"`
MarginPosition float64 `json:"margin_position"`
MarginFrozen float64 `json:"margin_frozen"`
MarginAvailable float64 `json:"margin_available"`
ProfitReal float64 `json:"profit_real"`
ProfitUnreal float64 `json:"profit_unreal"`
RiskRate float64 `json:"risk_rate"`
LiquidationPrice float64 `json:"liquidation_price"`
WithdrawAvailable float64 `json:"withdraw_available"`
LeverageRate float64 `json:"lever_rate"`
AdjustFactor float64 `json:"adjust_factor"`
MarginStatic float64 `json:"margin_static"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FUsersPositionsInfo stores positions data for futures
type FUsersPositionsInfo struct {
PosInfo []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
Volume float64 `json:"volume"`
Available float64 `json:"available"`
Frozen float64 `json:"frozen"`
CostOpen float64 `json:"cost_open"`
CostHold float64 `json:"cost_hold"`
ProfitUnreal float64 `json:"profit_unreal"`
ProfitRate float64 `json:"profit_rate"`
Profit float64 `json:"profit"`
PositionMargin float64 `json:"position_margin"`
LeverageRate float64 `json:"lever_rate"`
Direction string `json:"direction"`
LastPrice float64 `json:"last_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FSubAccountAssetsInfo gets subaccounts asset data
type FSubAccountAssetsInfo struct {
Timestamp int64 `json:"ts"`
Data []struct {
SubUID int64 `json:"sub_uid"`
List []struct {
Symbol string `json:"symbol"`
MarginBalance float64 `json:"margin_balance"`
LiquidationPrice float64 `json:"liquidation_price"`
RiskRate float64 `json:"risk_rate"`
} `json:"list"`
} `json:"data"`
}
// FSingleSubAccountAssetsInfo stores futures assets info for a single subaccount
type FSingleSubAccountAssetsInfo struct {
AssetsData []struct {
Symbol string `json:"symbol"`
MarginBalance float64 `json:"margin_balance"`
MarginPosition float64 `json:"margin_position"`
MarginFrozen float64 `json:"margin_frozen"`
MarginAvailable float64 `json:"margin_available"`
ProfitReal float64 `json:"profit_real"`
ProfitUnreal float64 `json:"profit_unreal"`
WithdrawAvailable float64 `json:"withdraw_available"`
RiskRate float64 `json:"risk_rate"`
LiquidationPrice float64 `json:"liquidation_price"`
AdjustFactor float64 `json:"adjust_factor"`
LeverageRate float64 `json:"lever_rate"`
MarginStatic float64 `json:"margin_static"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FSingleSubAccountPositionsInfo stores futures positions' info for a single subaccount
type FSingleSubAccountPositionsInfo struct {
PositionsData []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
Volume float64 `json:"volume"`
Available float64 `json:"available"`
Frozen float64 `json:"frozen"`
CostOpen float64 `json:"cost_open"`
CostHold float64 `json:"cost_hold"`
ProfitUnreal float64 `json:"profit_unreal"`
ProfitRate float64 `json:"profit_rate"`
Profit float64 `json:"profit"`
PositionMargin float64 `json:"position_margin"`
LeverageRate float64 `json:"lever_rate"`
Direction string `json:"direction"`
LastPrice float64 `json:"last_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FFinancialRecords stores financial records data for futures
type FFinancialRecords struct {
Data struct {
FinancialRecord []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
RecordType int64 `json:"type"`
Amount float64 `json:"amount"`
} `json:"financial_record"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FSettlementRecords stores user's futures settlement records
type FSettlementRecords struct {
Data struct {
SettlementRecords []struct {
Symbol string `json:"symbol"`
MarginBalanceInit float64 `json:"margin_balance_init"`
MarginBalance int64 `json:"margin_balance"`
SettlementProfitReal float64 `json:"settlement_profit_real"`
SettlementTime int64 `json:"settlement_time"`
Clawback float64 `json:"clawback"`
DeliveryFee float64 `json:"delivery_fee"`
OffsetProfitLoss float64 `json:"offset_profitloss"`
Fee float64 `json:"fee"`
FeeAsset string `json:"fee_asset"`
Positions []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Direction string `json:"direction"`
Volume float64 `json:"volume"`
CostOpen float64 `json:"cost_open"`
CostHoldPre float64 `json:"cost_hold_pre"`
CostHold float64 `json:"cost_hold"`
SettlementProfitUnreal float64 `json:"settlement_profit_unreal"`
SettlementPrice float64 `json:"settlement_price"`
SettlmentType string `json:"settlement_type"`
} `json:"positions"`
} `json:"settlement_records"`
CurrentPage int64 `json:"current_page"`
TotalPage int64 `json:"total_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FContractInfoOnOrderLimit stores contract info on futures order limit
type FContractInfoOnOrderLimit struct {
ContractData []struct {
OrderPriceType string `json:"order_price_type"`
List []struct {
Symbol string `json:"symbol"`
ContractTypes []struct {
ContractType string `json:"contract_type"`
OpenLimit int64 `json:"open_limit"`
CloseLimit int64 `json:"close_limit"`
} `json:"types"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FContractTradingFeeData stores contract trading fee data
type FContractTradingFeeData struct {
ContractTradingFeeData []struct {
Symbol string `json:"symbol"`
OpenMakerFee float64 `json:"open_maker_fee,string"`
OpenTakerFee float64 `json:"open_taker_fee,string"`
CloseMakerFee float64 `json:"close_maker_fee,string"`
CloseTakerFee float64 `json:"close_taker_fee,string"`
DeliveryFee float64 `json:"delivery_fee,string"`
FeeAsset string `json:"fee_asset"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FTransferLimitData stores transfer limit data for futures
type FTransferLimitData struct {
Data []struct {
Symbol string `json:"symbol"`
MaxTransferIn float64 `json:"transfer_in_max_each"`
MinTransferIn float64 `json:"transfer_in_min_each"`
MaxTransferOut float64 `json:"transfer_out_max_each"`
MinTransferOut float64 `json:"transfer_out_min_each"`
MaxTransferInDaily float64 `json:"transfer_in_max_daily"`
MaxTransferOutDaily float64 `json:"transfer_out_max_daily"`
NetTransferInMaxDaily float64 `json:"net_transfer_in_max_daily"`
NetTransferOutMaxDaily float64 `json:"net_transfer_out_max_daily"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FPositionLimitData stores information on futures positions limit
type FPositionLimitData struct {
Data []struct {
Symbol string `json:"symbol"`
List []struct {
ContractType string `json:"contract_type"`
BuyLimit float64 `json:"buy_limit"`
SellLimit float64 `json:"sell_limit"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FAssetsAndPositionsData stores assets and positions data for futures
type FAssetsAndPositionsData struct {
Data []struct {
Symbol string `json:"symbol"`
MarginBalance float64 `json:"margin_balance"`
MarginPosition float64 `json:"margin_position"`
MarginFrozen float64 `json:"margin_frozen"`
MarginAvailable float64 `json:"margin_available"`
ProfitReal float64 `json:"profit_real"`
ProfitUnreal float64 `json:"profit_unreal"`
RiskRate float64 `json:"risk_rate"`
WithdrawAvailable float64 `json:"withdraw_available"`
} `json:"data"`
}
// FAccountTransferData stores internal transfer data for futures
type FAccountTransferData struct {
Status string `json:"status"`
Timestamp int64 `json:"ts"`
Data struct {
OrderID string `json:"order_id"`
} `json:"data"`
}
// FTransferRecords gets transfer records data
type FTransferRecords struct {
Timestamp int64 `json:"ts"`
Data struct {
TransferRecord []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
SubUID int64 `json:"sub_uid"`
SubAccountName string `json:"sub_account_name"`
TransferType int64 `json:"transfer_type"`
Amount float64 `json:"amount"`
} `json:"transfer_record"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
}
// FAvailableLeverageData stores available leverage data for futures
type FAvailableLeverageData struct {
Data []struct {
Symbol string `json:"symbol"`
AvailableLeverageRate string `json:"available_level_rate"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
}
// FOrderData stores order data for futures
type FOrderData struct {
Data struct {
OrderID int64 `json:"order_id"`
OrderIDStr string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
type fBatchOrderData struct {
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
ClientOrderID string `json:"client_order_id"`
Price float64 `json:"price"`
Volume float64 `json:"volume"`
Direction string `json:"direction"`
Offset string `json:"offset"`
LeverageRate float64 `json:"leverRate"`
OrderPriceType string `json:"orderPriceType"`
}
// FBatchOrderResponse stores batch order data
type FBatchOrderResponse struct {
OrdersData []FOrderData `json:"orders_data"`
}
// FCancelOrderData stores cancel order data
type FCancelOrderData struct {
Data struct {
Errors []struct {
OrderID int64 `json:"order_id,string"`
ErrCode int64 `json:"err_code"`
ErrMsg string `json:"err_msg"`
} `json:"errors"`
Successes string `json:"successes"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FOrderInfo stores order info
type FOrderInfo struct {
Data []struct {
ClientOrderID int64 `json:"client_order_id"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
CreatedAt int64 `json:"created_at"`
CanceledAt int64 `json:"canceled_at"`
Direction string `json:"direction"`
Fee float64 `json:"fee"`
FeeAsset string `json:"fee_asset"`
LeverRate int64 `json:"lever_rate"`
MarginFrozen float64 `json:"margin_frozen"`
Offset string `json:"offset"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_string"`
OrderPriceType string `json:"order_price_type"`
OrderSource string `json:"order_source"`
OrderType int64 `json:"order_type"`
Price float64 `json:"price"`
Profit float64 `json:"profit"`
Status int64 `json:"status"`
Symbol string `json:"symbol"`
TradeAvgPrice float64 `json:"trade_avg_price"`
TradeTurnover float64 `json:"trade_turnover"`
TradeVolume float64 `json:"trade_volume"`
Volume float64 `json:"volume"`
LiquidationType int64 `json:"liquidation_type"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
}
// FOrderDetailsData stores order details for futures orders
type FOrderDetailsData struct {
Data struct {
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
OrderPriceType string `json:"order_price_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
LeverageRate float64 `json:"lever_rate"`
MarginFrozen float64 `json:"margin_frozen"`
Profit float64 `json:"profit"`
OrderSource string `json:"order_source"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
OrderType int64 `json:"order_type"`
Status int64 `json:"status"`
TradeVolume float64 `json:"trade_volume"`
TradeTurnover int64 `json:"trade_turnover"`
TradeAvgPrice float64 `json:"trade_avg_price"`
Fee float64 `json:"fee"`
CreatedAt int64 `json:"created_at"`
CanceledAt int64 `json:"canceled_at"`
FinalInterest float64 `json:"final_interest"`
AdjustValue int64 `json:"adjust_value"`
FeeAsset string `json:"fee_asset"`
Trades []struct {
ID string `json:"id"`
TradeID int64 `json:"trade_id"`
TradeVolume float64 `json:"trade_volume"`
TradePrice float64 `json:"trade_price"`
TradeFee float64 `json:"trade_fee"`
TradeTurnover float64 `json:"trade_turnover"`
Role string `json:"role"`
CreatedAt int64 `json:"created_at"`
} `json:"trades"`
TotalPage int64 `json:"total_page"`
TotalSize int64 `json:"total_size"`
CurrentPage int64 `json:"current_page"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FOpenOrdersData stores open orders data for futures
type FOpenOrdersData struct {
Data struct {
Orders []struct {
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
OrderPriceType string `json:"order_price_type"`
OrderType int64 `json:"order_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
LeverageRate float64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_string"`
ClientOrderID int64 `json:"client_order_id"`
OrderSource string `json:"order_source"`
CreatedAt int64 `json:"created_at"`
TradeVolume float64 `json:"trade_volume"`
Fee float64 `json:"fee"`
TradeAvgPrice float64 `json:"trade_avg_price"`
MarginFrozen float64 `json:"margin_frozen"`
Profit float64 `json:"profit"`
Status int64 `json:"status"`
FeeAsset string `json:"fee_asset"`
} `json:"orders"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FOrderHistoryData stores order history data
type FOrderHistoryData struct {
Data struct {
Orders []struct {
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
OrderPriceType string `json:"order_price_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
LeverageRate float64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
OrderSource string `json:"order_source"`
CreateDate int64 `json:"create_date"`
TradeVolume float64 `json:"trade_volume"`
TradeTurnover float64 `json:"trade_turnover"`
Fee float64 `json:"fee"`
TradeAvgPrice float64 `json:"trade_avg_price"`
MarginFrozen float64 `json:"margin_frozen"`
Profit float64 `json:"profit"`
Status int64 `json:"status"`
OrderType int64 `json:"order_type"`
FeeAsset string `json:"fee_asset"`
LiquidationType int64 `json:"liquidation_type"`
} `json:"orders"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FTradeHistoryData stores trade history data for futures
type FTradeHistoryData struct {
Data struct {
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
Trades []struct {
ID string `json:"id"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
CreateDate int64 `json:"create_date"`
Direction string `json:"direction"`
MatchID int64 `json:"match_id"`
Offset string `json:"offset"`
OffsetPNL float64 `json:"offset_profitloss"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
Symbol string `json:"symbol"`
OrderSource string `json:"order_source"`
TradeFee float64 `json:"trade_fee"`
TradePrice float64 `json:"trade_price"`
TradeTurnover float64 `json:"trade_turnover"`
TradeVolume float64 `json:"trade_volume"`
Role string `json:"role"`
FeeAsset string `json:"fee_asset"`
} `json:"trades"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FTriggerOrderData stores trigger order data
type FTriggerOrderData struct {
Data struct {
OrderID int64 `json:"order_id"`
OrderIDStr string `json:"order_id_str"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FTriggerOpenOrders stores trigger open orders data
type FTriggerOpenOrders struct {
Data struct {
Orders []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
TriggerType string `json:"trigger_type"`
Volume float64 `json:"volume"`
OrderType int64 `json:"order_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
LeverageRate float64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
OrderSource string `json:"order_source"`
TriggerPrice float64 `json:"trigger_price"`
OrderPrice float64 `json:"order_price"`
CreatedAt int64 `json:"created_at"`
OrderPriceType string `json:"order_price_type"`
Status int64 `json:"status"`
} `json:"orders"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}
// FTriggerOrderHistoryData stores trigger order history for futures
type FTriggerOrderHistoryData struct {
Data struct {
Orders []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
TriggerType string `json:"trigger_type"`
Volume float64 `json:"volume"`
OrderType int64 `json:"order_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
LeverageRate float64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
RelationOrderID string `json:"relation_order_id"`
OrderPriceType string `json:"order_price_type"`
Status string `json:"status"`
OrderSource string `json:"order_source"`
TriggerPrice int64 `json:"trigger_price"`
TriggeredPrice float64 `json:"triggered_price"`
OrderPrice float64 `json:"order_price"`
CreatedAt int64 `json:"created_at"`
TriggeredAt int64 `json:"triggered_at"`
OrderInsertAt float64 `json:"order_insert_at"`
CancelledAt int64 `json:"canceled_at"`
FailCode int64 `json:"fail_code"`
FailReason string `json:"fail_reason"`
} `json:"orders"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
}