一个python脚本在运行,现在没有了。在
public_client = bitstamp.client.Public()
data=backTestBitCoin.getHistoricalPrices();
trading_client = bitstamp.client.Trading(username='AAA', key='BBB', secret='CCC')
tick=trading_client.ticker();
lastBid = float(tick['bid']);
lastAsk = float(tick['ask']);
balances = trading_client.account_balance(); #error thrown from this line
我得到以下错误:
^{pr2}$有人经历过吗?对图书馆不太熟悉,所以不知道是什么原因造成的。在
生成新的api密钥/密钥解决了此问题。我相信这是由于混合使用了php api和python api或iphone Bitstamp应用程序造成的。我将证实这一怀疑,但总体解决方案是拔下插头,然后再插上。在
简化的解决方案:我的问题来自于使用以下php和python库
phppython
两者都是A+的伟大和易于使用。在
错误的产生是因为他们在创建nonce的方法上存在以下差异(在我看来,两者都不是“正确的”,只是不同而已)。在
php:
python:
^{pr2}$其中
time.time()
给出:1403366728.072785 并且microtime()
给你:1403366859731819。在我提出的解决方案是将python代码更改为:
self._nonce = max(int(time.time()*1000000), nonce)
并解决错误。在相关问题 更多 >
编程相关推荐