使用Coinbase API从一种加密货币转换为另一种加密货币 [英] Convert from one crypto to another using Coinbase API

查看:130
本文介绍了使用Coinbase API从一种加密货币转换为另一种加密货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个将ETH转换为BTC的python程序.我正在使用命令:

  client.transfer_money("ETH帐户ID",至="BTC帐户ID",金额="0.1",货币=:"ETH") 

我已经使用以下命令获取了帐户ID:

  client.get_accounts() 

然后将ID粘贴复制到我的传输命令上.但是我得到这个错误:

 <代码>〜/opt/anaconda3/envs/Coinbase/lib/python3.8/site-packages/coinbase/wallet/client.py在transfer_money中(self,account_id,** params)338个params ['type'] ='transfer'339响应= self._post('v2','accounts',account_id,'transactions',data = params)->340 return self._make_api_object(响应,交易)341342 def request_money(self,account_id,** params):_make_api_object中的〜/opt/anaconda3/envs/Coinbase/lib/python3.8/site-packages/coinbase/wallet/client.py(自身,响应,模型类型)143#所有有效的响应具有数据".钥匙.144如果数据为None:->145提高build_api_error(response,blob)146#警告用户有关返回的每个警告.147 warnings_data = blob.get('warnings',None)APIError:APIError(id =): 

有人可以找出这个错误是什么吗?

解决方案

不推荐使用官方库.

最近引入了三个错误(由于已弃用,未处理),我已经在此 GitHub存储库 上提交问题>

I was trying to create a python program to convert ETH to BTC. I was using the command :

client.transfer_money("ETH Account ID ", to="BTC Account ID", amount="0.1", currency=:"ETH")

I had obtained the account IDs using the command :

client.get_accounts()

And copy pasted the IDs onto my transfer command. However i get this error :

~/opt/anaconda3/envs/Coinbase/lib/python3.8/site-packages/coinbase/wallet/client.py in transfer_money(self, account_id, **params)
    338     params['type'] = 'transfer'
    339     response = self._post('v2', 'accounts', account_id, 'transactions', data=params)
--> 340     return self._make_api_object(response, Transaction)
    341 
    342   def request_money(self, account_id, **params):

~/opt/anaconda3/envs/Coinbase/lib/python3.8/site-packages/coinbase/wallet/client.py in _make_api_object(self, response, model_type)
    143     # All valid responses have a "data" key.
    144     if data is None:
--> 145       raise build_api_error(response, blob)
    146     # Warn the user about each warning that was returned.
    147     warnings_data = blob.get('warnings', None)

APIError: APIError(id=): 

Would someone be able to isolate what this error is ?

解决方案

The official library is deprecated.

There were three errors introduced recently (which werenot handled since it's deprecated), I have handled those error in this fork library and published in pypi. You can try using that, if issues still persists, submit an issue on GitHub repo

这篇关于使用Coinbase API从一种加密货币转换为另一种加密货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆