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

Method fetch_withdrawals

python/ccxt/binance.py:8227–8348  ·  view source on GitHub ↗

fetch all withdrawals made from an account https://developers.binance.com/docs/wallet/capital/withdraw-history https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History :param str code: unified currency code :param int [since]: the

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

Source from the content-addressed store, hash-verified

8225 return self.parse_transactions(response, currency, since, limit)
8226
8227 def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
8228 """
8229 fetch all withdrawals made from an account
8230
8231 https://developers.binance.com/docs/wallet/capital/withdraw-history
8232 https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History
8233
8234 :param str code: unified currency code
8235 :param int [since]: the earliest time in ms to fetch withdrawals for
8236 :param int [limit]: the maximum number of withdrawals structures to retrieve
8237 :param dict [params]: extra parameters specific to the exchange API endpoint
8238 :param bool [params.fiat]: if True, only fiat withdrawals will be returned
8239 :param int [params.until]: the latest time in ms to fetch withdrawals for
8240 :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)
8241 :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/?id=transaction-structure>`
8242 """
8243 self.load_markets()
8244 paginate = False
8245 paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')
8246 if paginate:
8247 return self.fetch_paginated_call_dynamic('fetchWithdrawals', code, since, limit, params)
8248 legalMoney = self.safe_dict(self.options, 'legalMoney', {})
8249 fiatOnly = self.safe_bool(params, 'fiat', False)
8250 params = self.omit(params, 'fiatOnly')
8251 request = {}
8252 until = self.safe_integer(params, 'until')
8253 if until is not None:
8254 params = self.omit(params, 'until')
8255 request['endTime'] = until
8256 response = None
8257 currency = None
8258 if fiatOnly or (code in legalMoney):
8259 if code is not None:
8260 currency = self.currency(code)
8261 request['transactionType'] = 1
8262 if since is not None:
8263 request['beginTime'] = since
8264 raw = self.sapiGetFiatOrders(self.extend(request, params))
8265 response = self.safe_list(raw, 'data', [])
8266 # {
8267 # "code": "000000",
8268 # "message": "success",
8269 # "data": [
8270 # {
8271 # "orderNo": "CJW706452266115170304",
8272 # "fiatCurrency": "GBP",
8273 # "indicatedAmount": "10001.50",
8274 # "amount": "100.00",
8275 # "totalFee": "1.50",
8276 # "method": "bank transfer",
8277 # "status": "Successful",
8278 # "createTime": 1620037745000,
8279 # "updateTime": 1620038480000
8280 # },
8281 # {
8282 # "orderNo": "CJW706287492781891584",
8283 # "fiatCurrency": "GBP",
8284 # "indicatedAmount": "10001.50",

Callers

nothing calls this directly

Calls 15

sapiGetFiatOrdersMethod · 0.95
safe_dictMethod · 0.80
safe_boolMethod · 0.80
safe_integerMethod · 0.80
safe_listMethod · 0.80
parse_transactionsMethod · 0.80
rangeFunction · 0.50
load_marketsMethod · 0.45
omitMethod · 0.45

Tested by

no test coverage detected