Skip to content

Commit 0f33776

Browse files
Fix minor issues found in a code session with Ostrom (#36)
- Upgrade grpcio to match the version [frequenz-api-electricity-trading](https://github.com/frequenz-floss/frequenz-api-electricity-trading) requires. - Update examples in documentation
2 parents cc60ea8 + 41d32ca commit 0f33776

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Electricity Trading API client for Python
1010
The Frequenz Electricity Trading API client for Python is an easy-to-use Python interface built to interact with the Frequenz Electricity Trading API. It allows you to create orders, get market data, and manage your orders.
1111

1212
## Features
13+
1314
* **Create and manage gridpool orders**: Place new orders, update existing ones, and cancel orders when necessary.
1415
* **Stream live data**: Get real-time updates on market data, including order books, trades, and market prices.
1516
* **Retrieve historical data**: Access historical data on market trades.
@@ -18,25 +19,26 @@ The Frequenz Electricity Trading API client for Python is an easy-to-use Python
1819

1920
The following platforms are officially supported (tested):
2021

21-
- **Python:** 3.11
22-
- **Operating System:** Ubuntu Linux 20.04
23-
- **Architectures:** amd64, arm64
22+
* **Python:** 3.11
23+
* **Operating System:** Ubuntu Linux 20.04
24+
* **Architectures:** amd64, arm64
2425

2526
## Usage
2627

2728
### Installation
2829

2930
You can install the Frequenz Electricity Trading API client via pip. Replace `VERSION` with the specific version you wish to install.
3031

31-
```
32+
```sh
3233
# Choose the version you want to install
33-
VERSION=0.2.2
34+
VERSION=0.2.3
3435
pip install frequenz-client-electricity-trading==$VERSION
3536
```
3637

3738
### Initialization
3839

3940
First, initialize the client with the appropriate server URL and API key.
41+
4042
```python
4143
from frequenz.client.electricity_trading import Client
4244

@@ -52,6 +54,7 @@ client = Client(
5254
### Create an Order
5355

5456
Here's an example of how one can create a limit order to buy energy.
57+
5558
```python
5659
from frequenz.client.electricity_trading import (
5760
Currency,
@@ -73,8 +76,8 @@ delivery_area = DeliveryArea(
7376
code_type=EnergyMarketCodeType.EUROPE_EIC
7477
)
7578
delivery_period = DeliveryPeriod(
76-
start=datetime.fromisoformat("2024-05-01T00:00:00"),
77-
duration=datetime.timedelta(minutes=15)
79+
start=datetime.fromisoformat("2024-05-01T00:00:00+00:00"),
80+
duration=timedelta(minutes=15)
7881
)
7982
price = Price(amount=Decimal("50.0"), currency=Currency.EUR)
8083
quantity = Energy(mwh=Decimal("0.1"))
@@ -84,7 +87,7 @@ order = await client.create_gridpool_order(
8487
delivery_period=delivery_period,
8588
order_type=OrderType.LIMIT,
8689
side=MarketSide.BUY,
87-
price=quantity,
90+
price=price,
8891
quantity=quantity,
8992
)
9093
```
@@ -113,7 +116,8 @@ buy_orders = await self._client.list_gridpool_orders(
113116
To get real-time updates on market trades, one can use the following code snippet.
114117

115118
```python
116-
async for public_trade in client.stream_public_trades():
119+
stream_public_trades = await client.stream_public_trades()
120+
async for public_trade in stream_public_trades:
117121
print(f"Received public trade: {public_trade}")
118122
```
119123

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ requires-python = ">= 3.11, < 4"
2929
dependencies = [
3030
"frequenz-api-common >= 0.5.3, < 0.7.0",
3131
"googleapis-common-protos >= 1.56.4, < 2",
32-
"grpcio >= 1.60.0, < 2",
32+
"grpcio >= 1.65.5, < 2",
3333
"frequenz-channels >= 1.0.0, < 2",
3434
"frequenz-client-base[grpcio] >= 0.5.0, < 0.6.0",
3535
"frequenz-api-electricity-trading >= 0.2.2, < 1",

0 commit comments

Comments
 (0)