transfer currency internally between wallets on the same account https://bybit-exchange.github.io/docs/v5/asset/create-inter-transfer :param str code: unified currency code :param float amount: amount to transfer :param str fromAccount: account to transfer
(self, code: str, amount: float, fromAccount: str, toAccount: str, params={})
| 7147 | } |
| 7148 | |
| 7149 | def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry: |
| 7150 | """ |
| 7151 | transfer currency internally between wallets on the same account |
| 7152 | |
| 7153 | https://bybit-exchange.github.io/docs/v5/asset/create-inter-transfer |
| 7154 | |
| 7155 | :param str code: unified currency code |
| 7156 | :param float amount: amount to transfer |
| 7157 | :param str fromAccount: account to transfer from |
| 7158 | :param str toAccount: account to transfer to |
| 7159 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 7160 | :param str [params.transferId]: UUID, which is unique across the platform |
| 7161 | :returns dict: a `transfer structure <https://docs.ccxt.com/?id=transfer-structure>` |
| 7162 | """ |
| 7163 | self.load_markets() |
| 7164 | transferId = self.safe_string(params, 'transferId', self.uuid()) |
| 7165 | accountTypes = self.safe_dict(self.options, 'accountsByType', {}) |
| 7166 | fromId = self.safe_string(accountTypes, fromAccount, fromAccount) |
| 7167 | toId = self.safe_string(accountTypes, toAccount, toAccount) |
| 7168 | currency = self.currency(code) |
| 7169 | amountToPrecision = self.currency_to_precision(code, amount) |
| 7170 | request = { |
| 7171 | 'transferId': transferId, |
| 7172 | 'fromAccountType': fromId, |
| 7173 | 'toAccountType': toId, |
| 7174 | 'coin': currency['id'], |
| 7175 | 'amount': amountToPrecision, |
| 7176 | } |
| 7177 | response = self.privatePostV5AssetTransferInterTransfer(self.extend(request, params)) |
| 7178 | # |
| 7179 | # { |
| 7180 | # "retCode": 0, |
| 7181 | # "retMsg": "success", |
| 7182 | # "result": { |
| 7183 | # "transferId": "4244af44-f3b0-4cf6-a743-b56560e987bc" |
| 7184 | # }, |
| 7185 | # "retExtInfo": {}, |
| 7186 | # "time": 1666875857205 |
| 7187 | # } |
| 7188 | # |
| 7189 | timestamp = self.safe_integer(response, 'time') |
| 7190 | transfer = self.safe_dict(response, 'result', {}) |
| 7191 | statusRaw = self.safe_string_n(response, ['retCode', 'retMsg']) |
| 7192 | status = self.parse_transfer_status(statusRaw) |
| 7193 | return self.extend(self.parse_transfer(transfer, currency), { |
| 7194 | 'timestamp': timestamp, |
| 7195 | 'datetime': self.iso8601(timestamp), |
| 7196 | 'amount': self.parse_number(amountToPrecision), |
| 7197 | 'fromAccount': fromAccount, |
| 7198 | 'toAccount': toAccount, |
| 7199 | 'status': status, |
| 7200 | }) |
| 7201 | |
| 7202 | def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]: |
| 7203 | """ |
nothing calls this directly
no test coverage detected