【发布时间】:2021-06-28 14:26:38
【问题描述】:
供参考,这是python版本的GitHub:https://github.com/danpaquin/coinbasepro-python
我的代码旨在将我的美元余额平均分配给最多 3 个帐户。下面是为我的代码创建的 LOG,证明它的值是准确的
Choosing out of random, we'll be purchasing these:
['SUSHIBUSD', 'NMRBUSD', 'FORTHBUSD']
Placing order for FORTH-USD for the amount of: 6.08
Placing order for NMR-USD for the amount of: 6.08
Placing order for SUSHI-USD for the amount of: 6.08
for b in buy:
coin = Coins.Coinbase[index[temp]]
LOG.write("Placing order for " + coin + " for the amount of: ")
LOG.write(USD)
LOG.write("\n")
Bot.place_market_order(str(coin), 'buy', USD)
temp += 1
原来USD Balance持有18.25,代码确定金额后,6.08就是USD的价值。不幸的是,在我的 Coinbase 订单历史记录中,显示使用了全部余额,剩下 0 美元余额,没有任何余额可供其他账户使用。我尝试将值保留为 $X.XX 格式的浮点数,或者将 USD 更改为字符串值,但没有显示任何差异。
问题:为什么?我错过了什么吗? LOG 显示 USD 具有正确的值,因此对函数的调用应该是
Bot.place_market_order('FORTH-USD', 'buy', '6.08')
但它使用 all 就好像它是
Bot.place_market_order('FORTH-USD', 'buy', '18.25')
or
Bot.place_market_order('FORTH-USD', 'buy', 'all')
【问题讨论】:
标签: python coinbase-api