Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cryptofeed/backends/quest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ def __init__(self, *args, depth=10, **kwargs):
self.depth = depth

async def __call__(self, book, receipt_timestamp: float):
vals = ','.join([f"bid_{i}_price={book.book.bids.index(i)[0]},bid_{i}_size={book.book.bids.index(i)[1]}" for i in range(self.depth)] + [f"ask_{i}_price={book.book.asks.index(i)[0]},ask_{i}_size={book.book.asks.index(i)[1]}" for i in range(self.depth)])
bid_depth = min(self.depth, len(book.book.bids))
ask_depth = min(self.depth, len(book.book.asks))
bid_vals = [f"bid_{i}_price={book.book.bids.index(i)[0]},bid_{i}_size={book.book.bids.index(i)[1]}" for i in range(bid_depth)]
ask_vals = [f"ask_{i}_price={book.book.asks.index(i)[0]},ask_{i}_size={book.book.asks.index(i)[1]}" for i in range(ask_depth)]
vals = ','.join(bid_vals + ask_vals)
timestamp = book.timestamp
receipt_timestamp_int = int(receipt_timestamp * 1_000_000)
timestamp_int = int(timestamp * 1_000_000_000) if timestamp is not None else receipt_timestamp_int * 1000
Expand Down