Skip to content

Commit

Permalink
move the warning and check before clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-harder committed Dec 11, 2024
1 parent 6a3c1cc commit 45f9773
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions assume/markets/base_market.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,12 @@ async def clear_market(self, market_products: list[MarketProduct]):
Args:
market_products (list[MarketProduct]): The products to be traded.
"""
if not self.all_orders:
logger.warning(

Check warning on line 614 in assume/markets/base_market.py

View check run for this annotation

Codecov / codecov/patch

assume/markets/base_market.py#L614

Added line #L614 was not covered by tests
f"[{self.context.current_timestamp}] The order book for market {self.marketconfig.market_id} with products {market_products} is empty. No orders were found."
)
return

Check warning on line 617 in assume/markets/base_market.py

View check run for this annotation

Codecov / codecov/patch

assume/markets/base_market.py#L617

Added line #L617 was not covered by tests

try:
(accepted_orderbook, rejected_orderbook, market_meta, flows) = self.clear(
self.all_orders, market_products
Expand Down Expand Up @@ -670,12 +676,7 @@ async def clear_market(self, market_products: list[MarketProduct]):
receiver_addr=agent,
)
# store order book in db agent
all_orders = accepted_orderbook + rejected_orderbook
if not all_orders:
logger.warning(
f"[{self.context.current_timestamp}] The combined order book for market {self.marketconfig.market_id} with products {market_products} is empty. No accepted or rejected orders were found."
)
await self.store_order_book(all_orders)
await self.store_order_book(accepted_orderbook + rejected_orderbook)

for meta in market_meta:
logger.debug(
Expand Down

0 comments on commit 45f9773

Please sign in to comment.