* @method * @name cex#transfer * @description transfer currency internally between wallets on the same account * @see https://trade.cex.io/docs/#rest-private-api-calls-internal-transfer * @param {string} code unified currency code * @param {float} amount amount to transfer
(code, amount, fromAccount, toAccount, params = {})
| 1567 | * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure} |
| 1568 | */ |
| 1569 | async transfer(code, amount, fromAccount, toAccount, params = {}) { |
| 1570 | let transfer = undefined; |
| 1571 | if (toAccount !== '' && fromAccount !== '') { |
| 1572 | transfer = await this.transferBetweenSubAccounts(code, amount, fromAccount, toAccount, params); |
| 1573 | } |
| 1574 | else { |
| 1575 | transfer = await this.transferBetweenMainAndSubAccount(code, amount, fromAccount, toAccount, params); |
| 1576 | } |
| 1577 | const fillResponseFromRequest = this.handleOption('transfer', 'fillResponseFromRequest', true); |
| 1578 | if (fillResponseFromRequest) { |
| 1579 | transfer['fromAccount'] = fromAccount; |
| 1580 | transfer['toAccount'] = toAccount; |
| 1581 | } |
| 1582 | return transfer; |
| 1583 | } |
| 1584 | async transferBetweenMainAndSubAccount(code, amount, fromAccount, toAccount, params = {}) { |
| 1585 | await this.loadMarkets(); |
| 1586 | const currency = this.currency(code); |
nothing calls this directly
no test coverage detected