improve MM

This commit is contained in:
2022-07-17 16:40:56 +09:00
parent 28c50d053b
commit 0d2b0e425d
3 changed files with 84 additions and 42 deletions

View File

@@ -4,18 +4,12 @@ import asyncio
MAX_ITEMS = 10
class Depth:
def __init__(self):
def __init__(self, order_unit):
self.bids = []
self.asks = []
self._event = asyncio.Event()
self._event = asyncio.Event()
self._order_unit = order_unit
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