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

Method withdraw

python/ccxt/async_support/bybit.py:6151–6201  ·  view source on GitHub ↗

make a withdrawal https://bybit-exchange.github.io/docs/v5/asset/withdraw :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 [params]:

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

Source from the content-addressed store, hash-verified

6149 return self.safe_string(types, type, type)
6150
6151 async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
6152 """
6153 make a withdrawal
6154
6155 https://bybit-exchange.github.io/docs/v5/asset/withdraw
6156
6157 :param str code: unified currency code
6158 :param float amount: the amount to withdraw
6159 :param str address: the address to withdraw to
6160 :param str tag:
6161 :param dict [params]: extra parameters specific to the exchange API endpoint
6162 :param str [params.accountType]: 'UTA', 'FUND', 'FUND,UTA', and 'SPOT(for classic accounts only)
6163 :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
6164 """
6165 tag, params = self.handle_withdraw_tag_and_params(tag, params)
6166 accountType = None
6167 accounts = await self.is_unified_enabled()
6168 isUta = accounts[1]
6169 accountType, params = self.handle_option_and_params(params, 'withdraw', 'accountType')
6170 if accountType is None:
6171 accountType = 'UTA' if isUta else 'SPOT'
6172 await self.load_markets()
6173 self.check_address(address)
6174 currency = self.currency(code)
6175 request = {
6176 'coin': currency['id'],
6177 'amount': self.number_to_string(amount),
6178 'address': address,
6179 'timestamp': self.milliseconds(),
6180 'accountType': accountType,
6181 }
6182 if tag is not None:
6183 request['tag'] = tag
6184 networkCode, query = self.handle_network_code_and_params(params)
6185 networkId = self.network_code_to_id(networkCode, code)
6186 if networkId is not None:
6187 request['chain'] = networkId.upper()
6188 response = await self.privatePostV5AssetWithdrawCreate(self.extend(request, query))
6189 #
6190 # {
6191 # "retCode": "0",
6192 # "retMsg": "success",
6193 # "result": {
6194 # "id": "9377266"
6195 # },
6196 # "retExtInfo": {},
6197 # "time": "1666892894902"
6198 # }
6199 #
6200 result = self.safe_dict(response, 'result', {})
6201 return self.parse_transaction(result, currency)
6202
6203 async def fetch_position(self, symbol: str, params={}) -> Position:
6204 """

Callers

nothing calls this directly

Calls 13

is_unified_enabledMethod · 0.95
parse_transactionMethod · 0.95
check_addressMethod · 0.80
safe_dictMethod · 0.80
load_marketsMethod · 0.45
currencyMethod · 0.45
millisecondsMethod · 0.45
network_code_to_idMethod · 0.45

Tested by

no test coverage detected