def __init__(self, name): self.book = None self.name = name self.L2 = {L2_BOOK: BookCallback(self.handle_book), BOOK_DELTA: BookUpdateCallback(self.handle_l2_delta)} self.L3 = {L3_BOOK: BookCallback(self.handle_book), BOOK_DELTA: BookUpdateCallback(self.handle_l3_delta)}
def main(): f = FeedHandler() f.add_feed( Bitmex(pairs=['XBTUSD'], channels=[L2_BOOK], callbacks={ L2_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta) })) f.run()
def __init__(self, name, host='127.0.0.1', port=6000, **kwargs): self.book = None self.name = name self.L2 = { L2_BOOK: BookCallback(self.handle_book), BOOK_DELTA: BookUpdateCallback(self.handle_l2_delta) } url = "tcp://{}:{}".format(host, port) ctx = zmq.asyncio.Context.instance() self.con = ctx.socket(zmq.PUB) self.con.bind(url)
def main(): f = FeedHandler() # due to the way the test verification works, you can only run one or the other for this test #f.add_feed(Bitmex(pairs=['XBTUSD'], channels=[L2_BOOK], callbacks={L2_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta)})) f.add_feed( GDAX(pairs=['BTC-USD'], channels=[L3_BOOK], callbacks={ L3_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta) })) f.run()
def main(): f = FeedHandler() # due to the way the test verification works, you can only run one for the test # f.add_feed(Bitmex(pairs=['XBTUSD'], channels=[L3_BOOK], callbacks={L3_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(l3_delta)})) # f.add_feed(Bitfinex(pairs=['BTC-USD'], channels=[L3_BOOK], callbacks={L3_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(l3_delta)})) # f.add_feed(Bitfinex(pairs=['BTC-USD'], channels=[L2_BOOK], callbacks={L2_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta)})) # f.add_feed(Coinbase(pairs=['BTC-USD'], channels=[L3_BOOK], callbacks={L3_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(l3_delta)})) # f.add_feed(Coinbase(pairs=['BTC-USD'], channels=[L2_BOOK], callbacks={L2_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta)})) # f.add_feed(Gemini(book_interval=100, pairs=['BTC-USD'], callbacks={L2_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta)})) # f.add_feed(HitBTC(book_interval=100, pairs=['BTC-USD'], channels=[L2_BOOK], callbacks={L2_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta)})) f.add_feed( Poloniex(book_interval=100, channels=['USDT-BTC'], callbacks={ L2_BOOK: BookCallback(book), BOOK_DELTA: BookUpdateCallback(delta) })) f.run()