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

Method withdraw

python/ccxt/bitget.py:2831–2886  ·  view source on GitHub ↗

make a withdrawal https://www.bitget.com/api-doc/spot/account/Wallet-Withdrawal :param str code: unified currency code :param float amount: the amount to withdraw :param str address: the address to withdraw to :param str tag: :param dict [pa

(self, code: str, amount: float, address: str, tag: Str = None, params={})

Source from the content-addressed store, hash-verified

2829 return self.parse_transactions(rawTransactions, None, since, limit)
2830
2831 def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
2832 """
2833 make a withdrawal
2834
2835 https://www.bitget.com/api-doc/spot/account/Wallet-Withdrawal
2836
2837 :param str code: unified currency code
2838 :param float amount: the amount to withdraw
2839 :param str address: the address to withdraw to
2840 :param str tag:
2841 :param dict [params]: extra parameters specific to the exchange API endpoint
2842 :param str [params.chain]: the blockchain network the withdrawal is taking place on
2843 :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
2844 """
2845 self.check_address(address)
2846 networkCode = None
2847 networkCode, params = self.handle_network_code_and_params(params)
2848 if networkCode is None:
2849 raise ArgumentsRequired(self.id + ' withdraw() requires a "network" parameter')
2850 self.load_markets()
2851 currency = self.currency(code)
2852 networkId = self.network_code_to_id(networkCode, code)
2853 request = {
2854 'coin': currency['id'],
2855 'address': address,
2856 'chain': networkId,
2857 'size': self.currency_to_precision(code, amount, networkCode),
2858 'transferType': 'on_chain',
2859 }
2860 if tag is not None:
2861 request['tag'] = tag
2862 response = self.privateSpotPostV2SpotWalletWithdrawal(self.extend(request, params))
2863 #
2864 # {
2865 # "code":"00000",
2866 # "msg":"success",
2867 # "requestTime":1696784219602,
2868 # "data": {
2869 # "orderId":"1094957867615789056",
2870 # "clientOid":"64f1e4ce842041d296b4517df1b5c2d7"
2871 # }
2872 # }
2873 #
2874 data = self.safe_value(response, 'data', {})
2875 result = self.parse_transaction(data, currency)
2876 result['type'] = 'withdrawal'
2877 withdrawOptions = self.safe_value(self.options, 'withdraw', {})
2878 fillResponseFromRequest = self.safe_bool(withdrawOptions, 'fillResponseFromRequest', True)
2879 if fillResponseFromRequest:
2880 result['currency'] = code
2881 result['amount'] = amount
2882 result['tag'] = tag
2883 result['address'] = address
2884 result['addressTo'] = address
2885 result['network'] = networkCode
2886 return result
2887
2888 def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:

Callers

nothing calls this directly

Calls 12

parse_transactionMethod · 0.95
ArgumentsRequiredClass · 0.90
check_addressMethod · 0.80
currency_to_precisionMethod · 0.80
safe_valueMethod · 0.80
safe_boolMethod · 0.80
load_marketsMethod · 0.45
currencyMethod · 0.45
network_code_to_idMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected