-
-
Notifications
You must be signed in to change notification settings - Fork 663
/
demo_nbbo.py
22 lines (15 loc) · 759 Bytes
/
demo_nbbo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'''
Copyright (C) 2017-2024 Bryant Moscon - [email protected]
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
from cryptofeed import FeedHandler
from cryptofeed.exchanges import Coinbase, Gemini, Kraken
def nbbo_update(symbol, bid, bid_size, ask, ask_size, bid_feed, ask_feed):
print(f'Pair: {symbol} Best Bid Price: {bid:.2f} Best Bid Size: {bid_size:.6f} Best Bid Exchange: {bid_feed}\nBest Ask Price: {ask:.2f} Best Ask Size: {ask_size:.6f} Best Ask Feed: {ask_feed}\n')
def main():
f = FeedHandler(config={'log': {'filename': 'demo.log', 'level': 'DEBUG', 'disabled': False}})
f.add_nbbo([Coinbase, Kraken, Gemini], ['BTC-USD'], nbbo_update)
f.run()
if __name__ == '__main__':
main()