Python-Coinbase Pro API-市场订单没有执行或返回



我正在使用coinbase pro API,当试图下市场订单时,它不会执行,也不会返回任何基于文档的文本。

# Modules
import env
import cbpro
# API Details
APIKey = env.APIKey 
APISecret = env.APISecret
APIPass = env.APIPass 
BTCID = env.BTCID 
client = cbpro.AuthenticatedClient(APIKey, APISecret, APIPass)
def test1():
client.buy(product_id='BTC-GBP', order_type="market",funds=5.00)
test1()
def test2():
client.place_market_order(product_id='BTC-GBP',side='buy',funds=5.00)
test2()

我尝试了两种不同的方法,但结果仍然一样。有人有这个模块的经验吗?

来源:

https://pypi.org/project/cbpro/

https://docs.pro.coinbase.com/#introduction

我认为基金应该是一个字符串,基金='5.00'。

其他注释是正确的。无论出于何种原因(可能是由于每个特殊代币/硬币中小数点的重要性(,可能是由于浮动不准确,这可能会产生问题,或者是由于在创建python包装器时的懒惰;Python中的Coinbase Pro API几乎总是将看起来像整数的内容作为字符串进行浮动。

def test1():
client.buy(product_id='BTC-GBP', order_type="market",funds='5.00')

最新更新