MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_transfers

Method fetch_transfers

python/ccxt/binance.py:8731–8863  ·  view source on GitHub ↗

fetch a history of internal transfers made on an account https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer :param str code: unified currency code of the currency transferred :param int [since]: the earliest time in ms to fetch transfers

(self, code: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

8729 return self.parse_transfer(response, currency)
8730
8731 def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
8732 """
8733 fetch a history of internal transfers made on an account
8734
8735 https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer
8736
8737 :param str code: unified currency code of the currency transferred
8738 :param int [since]: the earliest time in ms to fetch transfers for
8739 :param int [limit]: the maximum number of transfers structures to retrieve
8740 :param dict [params]: extra parameters specific to the exchange API endpoint
8741 :param int [params.until]: the latest time in ms to fetch transfers for
8742 :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
8743 :param boolean [params.internal]: default False, when True will fetch pay trade history
8744 :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/?id=transfer-structure>`
8745 """
8746 self.load_markets()
8747 internal = self.safe_bool(params, 'internal')
8748 params = self.omit(params, 'internal')
8749 paginate = False
8750 paginate, params = self.handle_option_and_params(params, 'fetchTransfers', 'paginate')
8751 if paginate and not internal:
8752 return self.fetch_paginated_call_dynamic('fetchTransfers', code, since, limit, params)
8753 currency = None
8754 if code is not None:
8755 currency = self.currency(code)
8756 request = {}
8757 limitKey = 'limit'
8758 if not internal:
8759 defaultType = self.safe_string_2(self.options, 'fetchTransfers', 'defaultType', 'spot')
8760 fromAccount = self.safe_string(params, 'fromAccount', defaultType)
8761 defaultTo = 'spot' if (fromAccount == 'future') else 'future'
8762 toAccount = self.safe_string(params, 'toAccount', defaultTo)
8763 type = self.safe_string(params, 'type')
8764 accountsByType = self.safe_dict(self.options, 'accountsByType', {})
8765 fromId = self.safe_string(accountsByType, fromAccount)
8766 toId = self.safe_string(accountsByType, toAccount)
8767 if type is None:
8768 if fromId is None:
8769 keys = list(accountsByType.keys())
8770 raise ExchangeError(self.id + ' fromAccount parameter must be one of ' + ', '.join(keys))
8771 if toId is None:
8772 keys = list(accountsByType.keys())
8773 raise ExchangeError(self.id + ' toAccount parameter must be one of ' + ', '.join(keys))
8774 type = fromId + '_' + toId
8775 request['type'] = type
8776 limitKey = 'size'
8777 if limit is not None:
8778 request[limitKey] = limit
8779 if since is not None:
8780 request['startTime'] = since
8781 until = self.safe_integer(params, 'until')
8782 if until is not None:
8783 params = self.omit(params, 'until')
8784 request['endTime'] = until
8785 response = None
8786 if internal:
8787 response = self.sapiGetPayTransactions(self.extend(request, params))
8788 #

Callers

nothing calls this directly

Calls 15

sapiGetAssetTransferMethod · 0.95
ExchangeErrorClass · 0.90
safe_boolMethod · 0.80
safe_string_2Method · 0.80
safe_stringMethod · 0.80
safe_dictMethod · 0.80
safe_integerMethod · 0.80
safe_list_2Method · 0.80
parse_transfersMethod · 0.80
load_marketsMethod · 0.45

Tested by

no test coverage detected