Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the issue that a warning was raised when there were no accepted bids #521

Merged
merged 3 commits into from
Dec 16, 2024
Merged
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
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 @@
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 @@
receiver_addr=agent,
)
# store order book in db agent
if not accepted_orderbook:
logger.warning(
f"{self.context.current_timestamp} Market result {market_products} for market {self.marketconfig.market_id} are empty!"
)
all_orders = accepted_orderbook + rejected_orderbook
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
Loading