Coinbase APIerror(id = ) in python

2024/10/18 13:10:24

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=):

Answer

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.

https://en.xdnf.cn/q/72622.html

Related Q&A

cxfreeze missing distutils module inside virtualenv

When running a cxfreeze binary from a python3.2 project I am getting the following runtime error:/project/dist/project/distutils/__init__.py:13: UserWarning: The virtualenv distutils package at %s appe…

Preventing a multiplication expression evaluating in Sympy

I am generating an expression with two fractions, and want to pretty print as a whole expression with LaTeX, to then put on a worksheet.E.g. in the form:(5/7) * (3/4). However, when I do the following:…

Calling PARI/GP from Python

I would like to call PARI/GP from Python only to calculate the function nextprime(n) for different ns that I define. Unfortunately I cant get pari-python to install so I thought I would just call it us…

Can anyone explain why this sorting wont work?

For example if I have a list like this:List1 =[7,6,9] List1 = List1.sort()

Using argparse for mandatory argument without prefix

Im trying to use argparse module within my python application. My application should be run with single mandatory argument without any prefixes. I could not come up with a way to do it.

prevent unexpected stdin reads and lock in subprocess

A simple case Im trying to solve for all situations. I am running a subprocess for performing a certain task, and I dont expect it to ask for stdin, but in rare cases that I might not even expect, it m…

Regex split string by last occurrence of pattern

I am using regex to split a string <book name> by <author name> into book and author names.re.split(r\bby\b, text, 0, re.I)But problem arises when the book name contains the word "by&q…

How to write a unit-test where each test case has different input but does the same?

I need to create a unit-test for some python class. I have a database of inputs and expected results which should be generated by the UUT for those inputs.Here is the pseudo-code of what I want to do:f…

Unable to pass authentication information to NetSuites REST interface using Python

Ive been trying to get a NetSuite Restlet to work with Python 3.3 using urllib, but I cant seem to get the authorization to take and continually return a urllib.error.HTTPError: HTTP Error 401: Authori…

letsencrypt failed with ImportError: No module named interface

Im using Amazon linux, and I followed some steps for using letsencrypt that easily found in google search, but all it fails with:Error: couldnt get currently installed version for /root/.local/share/le…