python-bittrex 缺少位置参数

python-bittrex missing positional arguments

我正在尝试通过 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 中等着我。

查看来自 ericsomdahl/python-bittrex

的源代码

对于 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))