Skip to content

Commit 133313c

Browse files
Update to electricity trading API v0.0.8 (#150)
2 parents 2ba7598 + 425c281 commit 133313c

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
# Frequenz Electricity Trading API Client Release Notes
22

3-
## Summary
4-
5-
<!-- Here goes a general summary of what this release is about -->
6-
73
## Upgrading
84

9-
- The client interface now requires that other than the `gridpool_id`, all parameters to client methods are kw-only, and can't be specified as positional arguments.
5+
- The minimum allowed version of `protobuf` and `grpcio` has been updated to 6.31.1 and 1.72.1 respectively.
106

117
## New Features
128

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
9+
- Updated to `v0.8.0` of the Electricity Trading API.
10+
- Updated to `v0.11.0` of the base client library.
1411

1512
## Bug Fixes
1613

17-
- Usage examples have been fixed.
14+
- Added `OrderType` field to `PublicOrder` class.

pyproject.toml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ requires-python = ">= 3.11, < 4"
4040
dependencies = [
4141
"click >= 8.1.8, < 9",
4242
"entsoe-py >= 0.6.16, < 1",
43-
"frequenz-api-common >= 0.6.3, < 0.7.0",
44-
"grpcio >= 1.68.1, < 2",
43+
"frequenz-api-common >= 0.6.5, < 0.7.0",
44+
"grpcio >= 1.72.1, < 2",
4545
"frequenz-channels >= 1.6.1, < 2",
46-
"frequenz-client-base >= 0.9.0, < 0.10.0",
46+
"frequenz-client-base >= 0.11.0, < 0.12.0",
4747
"frequenz-client-common >= 0.1.0, < 0.4.0",
48-
"frequenz-api-electricity-trading >= 0.7.0, < 0.8.0",
49-
"protobuf >= 5.29.2, < 7",
48+
"frequenz-api-electricity-trading >= 0.8.0, < 0.9.0",
49+
"protobuf >= 6.31.1, < 8", # Do not widen beyond 8!
5050
]
5151
dynamic = ["version"]
5252

@@ -171,11 +171,22 @@ disable = [
171171
]
172172

173173
[tool.pytest.ini_options]
174-
addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv"
174+
addopts = "-vv"
175175
testpaths = ["tests", "src"]
176176
asyncio_default_fixture_loop_scope = "function"
177177
asyncio_mode = "auto"
178178
required_plugins = ["pytest-asyncio", "pytest-mock"]
179+
filterwarnings = [
180+
"error",
181+
"once::DeprecationWarning",
182+
"once::PendingDeprecationWarning",
183+
# We ignore warnings about protobuf gencode version being one version older
184+
# than the current version, as this is supported by protobuf, and we expect to
185+
# have such cases. If we go too far, we will get a proper error anyways.
186+
# We use a raw string (single quotes) to avoid the need to escape special
187+
# characters as this is a regex.
188+
'ignore:Protobuf gencode version .*exactly one major version older.*:UserWarning',
189+
]
179190

180191
[tool.mypy]
181192
explicit_package_bases = true

src/frequenz/client/electricity_trading/_types.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,9 @@ class PublicOrder: # pylint: disable=too-many-instance-attributes
19591959
delivery_period: DeliveryPeriod
19601960
"""The delivery period for the contract."""
19611961

1962+
type: OrderType | None
1963+
"""The type of order (e.g., LIMIT, STOP_LIMIT, ICEBERG)."""
1964+
19621965
side: MarketSide
19631966
"""Indicates if the order is on the Buy or Sell side of the market."""
19641967

@@ -2007,11 +2010,17 @@ def from_pb(
20072010
if public_order.HasField("execution_option")
20082011
else None
20092012
)
2013+
order_type = (
2014+
OrderType.from_pb(public_order.type)
2015+
if public_order.HasField("type")
2016+
else None
2017+
)
20102018

20112019
return cls(
20122020
public_order_id=public_order.id,
20132021
delivery_area=DeliveryArea.from_pb(public_order.delivery_area),
20142022
delivery_period=DeliveryPeriod.from_pb(public_order.delivery_period),
2023+
type=order_type,
20152024
side=MarketSide.from_pb(public_order.side),
20162025
price=Price.from_pb(public_order.price),
20172026
quantity=Power.from_pb(public_order.quantity),

tests/test_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
public_order_id=42,
180180
delivery_area=DeliveryArea(code="XYZ", code_type=EnergyMarketCodeType.EUROPE_EIC),
181181
delivery_period=DeliveryPeriod(start=START_TIME, duration=timedelta(minutes=15)),
182+
type=OrderType.LIMIT,
182183
side=MarketSide.BUY,
183184
price=Price(amount=Decimal("100.00"), currency=Currency.EUR),
184185
quantity=Power(mw=Decimal("5.00")),
@@ -196,6 +197,7 @@
196197
start=START_TIME_PB,
197198
duration=delivery_duration_pb2.DeliveryDuration.DELIVERY_DURATION_15,
198199
),
200+
type=electricity_trading_pb2.OrderType.ORDER_TYPE_LIMIT,
199201
side=electricity_trading_pb2.MarketSide.MARKET_SIDE_BUY,
200202
price=price_pb2.Price(
201203
amount=decimal_pb2.Decimal(value="100.00"),

0 commit comments

Comments
 (0)