make a withdrawal https://api-docs.grvt.io/trading_api/#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 [params]: extra
(self, code: str, amount: float, address: str, tag: Str = None, params={})
| 1833 | return True |
| 1834 | |
| 1835 | async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction: |
| 1836 | """ |
| 1837 | make a withdrawal |
| 1838 | |
| 1839 | https://api-docs.grvt.io/trading_api/#withdrawal |
| 1840 | |
| 1841 | :param str code: unified currency code |
| 1842 | :param float amount: the amount to withdraw |
| 1843 | :param str address: the address to withdraw to |
| 1844 | :param str tag: |
| 1845 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1846 | :param str params['network']: the network to withdraw on(mandatory) |
| 1847 | :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>` |
| 1848 | """ |
| 1849 | self.check_address(address) |
| 1850 | await self.load_markets_and_sign_in() |
| 1851 | defaultFromAccountId = self.safe_string(self.options, 'userMainAccountId') |
| 1852 | currency = self.currency(code) |
| 1853 | request = { |
| 1854 | 'to_eth_address': address, |
| 1855 | 'from_account_id': defaultFromAccountId, |
| 1856 | 'currency': currency['id'], |
| 1857 | 'num_tokens': self.currency_to_precision(code, amount), |
| 1858 | 'signature': self.default_signature(), |
| 1859 | } |
| 1860 | networkCode, query = self.handle_network_code_and_params(params) |
| 1861 | networkId = self.network_code_to_id(networkCode, code) |
| 1862 | if networkId is None: |
| 1863 | raise BadRequest(self.id + ' withdraw() requires a network parameter') |
| 1864 | request['signature']['chain_id'] = networkId |
| 1865 | request = self.create_signed_request(request, 'EIP712_WITHDRAWAL_TYPE', currency) |
| 1866 | response = await self.privateTradingPostFullV1Withdrawal(self.extend(request, query)) |
| 1867 | # |
| 1868 | # { |
| 1869 | # "result": { |
| 1870 | # "ack": "true" |
| 1871 | # } |
| 1872 | # } |
| 1873 | # |
| 1874 | result = self.safe_dict(response, 'result', {}) |
| 1875 | return self.parse_transaction(result, currency) |
| 1876 | |
| 1877 | async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}): |
| 1878 | """ |
nothing calls this directly
no test coverage detected