6

I want to transfer money between my coinbase accounts. I'm storing all of my accounts' IDs from client.get_accounts()['data']['id'] and transferring with the code,

tx = client.transfer_money('2bbf394c-193b-5b2a-9155-3b4732659ede',
                       to='58542935-67b5-56e1-a3f9-42686e07fa40',
                       amount='1', currency= 'BTC)

But, I get this error. coinbase.wallet.error.APIError: APIError(id=):

ZeroPanda
  • 133
  • 1
  • 9

1 Answers1

0

I struggled with the same problem. It seems to be on their side and not limited to the python client. The only way I managed to transfer from wallet to wallet is by using the undocumented and unimplemented API "trades" that is used by the website. First your have to find the base_id of both your currencies, then your can do:

r = client._post('v2', "trades", data={
    "amount":"1",
    "amount_asset":"BTC",
    "amount_from":"input",
    "source_asset":"<BASE_ID_OF_SOUCE>",
    "target_asset":"<BASE_ID_OF_TARGET"
    }
)
result = r.json()
trade_id = result['data']['id']
client._post("v2", "trades", trade_id, "commit")

It's not the cleanest code since it's accessing a protected method and I'm not entirely sure that coinbase is OK with it (There might be a reason it's not documented...) but it does the job.

ewandor
  • 16
  • 1