make a deposit https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/deposit-fiat :param str code: unified currency code :param float amount: the amount to deposit :param str id: the payment method id to be used for the deposit, can be retrieved from v2P
(self, code: str, amount: float, id: str, params={})
| 4176 | } |
| 4177 | |
| 4178 | def deposit(self, code: str, amount: float, id: str, params={}): |
| 4179 | """ |
| 4180 | make a deposit |
| 4181 | |
| 4182 | https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/deposit-fiat |
| 4183 | |
| 4184 | :param str code: unified currency code |
| 4185 | :param float amount: the amount to deposit |
| 4186 | :param str id: the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods |
| 4187 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 4188 | :param str [params.accountId]: the id of the account to deposit into |
| 4189 | :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>` |
| 4190 | """ |
| 4191 | self.load_markets() |
| 4192 | accountId = self.safe_string_2(params, 'account_id', 'accountId') |
| 4193 | params = self.omit(params, ['account_id', 'accountId']) |
| 4194 | if accountId is None: |
| 4195 | if code is None: |
| 4196 | raise ArgumentsRequired(self.id + ' deposit() requires an account_id(or accountId) parameter OR a currency code argument') |
| 4197 | accountId = self.find_account_id(code, params) |
| 4198 | if accountId is None: |
| 4199 | raise ExchangeError(self.id + ' deposit() could not find account id for ' + code) |
| 4200 | request = { |
| 4201 | 'account_id': accountId, |
| 4202 | 'amount': self.number_to_string(amount), |
| 4203 | 'currency': code.upper(), # need to use code in case depositing USD etc. |
| 4204 | 'payment_method': id, |
| 4205 | 'commit': True, # otheriwse the deposit does not go through |
| 4206 | } |
| 4207 | response = self.v2PrivatePostAccountsAccountIdDeposits(self.extend(request, params)) |
| 4208 | # |
| 4209 | # { |
| 4210 | # "data": { |
| 4211 | # "id": "67e0eaec-07d7-54c4-a72c-2e92826897df", |
| 4212 | # "status": "created", |
| 4213 | # "payment_method": { |
| 4214 | # "id": "83562370-3e5c-51db-87da-752af5ab9559", |
| 4215 | # "resource": "payment_method", |
| 4216 | # "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559" |
| 4217 | # }, |
| 4218 | # "transaction": { |
| 4219 | # "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a", |
| 4220 | # "resource": "transaction", |
| 4221 | # "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a" |
| 4222 | # }, |
| 4223 | # "amount": { |
| 4224 | # "amount": "10.00", |
| 4225 | # "currency": "USD" |
| 4226 | # }, |
| 4227 | # "subtotal": { |
| 4228 | # "amount": "10.00", |
| 4229 | # "currency": "USD" |
| 4230 | # }, |
| 4231 | # "created_at": "2015-01-31T20:49:02Z", |
| 4232 | # "updated_at": "2015-02-11T16:54:02-08:00", |
| 4233 | # "resource": "deposit", |
| 4234 | # "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df", |
| 4235 | # "committed": True, |
nothing calls this directly
no test coverage detected