electricity_trading
frequenz.client.electricity_trading ¤
The Electricity Trading API client.
Classes¤
frequenz.client.electricity_trading.Client ¤
Electricity trading client.
Source code in frequenz/client/electricity_trading/_client.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
|
Functions¤
__init__ ¤
__init__(grpc_channel: Channel) -> None
Initialize the client.
PARAMETER | DESCRIPTION |
---|---|
grpc_channel |
gRPC channel to use for communication with the API.
TYPE:
|
Source code in frequenz/client/electricity_trading/_client.py
cancel_all_gridpool_orders
async
¤
Cancel all orders for a specific Gridpool.
PARAMETER | DESCRIPTION |
---|---|
gridpool_id |
The Gridpool to cancel the orders for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
The ID of the Gridpool for which the orders were cancelled. |
Source code in frequenz/client/electricity_trading/_client.py
cancel_gridpool_order
async
¤
cancel_gridpool_order(
gridpool_id: int, order_id: int
) -> OrderDetail
Cancel a single order for a given Gridpool.
PARAMETER | DESCRIPTION |
---|---|
gridpool_id |
The Gridpool to cancel the order for.
TYPE:
|
order_id |
The order to cancel.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
OrderDetail
|
The cancelled order. |
Source code in frequenz/client/electricity_trading/_client.py
create_gridpool_order
async
¤
create_gridpool_order(
gridpool_id: int,
delivery_area: DeliveryArea,
delivery_period: DeliveryPeriod,
order_type: OrderType,
side: MarketSide,
price: Price,
quantity: Energy,
stop_price: Price | None = None,
peak_price_delta: Price | None = None,
display_quantity: Energy | None = None,
execution_option: OrderExecutionOption | None = None,
valid_until: datetime | None = None,
payload: dict[str, Value] | None = None,
tag: str | None = None,
) -> OrderDetail
Create a gridpool order.
PARAMETER | DESCRIPTION |
---|---|
gridpool_id |
ID of the gridpool to create the order for.
TYPE:
|
delivery_area |
Delivery area of the order.
TYPE:
|
delivery_period |
Delivery period of the order.
TYPE:
|
order_type |
Type of the order.
TYPE:
|
side |
Side of the order.
TYPE:
|
price |
Price of the order.
TYPE:
|
quantity |
Quantity of the order.
TYPE:
|
stop_price |
Stop price of the order.
TYPE:
|
peak_price_delta |
Peak price delta of the order.
TYPE:
|
display_quantity |
Display quantity of the order.
TYPE:
|
execution_option |
Execution option of the order.
TYPE:
|
valid_until |
Valid until of the order.
TYPE:
|
payload |
Payload of the order. |
tag |
Tag of the order.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
OrderDetail
|
The created order. |
Source code in frequenz/client/electricity_trading/_client.py
get_gridpool_order
async
¤
get_gridpool_order(
gridpool_id: int, order_id: int
) -> OrderDetail
Get a single order from a given gridpool.
PARAMETER | DESCRIPTION |
---|---|
gridpool_id |
The Gridpool to retrieve the order for.
TYPE:
|
order_id |
The order to retrieve.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
OrderDetail
|
The order. |
Source code in frequenz/client/electricity_trading/_client.py
list_gridpool_orders
async
¤
list_gridpool_orders(
gridpool_id: int,
states: list[OrderState] | None = None,
side: MarketSide | None = None,
delivery_period: DeliveryPeriod | None = None,
delivery_area: DeliveryArea | None = None,
tag: str | None = None,
max_nr_orders: int | None = None,
page_token: str | None = None,
) -> list[OrderDetail]
List orders for a specific Gridpool with optional filters.
PARAMETER | DESCRIPTION |
---|---|
gridpool_id |
The Gridpool to retrieve the orders for.
TYPE:
|
states |
List of order states to filter by.
TYPE:
|
side |
The side of the market to filter by.
TYPE:
|
delivery_period |
The delivery period to filter by.
TYPE:
|
delivery_area |
The delivery area to filter by.
TYPE:
|
tag |
The tag to filter by.
TYPE:
|
max_nr_orders |
The maximum number of orders to return.
TYPE:
|
page_token |
The page token to use for pagination.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[OrderDetail]
|
The list of orders for that gridpool. |
Source code in frequenz/client/electricity_trading/_client.py
list_public_trades
async
¤
list_public_trades(
states: list[OrderState] | None = None,
delivery_period: DeliveryPeriod | None = None,
buy_delivery_area: DeliveryArea | None = None,
sell_delivery_area: DeliveryArea | None = None,
max_nr_orders: int | None = None,
page_token: str | None = None,
) -> list[PublicTrade]
List all executed public orders with optional filters.
PARAMETER | DESCRIPTION |
---|---|
states |
List of order states to filter by.
TYPE:
|
delivery_period |
The delivery period to filter by.
TYPE:
|
buy_delivery_area |
The buy delivery area to filter by.
TYPE:
|
sell_delivery_area |
The sell delivery area to filter by.
TYPE:
|
max_nr_orders |
The maximum number of orders to return.
TYPE:
|
page_token |
The page token to use for pagination.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[PublicTrade]
|
The list of public trades. |
Source code in frequenz/client/electricity_trading/_client.py
stream_gridpool_orders
async
¤
stream_gridpool_orders(
gridpool_id: int,
order_states: list[OrderState] | None = None,
market_side: MarketSide | None = None,
delivery_area: DeliveryArea | None = None,
delivery_period: DeliveryPeriod | None = None,
tag: str | None = None,
) -> Receiver[OrderDetail]
Stream gridpool orders.
PARAMETER | DESCRIPTION |
---|---|
gridpool_id |
ID of the gridpool to stream orders for.
TYPE:
|
order_states |
List of order states to filter for.
TYPE:
|
market_side |
Market side to filter for.
TYPE:
|
delivery_area |
Delivery area to filter for.
TYPE:
|
delivery_period |
Delivery period to filter for.
TYPE:
|
tag |
Tag to filter for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Receiver[OrderDetail]
|
Async generator of orders. |
Source code in frequenz/client/electricity_trading/_client.py
stream_public_trades
async
¤
stream_public_trades(
states: list[OrderState] | None = None,
delivery_period: DeliveryPeriod | None = None,
buy_delivery_area: DeliveryArea | None = None,
sell_delivery_area: DeliveryArea | None = None,
) -> Receiver[PublicTrade]
Stream public orders.
PARAMETER | DESCRIPTION |
---|---|
states |
List of order states to filter for.
TYPE:
|
delivery_period |
Delivery period to filter for.
TYPE:
|
buy_delivery_area |
Buy delivery area to filter for.
TYPE:
|
sell_delivery_area |
Sell delivery area to filter for.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Receiver[PublicTrade]
|
Async generator of orders. |
Source code in frequenz/client/electricity_trading/_client.py
update_gridpool_order
async
¤
update_gridpool_order(
gridpool_id: int,
order_id: int,
price: Price | None | _Sentinel = NO_VALUE,
quantity: Energy | None | _Sentinel = NO_VALUE,
stop_price: Price | None | _Sentinel = NO_VALUE,
peak_price_delta: Price | None | _Sentinel = NO_VALUE,
display_quantity: Energy | None | _Sentinel = NO_VALUE,
execution_option: OrderExecutionOption
| None
| _Sentinel = NO_VALUE,
valid_until: datetime | None | _Sentinel = NO_VALUE,
payload: dict[str, Value] | None | _Sentinel = NO_VALUE,
tag: str | None | _Sentinel = NO_VALUE,
) -> OrderDetail
Update an existing order for a given Gridpool.
PARAMETER | DESCRIPTION |
---|---|
gridpool_id |
ID of the Gridpool the order belongs to.
TYPE:
|
order_id |
Order ID.
TYPE:
|
price |
The updated limit price at which the contract is to be traded. This is the maximum price for a BUY order or the minimum price for a SELL order.
TYPE:
|
quantity |
The updated quantity of the contract being traded, specified in MWh.
TYPE:
|
stop_price |
Applicable for STOP_LIMIT orders. This is the updated stop price that triggers the limit order.
TYPE:
|
peak_price_delta |
Applicable for ICEBERG orders. This is the updated price difference between the peak price and the limit price.
TYPE:
|
display_quantity |
Applicable for ICEBERG orders. This is the updated quantity of the order to be displayed in the order book.
TYPE:
|
execution_option |
Updated execution options such as All or None, Fill or Kill, etc.
TYPE:
|
valid_until |
This is an updated timestamp defining the time after which the order should be cancelled if not filled. The timestamp is in UTC.
TYPE:
|
payload |
Updated user-defined payload individual to a specific order. This can be any data that the user wants to associate with the order. |
tag |
Updated user-defined tag to group related orders.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
OrderDetail
|
The updated order. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If no fields to update are provided. |
Source code in frequenz/client/electricity_trading/_client.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
frequenz.client.electricity_trading.DeliveryArea
dataclass
¤
Geographical or administrative region.
These are, usually defined and maintained by a Transmission System Operator (TSO), where electricity deliveries for a contract occur.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
code_type
instance-attribute
¤
Type of code used for identifying the delivery area itself.
Functions¤
from_pb
classmethod
¤
from_pb(delivery_area: DeliveryArea) -> Self
Convert a protobuf DeliveryArea to DeliveryArea object.
PARAMETER | DESCRIPTION |
---|---|
delivery_area |
DeliveryArea to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
DeliveryArea object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert a DeliveryArea object to protobuf DeliveryArea.
RETURNS | DESCRIPTION |
---|---|
DeliveryArea
|
Protobuf message corresponding to the DeliveryArea object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.DeliveryPeriod
dataclass
¤
Time period during which the contract is delivered.
It is defined by a start timestamp and a duration.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
start
instance-attribute
¤
start: datetime
Start UTC timestamp represents the beginning of the delivery period. This timestamp is inclusive, meaning that the delivery period starts from this point in time.
Functions¤
__post_init__ ¤
Validate the parameters.
Source code in frequenz/client/electricity_trading/_types.py
from_pb
classmethod
¤
from_pb(delivery_period: DeliveryPeriod) -> Self
Convert a protobuf DeliveryPeriod to DeliveryPeriod object.
PARAMETER | DESCRIPTION |
---|---|
delivery_period |
DeliveryPeriod to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
DeliveryPeriod object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert a DeliveryPeriod object to protobuf DeliveryPeriod.
RETURNS | DESCRIPTION |
---|---|
DeliveryPeriod
|
Protobuf message corresponding to the DeliveryPeriod object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.Energy
dataclass
¤
Represents energy unit in Megawatthours (MWh).
Source code in frequenz/client/electricity_trading/_types.py
Functions¤
from_pb
classmethod
¤
from_pb(energy: Energy) -> Self
Convert a protobuf Energy to Energy object.
PARAMETER | DESCRIPTION |
---|---|
energy |
Energy to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Energy object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert a Energy object to protobuf Energy.
RETURNS | DESCRIPTION |
---|---|
Energy
|
Protobuf message corresponding to the Energy object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.GridpoolOrderFilter
dataclass
¤
Parameters for filtering Gridpool orders.
Source code in frequenz/client/electricity_trading/_types.py
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
|
Attributes¤
delivery_period
instance-attribute
¤
delivery_period: DeliveryPeriod | None
Delivery period to filter for.
Functions¤
from_pb
classmethod
¤
from_pb(gridpool_order_filter: GridpoolOrderFilter) -> Self
Convert a protobuf GridpoolOrderFilter to GridpoolOrderFilter object.
PARAMETER | DESCRIPTION |
---|---|
gridpool_order_filter |
GridpoolOrderFilter to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
GridpoolOrderFilter object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
to_pb() -> GridpoolOrderFilter
Convert a GridpoolOrderFilter object to protobuf GridpoolOrderFilter.
RETURNS | DESCRIPTION |
---|---|
GridpoolOrderFilter
|
Protobuf GridpoolOrderFilter corresponding to the object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.MarketSide ¤
Bases: Enum
Which side of the market the order is on, either buying or selling.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
BUY
class-attribute
instance-attribute
¤
Order to purchase electricity, referred to as a 'bid' in the order book.
SELL
class-attribute
instance-attribute
¤
Order to sell electricity, referred to as an 'ask' or 'offer' in the order book.
UNSPECIFIED
class-attribute
instance-attribute
¤
The side of the market has not been set.
Functions¤
from_pb
classmethod
¤
from_pb(market_side: ValueType) -> Self
Convert a protobuf MarketSide value to MarketSide enum.
PARAMETER | DESCRIPTION |
---|---|
market_side |
Market side to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Enum value corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert a MarketSide enum to protobuf MarketSide value.
RETURNS | DESCRIPTION |
---|---|
ValueType
|
Protobuf message corresponding to the MarketSide enum. |
frequenz.client.electricity_trading.Order
dataclass
¤
Represents an order in the electricity market.
Source code in frequenz/client/electricity_trading/_types.py
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
|
Attributes¤
delivery_area
instance-attribute
¤
delivery_area: DeliveryArea
The delivery area where the contract is to be delivered.
delivery_period
instance-attribute
¤
delivery_period: DeliveryPeriod
The delivery period for the contract.
display_quantity
instance-attribute
¤
display_quantity: Energy | None
Applicable for ICEBERG orders. The quantity of the order to be displayed in the order book.
execution_option
instance-attribute
¤
execution_option: OrderExecutionOption | None
Order execution options such as All or None, Fill or Kill, etc.
payload
instance-attribute
¤
User-defined payload individual to a specific order. This can be any data that needs to be associated with the order.
peak_price_delta
instance-attribute
¤
peak_price_delta: Price | None
Applicable for ICEBERG orders. The price difference between the peak price and the limit price.
side
instance-attribute
¤
side: MarketSide
Indicates if the order is on the Buy or Sell side of the market.
stop_price
instance-attribute
¤
stop_price: Price | None
Applicable for STOP_LIMIT orders. The stop price that triggers the limit order.
valid_until
instance-attribute
¤
valid_until: datetime | None
UTC timestamp defining the time after which the order should be cancelled if not filled.
Functions¤
from_pb
classmethod
¤
Convert a protobuf Order to Order object.
PARAMETER | DESCRIPTION |
---|---|
order |
Order to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Order object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
to_pb() -> Order
Convert an Order object to protobuf Order.
RETURNS | DESCRIPTION |
---|---|
Order
|
Protobuf message corresponding to the Order object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.OrderDetail
dataclass
¤
Represents an order with full details, including its ID, state, and associated UTC timestamps.
ATTRIBUTE | DESCRIPTION |
---|---|
order_id |
Unique identifier of the order.
TYPE:
|
order |
The details of the order.
TYPE:
|
state_detail |
Details of the order's current state.
TYPE:
|
open_quantity |
Remaining open quantity for this order.
TYPE:
|
filled_quantity |
Filled quantity for this order.
TYPE:
|
create_time |
UTC Timestamp when the order was created.
TYPE:
|
modification_time |
UTC Timestamp of the last update to the order.
TYPE:
|
Source code in frequenz/client/electricity_trading/_types.py
Functions¤
from_pb
classmethod
¤
from_pb(order_detail: OrderDetail) -> Self
Convert a protobuf OrderDetail to OrderDetail object.
PARAMETER | DESCRIPTION |
---|---|
order_detail |
OrderDetail to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
OrderDetail object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.OrderExecutionOption ¤
Bases: Enum
Specific behavior for the execution of an order.
These options provide control on how an order is handled in the market.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
AON
class-attribute
instance-attribute
¤
All or None: Order must be executed in its entirety, or not executed at all.
FOK
class-attribute
instance-attribute
¤
Fill or Kill: Order must be executed immediately in its entirety, or not at all.
IOC
class-attribute
instance-attribute
¤
Immediate or Cancel: Any portion of an order that cannot be filled immediately will be cancelled.
NONE
class-attribute
instance-attribute
¤
Order remains open until it's fully filled, cancelled by the client,
valid_until
timestamp is reached, or the end of the trading session.
UNSPECIFIED
class-attribute
instance-attribute
¤
The order execution option has not been set.
Functions¤
from_pb
classmethod
¤
from_pb(order_execution_option: ValueType) -> Self
Convert a protobuf OrderExecutionOption value to OrderExecutionOption enum.
PARAMETER | DESCRIPTION |
---|---|
order_execution_option |
order execution option to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Enum value corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.OrderState ¤
Bases: Enum
State of an order.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
ACTIVE
class-attribute
instance-attribute
¤
The order has been confirmed and is open in the market. It may be unfilled or partially filled.
CANCELED
class-attribute
instance-attribute
¤
The order has been canceled. This can occur due to a cancellation request by the market participant, system, or market operator.
CANCEL_REJECTED
class-attribute
instance-attribute
¤
The order cancellation request was rejected, likely due to it having already been filled or expired.
CANCEL_REQUESTED
class-attribute
instance-attribute
¤
A cancellation request for the order has been submitted but the order is not yet removed from the order book.
EXPIRED
class-attribute
instance-attribute
¤
The order has not been filled within the defined duration and has expired.
FAILED
class-attribute
instance-attribute
¤
The order submission failed and was unable to be placed on the order book, usually due to a validation error or system issue.
FILLED
class-attribute
instance-attribute
¤
The order has been completely filled and there are no remaining quantities on the order.
HIBERNATE
class-attribute
instance-attribute
¤
The order has been entered into the system but is not currently exposed to the market. This could be due to certain conditions not yet being met.
PENDING
class-attribute
instance-attribute
¤
The order has been sent to the marketplace but has not yet been confirmed. This can be due to awaiting validation or system processing.
RECALL
class-attribute
instance-attribute
¤
The order has been recalled. This could be due to a system issue or a request from the market participant or market operator.
UNSPECIFIED
class-attribute
instance-attribute
¤
The order state is not known. Usually the default state of a newly created order object before any operations have been applied.
Functions¤
from_pb
classmethod
¤
from_pb(order_state: ValueType) -> Self
Convert a protobuf OrderState value to OrderState enum.
PARAMETER | DESCRIPTION |
---|---|
order_state |
Order state to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Enum value corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert an OrderState enum to protobuf OrderState value.
RETURNS | DESCRIPTION |
---|---|
ValueType
|
Protobuf message corresponding to the OrderState enum. |
frequenz.client.electricity_trading.OrderType ¤
Bases: Enum
Type of the order (specifies how the order is to be executed in the market).
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
BALANCE
class-attribute
instance-attribute
¤
Balance order aims to balance supply and demand, usually at a specific location or within a system.(Not yet supported).
BLOCK
class-attribute
instance-attribute
¤
User defined block order, generally a large quantity order filled all at once. (Not yet supported).
ICEBERG
class-attribute
instance-attribute
¤
A large order divided into smaller lots to hide the actual order quantity. Only the visible part of the order is shown in the order book.
LIMIT
class-attribute
instance-attribute
¤
Order to buy or sell at a specific price or better. It remains active until it is filled, cancelled, or expired.
PREARRANGED
class-attribute
instance-attribute
¤
On exchange prearranged trade, a trade that has been privately negotiated and then submitted to the exchange. (Not yet supported).
PRIVATE
class-attribute
instance-attribute
¤
Private and confidential trade, not visible in the public order book and has no market impact. (Not yet supported).
STOP_LIMIT
class-attribute
instance-attribute
¤
An order that will be executed at a specified price, or better, after a given stop price has been reached.
UNSPECIFIED
class-attribute
instance-attribute
¤
The order type has not been set.
Functions¤
from_pb
classmethod
¤
from_pb(order_type: ValueType) -> Self
Convert a protobuf OrderType value to OrderType enum.
PARAMETER | DESCRIPTION |
---|---|
order_type |
Order type to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Enum value corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert an OrderType enum to protobuf OrderType value.
RETURNS | DESCRIPTION |
---|---|
ValueType
|
Protobuf message corresponding to the OrderType enum. |
frequenz.client.electricity_trading.PaginationParams
dataclass
¤
Parameters for paginating list requests.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
page_size
class-attribute
instance-attribute
¤
page_size: int | None = None
The maximum number of results to be returned per request.
page_token
class-attribute
instance-attribute
¤
page_token: str | None = None
The token identifying a specific page of the list results.
Functions¤
from_pb
classmethod
¤
from_pb(pagination_params: PaginationParams) -> Self
Convert a protobuf PaginationParams to PaginationParams object.
PARAMETER | DESCRIPTION |
---|---|
pagination_params |
PaginationParams to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
PaginationParams object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert a PaginationParams object to protobuf PaginationParams.
RETURNS | DESCRIPTION |
---|---|
PaginationParams
|
Protobuf message corresponding to the PaginationParams object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.Price
dataclass
¤
Price of an order.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
Functions¤
from_pb
classmethod
¤
from_pb(price: Price) -> Self
Convert a protobuf Price to Price object.
PARAMETER | DESCRIPTION |
---|---|
price |
Price to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Price object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
Convert a Price object to protobuf Price.
RETURNS | DESCRIPTION |
---|---|
Price
|
Protobuf message corresponding to the Price object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.PublicTrade
dataclass
¤
Represents a public order in the market.
Source code in frequenz/client/electricity_trading/_types.py
Attributes¤
buy_delivery_area
instance-attribute
¤
buy_delivery_area: DeliveryArea
Delivery area code of the buy side.
delivery_period
instance-attribute
¤
delivery_period: DeliveryPeriod
The delivery period for the contract.
modification_time
instance-attribute
¤
modification_time: datetime
UTC Timestamp of the last order update or matching.
public_trade_id
instance-attribute
¤
public_trade_id: int
ID of the order from the public order book.
sell_delivery_area
instance-attribute
¤
sell_delivery_area: DeliveryArea
Delivery area code of the sell side.
Functions¤
from_pb
classmethod
¤
from_pb(public_trade: PublicTrade) -> Self
Convert a protobuf PublicTrade to PublicTrade object.
PARAMETER | DESCRIPTION |
---|---|
public_trade |
PublicTrade to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
PublicTrade object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.PublicTradeFilter
dataclass
¤
Parameters for filtering the historic, publicly executed orders (trades).
Source code in frequenz/client/electricity_trading/_types.py
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
|
Attributes¤
buy_delivery_area
instance-attribute
¤
buy_delivery_area: DeliveryArea | None
Delivery area to filter for on the buy side.
delivery_period
instance-attribute
¤
delivery_period: DeliveryPeriod | None
Delivery period to filter for.
sell_delivery_area
instance-attribute
¤
sell_delivery_area: DeliveryArea | None
Delivery area to filter for on the sell side.
Functions¤
from_pb
classmethod
¤
from_pb(public_trade_filter: PublicTradeFilter) -> Self
Convert a protobuf PublicTradeFilter to PublicTradeFilter object.
PARAMETER | DESCRIPTION |
---|---|
public_trade_filter |
PublicTradeFilter to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
PublicTradeFilter object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
to_pb() -> PublicTradeFilter
Convert a PublicTradeFilter object to protobuf PublicTradeFilter.
RETURNS | DESCRIPTION |
---|---|
PublicTradeFilter
|
Protobuf PublicTradeFilter corresponding to the object. |
Source code in frequenz/client/electricity_trading/_types.py
frequenz.client.electricity_trading.UpdateOrder
dataclass
¤
Represents the order properties that can be updated after an order has been placed.
At least one of the optional fields must be set for an update to take place.
Source code in frequenz/client/electricity_trading/_types.py
1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 |
|
Attributes¤
display_quantity
instance-attribute
¤
display_quantity: Energy | None
Applicable for ICEBERG orders. This is the updated quantity of the order to be displayed in the order book.
execution_option
instance-attribute
¤
execution_option: OrderExecutionOption | None
Updated execution options such as All or None, Fill or Kill, etc.
payload
instance-attribute
¤
Updated user-defined payload individual to a specific order. This can be any data that the user wants to associate with the order.
peak_price_delta
instance-attribute
¤
peak_price_delta: Price | None
Applicable for ICEBERG orders. This is the updated price difference between the peak price and the limit price.
price
instance-attribute
¤
price: Price | None
The updated limit price at which the contract is to be traded. This is the maximum price for a BUY order or the minimum price for a SELL order.
quantity
instance-attribute
¤
quantity: Energy | None
The updated quantity of the contract being traded, specified in MWh.
stop_price
instance-attribute
¤
stop_price: Price | None
Applicable for STOP_LIMIT orders. This is the updated stop price that triggers the limit order.
valid_until
instance-attribute
¤
valid_until: datetime | None
This is an updated timestamp defining the time after which the order should be cancelled if not filled. The timestamp is in UTC.
Functions¤
from_pb
classmethod
¤
from_pb(update_order: UpdateOrder) -> Self
Convert a protobuf UpdateOrder to UpdateOrder object.
PARAMETER | DESCRIPTION |
---|---|
update_order |
UpdateOrder to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
UpdateOrder object corresponding to the protobuf message. |
Source code in frequenz/client/electricity_trading/_types.py
to_pb ¤
to_pb() -> UpdateOrder
Convert a UpdateOrder object to protobuf UpdateOrder.
RETURNS | DESCRIPTION |
---|---|
UpdateOrder
|
Protobuf UpdateOrder corresponding to the object. |