File tree Expand file tree Collapse file tree 4 files changed +16
-11
lines changed
src/frequenz/client/electricity_trading Expand file tree Collapse file tree 4 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 1010
1111## New Features
1212
13- <!-- Here goes the main new features and examples or instructions on how to use them -->
13+ - Update to API v0.7.0
1414
1515## Bug Fixes
1616
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ dependencies = [
4545 " frequenz-channels >= 1.6.1, < 2" ,
4646 " frequenz-client-base >= 0.9.0, < 0.10.0" ,
4747 " frequenz-client-common >= 0.1.0, < 0.4.0" ,
48- " frequenz-api-electricity-trading >= 0.6.1 , < 0.7 .0" ,
48+ " frequenz-api-electricity-trading >= 0.7.0 , < 0.8 .0" ,
4949 " protobuf >= 5.29.2, < 7" ,
5050]
5151dynamic = [" version" ]
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ def __init__(
232232 PublicOrderBookFilter ,
233233 GrpcStreamBroadcaster [
234234 electricity_trading_pb2 .ReceivePublicOrderBookStreamResponse ,
235- PublicOrder ,
235+ list [ PublicOrder ] ,
236236 ],
237237 ] = {}
238238
@@ -1012,7 +1012,7 @@ def receive_public_order_book(
10121012 start_time : datetime | None = None ,
10131013 end_time : datetime | None = None ,
10141014 ) -> GrpcStreamBroadcaster [
1015- electricity_trading_pb2 .ReceivePublicOrderBookStreamResponse , PublicOrder
1015+ electricity_trading_pb2 .ReceivePublicOrderBookStreamResponse , list [ PublicOrder ]
10161016 ]:
10171017 """
10181018 Stream public orders with optional filters and time range.
@@ -1055,9 +1055,10 @@ def receive_public_order_book(
10551055 ),
10561056 metadata = self ._metadata ,
10571057 ),
1058- lambda response : PublicOrder .from_pb (
1059- response .public_order_book_record
1060- ),
1058+ lambda response : [
1059+ PublicOrder .from_pb (public_order )
1060+ for public_order in response .public_order_book_records
1061+ ],
10611062 )
10621063 )
10631064 except grpc .RpcError as e :
Original file line number Diff line number Diff line change 3030
3131
3232def from_pb (
33- func : Callable [Concatenate [type [T ], P ], T ]
33+ func : Callable [Concatenate [type [T ], P ], T ],
3434) -> Callable [Concatenate [type [T ], P ], T ]:
3535 """Standardize from_pb methods like error handling with this decorator.
3636
@@ -1968,7 +1968,7 @@ class PublicOrder: # pylint: disable=too-many-instance-attributes
19681968 quantity : Power
19691969 """The quantity of the contract being traded."""
19701970
1971- execution_option : OrderExecutionOption
1971+ execution_option : OrderExecutionOption | None
19721972 """Order execution options such as All or None, Fill or Kill, etc."""
19731973
19741974 create_time : datetime
@@ -2034,8 +2034,12 @@ def to_pb(self) -> electricity_trading_pb2.PublicOrderBookRecord:
20342034 side = electricity_trading_pb2 .MarketSide .ValueType (self .side .value ),
20352035 price = self .price .to_pb (),
20362036 quantity = self .quantity .to_pb (),
2037- execution_option = electricity_trading_pb2 .OrderExecutionOption .ValueType (
2038- self .execution_option .value
2037+ execution_option = (
2038+ electricity_trading_pb2 .OrderExecutionOption .ValueType (
2039+ self .execution_option .value
2040+ )
2041+ if self .execution_option
2042+ else None
20392043 ),
20402044 create_time = create_time ,
20412045 update_time = update_time ,
You can’t perform that action at this time.
0 commit comments