tmm/util/depth.py
2022-07-17 02:43:05 +09:00

22 lines
363 B
Python

import asyncio
MAX_ITEMS = 10
class Depth:
def __init__(self):
self.bids = []
self.asks = []
self._event = asyncio.Event()
async def wait(self):
await self._event.wait()
def askVolumeUntil(self, price):
ret = 0
for i in range(len(self.asks)):
if self.asks[i][0] > price: break
ret += self.asks[i][1]
return ret