Skip to content

Add the public order book extension to the Client#120

Merged
matthias-wende-frequenz merged 4 commits into
v0.x.xfrom
unknown repository
Apr 22, 2025
Merged

Add the public order book extension to the Client#120
matthias-wende-frequenz merged 4 commits into
v0.x.xfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Apr 3, 2025

This PR integrates the Public Order Book extension to the Client. More specifically, the changes made are:

  • Add the PublicOrder and PublicOrderFilter types
  • Add the receive_public_order() endpoint
  • Update the frequenz-api-electricity-trading to >= 0.6.1, < 0.7.0

Copilot AI review requested due to automatic review settings April 3, 2025 09:59
@ghost ghost self-requested a review as a code owner April 3, 2025 09:59
@github-actions github-actions Bot added part:docs Affects the documentation part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels Apr 3, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates the Public Order Book extension into the Client. It adds new types PublicOrder and PublicOrderFilter, implements a new endpoint to stream public orders, and updates the dependency for the electricity trading API.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/frequenz/client/electricity_trading/_types.py Added PublicOrder and PublicOrderFilter types with relevant conversion methods.
src/frequenz/client/electricity_trading/_client.py Introduced the receive_public_orders endpoint and maintained the streaming logic for public orders.
pyproject.toml Updated the dependency for frequenz-api-electricity-trading to the new version constraints.
RELEASE_NOTES.md Updated release notes to document dependency changes and the addition of the Public Order Book extension.
Comments suppressed due to low confidence (1)

src/frequenz/client/electricity_trading/_client.py:977

  • The endpoint function name 'receive_public_orders' is inconsistent with the PR description using the singular 'receive_public_order()'. Consider renaming for consistency.
def receive_public_orders(

Comment thread RELEASE_NOTES.md Outdated
@ghost ghost force-pushed the public-orders branch from bfb3b69 to 0751295 Compare April 3, 2025 10:02
Copy link
Copy Markdown
Contributor

@matthias-wende-frequenz matthias-wende-frequenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I've added two small comments. Can you also please add tests?



@dataclass()
class PublicOrderFilter:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to call it PublicOrderBookFilter, because it's used to filter entries in the order book and not filter single orders.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that in the Client it's called PublicOrder I wouldn't. Or we write add *Book everywhere but imo for consistency in the API it's best to not include it in the names.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the client a single entry is called a public order. This class is used as a parameter for an rpc call to query a list of public orders.

raise
return self._public_trades_streams[public_trade_filter]

def receive_public_orders(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to call this receive_public_order_book and not differ from API terminology.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same as above)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This receives a stream of public orders, which together form a order book. We should be consistent across client and API. (Also this is a term this is officially in use so we should stick to established terminology).

@ghost
Copy link
Copy Markdown
Author

ghost commented Apr 7, 2025

Can you also please add tests?

Ah yes good call, will do!

camille-bouvy-frequenz added 3 commits April 8, 2025 11:50
* Add the PublicOrder and PublicOrderFilter types
* Add the receive_public_order() endpoint
* Update the frequenz-api-electricity-trading to >= 0.6.1, < 0.7.0

Signed-off-by: camille-bouvy-frequenz <camille.bouvy@frequenz.com>
Signed-off-by: camille-bouvy-frequenz <camille.bouvy@frequenz.com>
Signed-off-by: camille-bouvy-frequenz <camille.bouvy@frequenz.com>
@ghost ghost force-pushed the public-orders branch from 0751295 to f9df6a6 Compare April 8, 2025 09:54
@github-actions github-actions Bot added the part:tests Affects the unit, integration and performance (benchmarks) tests label Apr 8, 2025
@ghost ghost requested a review from matthias-wende-frequenz April 8, 2025 10:44
@ghost
Copy link
Copy Markdown
Author

ghost commented Apr 8, 2025

Fixed the names (as discussed in previous comments and in our call) and added tests.

@matthias-wende-frequenz matthias-wende-frequenz added this pull request to the merge queue Apr 17, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 17, 2025
@matthias-wende-frequenz matthias-wende-frequenz added this pull request to the merge queue Apr 17, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 17, 2025
@matthias-wende-frequenz matthias-wende-frequenz linked an issue Apr 22, 2025 that may be closed by this pull request
Signed-off-by: Matthias Wende <60187632+matthias-wende-frequenz@users.noreply.github.com>
@matthias-wende-frequenz matthias-wende-frequenz added this pull request to the merge queue Apr 22, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit 04f5253 Apr 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Public Order Book API Extension

3 participants