我试图通过bittrex api购买限购,我收到的错误是我的论点在错误的位置。
from bittrex.bittrex import API_V2_0, Bittrex
import json
my_bittrex = Bittrex("zzzzz", "zzzzz", api_version=API_V2_0)
trade = 'BTC'
currency = 'TRX'
market = '{0}-{1}'.format(trade, currency)
b = (my_bittrex.buy_limit({market, 100, float(0.00005550)}))
错误:
Traceback (most recent call last):
File "bittrex/apitest.py", line 17, in <module>
b = (my_bittrex.buy_limit({market, 100, float(0.00005550)}))
TypeError: buy_limit() missing 2 required positional arguments: 'quantity' and 'rate'
如何正确定位bittrex的参数?
更新: 我试过了
b = (my_bittrex.trade_buy({market, 100, float(0.00005550)}))
和
b = my_bittrex.trade_buy(market=market, quantity=100, rate=float(0.00005550))
和
params = {'market': market, 'quantity': 100, 'rate': float(0.00005550)}
#b = my_bittrex.trade_buy(**params)
print (b)
会话错误输出:
{'result': None, 'success': False, 'message': 'There was a problem processing your request. If this problem persists, please email support@bittrex.com with this error id - 4feb00b8-fbe9-4dd3-b11f-95fd7bf5250f'}
root@raspberrypi3:/var/www/html/jango# nano -c bittrex/apitest.py
root@raspberrypi3:/var/www/html/jango# python3 bittrex/apitest.py
{'message': 'There was a problem processing your request. If this problem persists, please email support@bittrex.com with this error id - e0396c8d-8a4c-41c5-b6c4-6842c31386e2', 'success': False, 'result': None}
root@raspberrypi3:/var/www/html/jango# nano -c bittrex/apitest.py
root@raspberrypi3:/var/www/html/jango# python3 bittrex/apitest.py
{'success': False, 'result': None, 'message': 'NO_API_RESPONSE'}
root@raspberrypi3:/var/www/html/jango# python3 bittrex/apitest.py
{'message': 'NO_API_RESPONSE', 'success': False, 'result': None}
root@raspberrypi3:/var/www/html/jango# nano -c bittrex/apitest.py
最终更新: 我在这里感到困惑
:param time_in_effect: TIMEINEFFECT_GOOD_TIL_CANCELLED = 'GOOD_TIL_CANCELLED',
TIMEINEFFECT_IMMEDIATE_OR_CANCEL = 'IMMEDIATE_OR_CANCEL', or TIMEINEFFECT_FILL_OR_KILL = 'FILL_OR_KILL'
这 https://github.com/ericsomdahl/python-bittrex/blob/master/bittrex/bittrex.py#L740
具有正确的函数调用。
最后:
b= my_bittrex.trade_buy(market='BTC-TRX', order_type='LIMIT', quantity=100, rate=float(0.00000555), time_in_effect='GOOD_TIL_CANCELLED',condition_type='None', target=float(0.0))
我的限制令只是在等待我的gui中停留。
答案 0 :(得分:0)
对于buy_limit函数,它看起来像是错误地将值传递给函数。你不应该传递字典,而应该看起来像这样:
b = my_bittrex.buy_limit(market=market, quantity=100, rate=float(0.00005550))
或者这个
params = {'market': market, 'quantity': 100, 'rate': float(0.00005550)}
b = my_bittrex.buy_limit(**params)
对于trade_buy方法,您可以以类似的方式传递参数:
b = my_bittrex.trade_buy(
market=market,
quantity=100,
rate=float(0.00005550))