4040 from frequenz.client.electricity_trading import Client
4141
4242 # Change server address if needed
43- SERVICE_URL = "grpc://electricity-trading.api.frequenz. com:443?ssl=true "
43+ SERVICE_URL = "grpc://electricity-trading.url.goes.here.example. com:443"
4444 with open('/path/to/api_key.txt', 'r', encoding='utf-8') as f:
4545 API_KEY = f.read().strip()
4646
@@ -79,7 +79,7 @@ async def initialize():
7979 from decimal import Decimal
8080
8181 # Change server address if needed
82- SERVICE_URL = "grpc://electricity-trading.api.frequenz. com:443?ssl=true "
82+ SERVICE_URL = "grpc://electricity-trading.url.goes.here.example. com:443"
8383 with open('/path/to/api_key.txt', 'r', encoding='utf-8') as f:
8484 API_KEY = f.read().strip()
8585
@@ -124,7 +124,7 @@ async def create_order():
124124 from frequenz.client.electricity_trading import ( Client, MarketSide )
125125
126126 # Change server address if needed
127- SERVICE_URL = "grpc://electricity-trading.api.frequenz. com:443?ssl=true "
127+ SERVICE_URL = "grpc://electricity-trading.url.goes.here.example. com:443"
128128 with open('/path/to/api_key.txt', 'r', encoding='utf-8') as f:
129129 API_KEY = f.read().strip()
130130
@@ -136,17 +136,15 @@ async def list_orders():
136136
137137 gridpool_id: int = 1
138138
139- # List all orders for a given gridpool
140- orders = await client.list_gridpool_orders(
141- gridpool_id=gridpool_id,
142- )
143-
144- # List only the buy orders for a given gridpool
145- buy_orders = await client.list_gridpool_orders(
139+ # List all the buy orders for a given gridpool
140+ buy_orders = client.list_gridpool_orders(
146141 gridpool_id=gridpool_id,
147142 side=MarketSide.BUY,
148143 )
149144
145+ async for order in buy_orders:
146+ print(order)
147+
150148 asyncio.run(list_orders())
151149 ```
152150
@@ -161,7 +159,7 @@ async def list_orders():
161159 from frequenz.client.electricity_trading import Client
162160
163161 # Change server address if needed
164- SERVICE_URL = "grpc://electricity-trading.api.frequenz. com:443?ssl=true "
162+ SERVICE_URL = "grpc://electricity-trading.url.goes.here.example. com:443"
165163 with open('/path/to/api_key.txt', 'r', encoding='utf-8') as f:
166164 API_KEY = f.read().strip()
167165
@@ -170,8 +168,10 @@ async def stream_trades():
170168 server_url=SERVICE_URL,
171169 auth_key=API_KEY
172170 )
173- stream_public_trades = await client.stream_public_trades()
174- async for public_trade in stream_public_trades:
171+
172+ public_trades = client.receive_public_trades()
173+
174+ async for public_trade in public_trades.new_receiver():
175175 print(f"Received public trade: {public_trade}")
176176
177177 asyncio.run(stream_trades())
0 commit comments