Skip to content

Commit 60742b0

Browse files
committed
Update delivery time filter check for gridpool streams
Uses the new `is_valid` check that now comes with the delivery time filter. This also drops the check that delivery start time of the filter has to be in the future, which is not desired for the gridpool data streaming endpoints. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
1 parent b25e554 commit 60742b0

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/frequenz/client/electricity_trading/_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,10 @@ def gridpool_orders_stream(
300300
301301
Raises:
302302
grpc.RpcError: If an error occurs while streaming the orders.
303+
ValueError: If an invalid delivery_time_filter is provided.
303304
"""
304-
self.validate_params(delivery_time_filter=delivery_time_filter)
305+
if delivery_time_filter and not delivery_time_filter.is_valid:
306+
raise ValueError("Invalid delivery_time_filter provided.")
305307

306308
gridpool_order_filter = GridpoolOrderFilter(
307309
order_states=order_states,
@@ -366,8 +368,10 @@ def gridpool_trades_stream(
366368
367369
Raises:
368370
grpc.RpcError: If an error occurs while streaming gridpool trades.
371+
ValueError: If an invalid delivery_time_filter is provided.
369372
"""
370-
self.validate_params(delivery_time_filter=delivery_time_filter)
373+
if delivery_time_filter and not delivery_time_filter.is_valid:
374+
raise ValueError("Invalid delivery_time_filter provided.")
371375

372376
gridpool_trade_filter = GridpoolTradeFilter(
373377
trade_states=trade_states,

0 commit comments

Comments
 (0)