@@ -54,6 +54,16 @@ def get_universal_transfers(self, transfer_type: Optional[str] = None, asset: Op
54
54
:type end_time: Optional[int]
55
55
:return: The raw rows selected as saved in the database
56
56
:rtype: List[Tuple]
57
+
58
+ .. code-block:: python
59
+
60
+ [
61
+ (1206491332, # transfer id
62
+ 'MAIN_MARGIN', # transfer type
63
+ 1589121841000, # time
64
+ 'BNB', # asset
65
+ 10.594112), # amount
66
+ ]
57
67
"""
58
68
table = tables .UNIVERSAL_TRANSFER_TABLE
59
69
@@ -76,7 +86,7 @@ def get_universal_transfers(self, transfer_type: Optional[str] = None, asset: Op
76
86
end_time ))
77
87
return self .get_conditions_rows (table , conditions_list = conditions_list )
78
88
79
- def get_last_universal_transfer (self , transfer_type : str ):
89
+ def get_last_universal_transfer_time (self , transfer_type : str ) -> int :
80
90
"""
81
91
return the latest time when a universal transfer was made
82
92
If None, return the millistamp corresponding to 2017/01/01
@@ -148,6 +158,15 @@ def get_margin_interests(self, margin_type: str, asset: Optional[str] = None, st
148
158
:type end_time: Optional[int]
149
159
:return: The raw rows selected as saved in the database
150
160
:rtype: List[Tuple]
161
+
162
+ .. code-block:: python
163
+
164
+ [
165
+ 1559415215400, # time
166
+ 'BNB', # asset
167
+ 0.51561, # interest
168
+ 'PERIODIC_CONVERTED'), # interest type
169
+ ]
151
170
"""
152
171
if margin_type == 'cross' :
153
172
table = tables .CROSS_MARGIN_INTEREST_TABLE
@@ -255,6 +274,16 @@ def get_repays(self, margin_type: str, asset: Optional[str] = None, start_time:
255
274
:type end_time: Optional[int]
256
275
:return: The raw rows selected as saved in the database
257
276
:rtype: List[Tuple]
277
+
278
+ .. code-block:: python
279
+
280
+ [
281
+ (8289451654, # transaction id
282
+ 1559415215400, # time
283
+ 'USDT', # asset
284
+ 145.5491462, # principal
285
+ 0.51561), # interest
286
+ ]
258
287
"""
259
288
if margin_type == 'cross' :
260
289
table = tables .CROSS_MARGIN_REPAY_TABLE
@@ -278,7 +307,7 @@ def get_repays(self, margin_type: str, asset: Optional[str] = None, start_time:
278
307
end_time ))
279
308
return self .get_conditions_rows (table , conditions_list = conditions_list )
280
309
281
- def get_last_repay_time (self , asset : str , margin_type : str ):
310
+ def get_last_repay_time (self , asset : str , margin_type : str ) -> int :
282
311
"""
283
312
return the latest time when a repay was made on a defined asset
284
313
If None, return the millistamp corresponding to 2017/01/01
@@ -358,6 +387,15 @@ def get_loans(self, margin_type: str, asset: Optional[str] = None, start_time: O
358
387
:type end_time: Optional[int]
359
388
:return: The raw rows selected as saved in the database
360
389
:rtype: List[Tuple]
390
+
391
+ .. code-block:: python
392
+
393
+ [
394
+ (8289451654, # transaction id
395
+ 1559415215400, # time
396
+ 'USDT', # asset
397
+ 145.5491462), # amount
398
+ ]
361
399
"""
362
400
if margin_type == 'cross' :
363
401
table = tables .CROSS_MARGIN_LOAN_TABLE
@@ -381,7 +419,7 @@ def get_loans(self, margin_type: str, asset: Optional[str] = None, start_time: O
381
419
end_time ))
382
420
return self .get_conditions_rows (table , conditions_list = conditions_list )
383
421
384
- def get_last_loan_time (self , asset : str , margin_type : str ):
422
+ def get_last_loan_time (self , asset : str , margin_type : str ) -> int :
385
423
"""
386
424
return the latest time when an loan was made on a defined asset
387
425
If None, return the millistamp corresponding to 2017/01/01
@@ -442,7 +480,7 @@ def get_lending_redemptions(self, lending_type: Optional[str] = None, asset: Opt
442
480
"""
443
481
return lending redemptions stored in the database. Asset type and time filters can be used
444
482
445
- :param lending_type:fetch only redemptions from this lending type
483
+ :param lending_type: fetch only redemptions from this lending type
446
484
:type lending_type: Optional[str]
447
485
:param asset: fetch only redemptions from this asset
448
486
:type asset: Optional[str]
@@ -452,6 +490,15 @@ def get_lending_redemptions(self, lending_type: Optional[str] = None, asset: Opt
452
490
:type end_time: Optional[int]
453
491
:return: The raw rows selected as saved in the database
454
492
:rtype: List[Tuple]
493
+
494
+ .. code-block:: python
495
+
496
+ [
497
+ 1612841562000, # time
498
+ 'DAILY', # lending type
499
+ 'LTC', # asset
500
+ 1.89151684), # amount
501
+ ]
455
502
"""
456
503
conditions_list = []
457
504
table = tables .LENDING_REDEMPTION_TABLE
@@ -473,7 +520,7 @@ def get_lending_redemptions(self, lending_type: Optional[str] = None, asset: Opt
473
520
end_time ))
474
521
return self .get_conditions_rows (table , conditions_list = conditions_list )
475
522
476
- def get_last_lending_redemption_time (self , lending_type : Optional [str ] = None ):
523
+ def get_last_lending_redemption_time (self , lending_type : Optional [str ] = None ) -> int :
477
524
"""
478
525
return the latest time when an lending redemption was made.
479
526
If None, return the millistamp corresponding to 2017/01/01
@@ -530,7 +577,7 @@ def get_lending_purchases(self, lending_type: Optional[str] = None, asset: Optio
530
577
"""
531
578
return lending purchases stored in the database. Asset type and time filters can be used
532
579
533
- :param lending_type:fetch only purchases from this lending type
580
+ :param lending_type: fetch only purchases from this lending type
534
581
:type lending_type: Optional[str]
535
582
:param asset: fetch only purchases from this asset
536
583
:type asset: Optional[str]
@@ -540,6 +587,16 @@ def get_lending_purchases(self, lending_type: Optional[str] = None, asset: Optio
540
587
:type end_time: Optional[int]
541
588
:return: The raw rows selected as saved in the database
542
589
:rtype: List[Tuple]
590
+
591
+ .. code-block:: python
592
+
593
+ [
594
+ (58516828, # purchase id
595
+ 1612841562000, # time
596
+ 'DAILY', # lending type
597
+ 'LTC', # asset
598
+ 1.89151684), # amount
599
+ ]
543
600
"""
544
601
conditions_list = []
545
602
table = tables .LENDING_PURCHASE_TABLE
@@ -561,7 +618,7 @@ def get_lending_purchases(self, lending_type: Optional[str] = None, asset: Optio
561
618
end_time ))
562
619
return self .get_conditions_rows (table , conditions_list = conditions_list )
563
620
564
- def get_last_lending_purchase_time (self , lending_type : Optional [str ] = None ):
621
+ def get_last_lending_purchase_time (self , lending_type : Optional [str ] = None ) -> int :
565
622
"""
566
623
return the latest time when an lending purchase was made.
567
624
If None, return the millistamp corresponding to 2017/01/01
@@ -616,7 +673,7 @@ def get_lending_interests(self, lending_type: Optional[str] = None, asset: Optio
616
673
"""
617
674
return lending interests stored in the database. Asset type and time filters can be used
618
675
619
- :param lending_type:fetch only interests from this lending type
676
+ :param lending_type: fetch only interests from this lending type
620
677
:type lending_type: Optional[str]
621
678
:param asset: fetch only interests from this asset
622
679
:type asset: Optional[str]
@@ -626,6 +683,16 @@ def get_lending_interests(self, lending_type: Optional[str] = None, asset: Optio
626
683
:type end_time: Optional[int]
627
684
:return: The raw rows selected as saved in the database
628
685
:rtype: List[Tuple]
686
+
687
+ .. code-block:: python
688
+
689
+ [
690
+ (1619846515000, # time
691
+ 'DAILY', # lending type
692
+ 'DOT', # asset
693
+ 0.00490156) # amount
694
+ ]
695
+
629
696
"""
630
697
conditions_list = []
631
698
table = tables .LENDING_INTEREST_TABLE
@@ -647,7 +714,7 @@ def get_lending_interests(self, lending_type: Optional[str] = None, asset: Optio
647
714
end_time ))
648
715
return self .get_conditions_rows (table , conditions_list = conditions_list )
649
716
650
- def get_last_lending_interest_time (self , lending_type : Optional [str ] = None ):
717
+ def get_last_lending_interest_time (self , lending_type : Optional [str ] = None ) -> int :
651
718
"""
652
719
return the latest time when an interest was received.
653
720
If None, return the millistamp corresponding to 2017/01/01
@@ -680,7 +747,6 @@ def add_dust(self, tran_id: str, time: int, asset: str, asset_amount: float, bnb
680
747
auto_commit : bool = True ):
681
748
"""
682
749
add dust operation to the database
683
- https://binance-docs.github.io/apidocs/spot/en/#dustlog-user_data
684
750
685
751
:param tran_id: id of the transaction (non unique)
686
752
:type tran_id: str
@@ -716,6 +782,17 @@ def get_spot_dusts(self, asset: Optional[str] = None, start_time: Optional[int]
716
782
:type end_time: Optional[int]
717
783
:return: The raw rows selected as saved in the database
718
784
:rtype: List[Tuple]
785
+
786
+ .. code-block:: python
787
+
788
+ [
789
+ (82156485284, # transaction id
790
+ 1605489113400, # time
791
+ 'TRX', # asset
792
+ 102.78415879, # asset amount
793
+ 0.09084498, # bnb amount
794
+ 0.00171514), # bnb fee
795
+ ]
719
796
"""
720
797
conditions_list = []
721
798
table = tables .SPOT_DUST_TABLE
@@ -766,6 +843,16 @@ def get_spot_dividends(self, asset: Optional[str] = None, start_time: Optional[i
766
843
:type end_time: Optional[int]
767
844
:return: The raw rows selected as saved in the database
768
845
:rtype: List[Tuple]
846
+
847
+ .. code-block:: python
848
+
849
+ [
850
+ (8945138941, # dividend id
851
+ 1594513589000, # time
852
+ 'TRX', # asset
853
+ 0.18745654), # amount
854
+ ]
855
+
769
856
"""
770
857
conditions_list = []
771
858
table = tables .SPOT_DIVIDEND_TABLE
@@ -842,6 +929,18 @@ def get_spot_withdraws(self, asset: Optional[str] = None, start_time: Optional[i
842
929
:type end_time: Optional[int]
843
930
:return: The raw rows selected as saved in the database
844
931
:rtype: List[Tuple]
932
+
933
+ .. code-block:: python
934
+
935
+ [
936
+ ('84984dcqq5z11gyjfa', # withdraw id
937
+ 'aazd8949vredqs56dz', # transaction id
938
+ 1599138389000, # withdraw time
939
+ 'XTZ', # asset
940
+ 57.0194, # amount
941
+ 0.5), # fee
942
+ ]
943
+
845
944
"""
846
945
conditions_list = []
847
946
table = tables .SPOT_WITHDRAW_TABLE
@@ -912,6 +1011,16 @@ def get_spot_deposits(self, asset: Optional[str] = None, start_time: Optional[in
912
1011
:type end_time: Optional[int]
913
1012
:return: The raw rows selected as saved in the database
914
1013
:rtype: List[Tuple]
1014
+
1015
+ .. code-block:: python
1016
+
1017
+ [
1018
+ ('azdf5e6a1d5z', # transaction id
1019
+ 1589479004000, # deposit time
1020
+ 'LTC', # asset
1021
+ 14.25), # amount
1022
+ ]
1023
+
915
1024
"""
916
1025
conditions_list = []
917
1026
table = tables .SPOT_DEPOSIT_TABLE
@@ -934,7 +1043,8 @@ def get_last_spot_deposit_time(self) -> int:
934
1043
fetch the latest time a deposit has been made on the spot account. If None is found, return the millistamp
935
1044
corresponding to 2017/1/1
936
1045
937
- :return:
1046
+ :return: last deposit millistamp
1047
+ :rtype: int
938
1048
"""
939
1049
table = tables .SPOT_DEPOSIT_TABLE
940
1050
selection = f"MAX({ table .insertTime } )"
@@ -971,7 +1081,7 @@ def add_trade(self, trade_type: str, trade_id: int, trade_time: int, asset: str,
971
1081
:type price: float
972
1082
:param fee: amount kept by the exchange
973
1083
:type fee: float
974
- :param fee_asset:token unit for the fee
1084
+ :param fee_asset: token unit for the fee
975
1085
:type fee_asset: str
976
1086
:param is_buyer: if the trade is a buy or a sell
977
1087
:type is_buyer: bool
@@ -1006,6 +1116,21 @@ def get_trades(self, trade_type: str, start_time: Optional[int] = None, end_time
1006
1116
:type ref_asset: Optional[str]
1007
1117
:return: The raw rows selected as saved in the database
1008
1118
:rtype: List[Tuple]
1119
+
1120
+ .. code-block:: python
1121
+
1122
+ [
1123
+ (384518832, # trade_id
1124
+ 1582892988052, # trade time
1125
+ 'BTC', # asset
1126
+ 'USDT', # ref asset
1127
+ 0.0015, # asset quantity
1128
+ 9011.2, # asset price to ref asset
1129
+ 0.01425, # fee
1130
+ 'USDT', # fee asset
1131
+ 0), # is_buyer
1132
+ ]
1133
+
1009
1134
"""
1010
1135
if trade_type == 'spot' :
1011
1136
table = tables .SPOT_TRADE_TABLE
0 commit comments