我正在使用 Bittrex 的 websockets API。
我可以轻松获取市场摘要。
此外,调用集线器方法“SubscribeToExchangeDeltas”,获取请求的交换增量。
但是,当我尝试调用集线器方法“QueryExchangeState”来获取某个市场的订单历史记录时,没有任何反应,我什至没有收到错误,因此该方法显然已被调用。
有谁对此了解更多,有这方面的经验,或者让它发挥作用吗?请告诉我!
下面的代码是我正在使用的。 它为我提供了“ETC-MEME”的摘要更新和交换增量。
但是如何获取特定市场的订单历史记录(本例中为“ETC-MEME”)?
import pprint
from requests import Session # pip install requests
from signalr import Connection # pip install signalr-client
def handle_received(*args, **kwargs):
print('\nreceived')
print('\nargs:')
pprint.pprint(args)
print('\nkwargs:')
pprint.pprint(kwargs)
def print_error(error):
print('error: ', error)
def main():
with Session() as session:
connection = Connection("https://www.bittrex.com/signalR/", session)
chat = connection.register_hub('corehub')
connection.start()
# Handle any pushed data from the socket
connection.received += handle_received
connection.error += print_error
for market in ["BTC-MEME"]:
chat.server.invoke('SubscribeToExchangeDeltas', market)
chat.server.invoke('QueryExchangeState', market)
pass
while True:
connection.wait(1)
if __name__ == "__main__":
main()
最佳答案
事实证明,调用QueryExchangeState没有效果,而调用SubscribeToExchangeDeltas确实将增量添加到流中。
(最近的)订单历史记录目前只能通过调用公共(public) API 上的 getmarkethistory 来获取:https://bittrex.com/home/api
关于python-3.x - Bittrex 网络套接字 API : how to get the order history?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47110415/