我正在尝试使用 python-binance api 来交易以太坊,同时开发我一直在使用该create_test_order
功能的代码,这样我就不会花费自己的钱来运行测试。
但是,我遇到的问题是该函数似乎根本没有返回任何内容:
try:
avg_price = float(client.get_avg_price(symbol="ETHGBP")['price'])
logging.info(f"Test Buy at {avg_price}")
order = client.create_test_order(
symbol="ETHGBP",
side=SIDE_BUY,
type=ORDER_TYPE_LIMIT,
timeInForce=TIME_IN_FORCE_GTC,
quantity=100,
price="{:.2f}".format(float(avg_price)))
logging.info(order)
except Exception as e:
logging.error(f"Exception occurred: {e}", exc_info=True)
quit()
这是我得到的输出:
travis_1 | 2021-05-27 15:08:02,617 - root - INFO - Test Buy at 2003.53136248
travis_1 | 2021-05-27 15:08:02,852 - root - INFO - {}
我一直在按照本指南进行操作,并且希望退回的订单中包含某些内容,但事实并非如此:https ://algotrade101.com/learn/binance-python-api-guide/
我也很困惑它什么也没返回,但没有引发异常。
我出错的任何想法。