'How to transfer amounts from one wallets to another with coinbase api?
I have a coinbase account. I'd like to transfer a specific amount of crypto to another crypto.
For example, I want to transfer 0.1 bitcoin to dogecoin.
I want to use python API and I'm looking for coinbase-python.
I believe that I need to use the transfer_money
method, as I can see in the documentation:
client.transfer_money(
account_id,
to="<coinbase_account_id>",
amount="1",
currency="BTC")
# or
account.transfer_money(to="<coinbase_account_id>",
amount="1",
currency="BTC")
but I'm not able to create a real example, by looking at what should I use as <coinbase_account_id>
for example.
Someone can explain to me what's the right way to perform the operation that I want to do, transferring a specific amount of money from crypto to another one?
Thanks
Solution 1:[1]
i made a function that calls for the acccount_id by asking API key, API secret and currency:
account_id_finder()
takes three string arguments: client's API key , API secret and the currency which must be the currency of the account you're looking for.
NOTE that coinbase supports only 107 kinds of currency. Meanwhile coinbase pro supports around 250 currencies.
example of use: account_id_finder(APIKEY, APISECRET, 'BTC')
or
account_id_finder(APIKEY, APISECRET, 'DOGE')
def account_id_finder(APIKEY, APISECRET,currency):
client = Client(APIKEY, APISECRET)
liston=client.get_accounts()
for i in liston.data:
if i['currency']==currency:
idcuenta=i['id']
break
return idcuenta
Never the less i think the API has problems with transfer between accounts
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | WhooNo |