1616
1717# pylint: disable=no-member
1818from frequenz .api .common .v1 .grid import delivery_area_pb2 , delivery_duration_pb2
19- from frequenz .api .common .v1 .market import energy_pb2 , price_pb2
19+ from frequenz .api .common .v1 .market import power_pb2 , price_pb2
2020from frequenz .api .common .v1 .types import decimal_pb2
2121from frequenz .api .electricity_trading .v1 import electricity_trading_pb2
2222from google .protobuf import json_format , struct_pb2 , timestamp_pb2
@@ -117,32 +117,32 @@ def to_pb(self) -> price_pb2.Price:
117117
118118
119119@dataclass (frozen = True )
120- class Energy :
121- """Represents energy unit in Megawatthours (MWh )."""
120+ class Power :
121+ """Represents power unit in Megawatthours (MW )."""
122122
123- mwh : Decimal
123+ mw : Decimal
124124
125125 @classmethod
126- def from_pb (cls , energy : energy_pb2 . Energy ) -> Self :
127- """Convert a protobuf Energy to Energy object.
126+ def from_pb (cls , power : power_pb2 . Power ) -> Self :
127+ """Convert a protobuf Power to Power object.
128128
129129 Args:
130- energy: Energy to convert.
130+ power: Power to convert.
131131
132132 Returns:
133- Energy object corresponding to the protobuf message.
133+ Power object corresponding to the protobuf message.
134134 """
135- return cls (mwh = Decimal (energy . mwh .value ))
135+ return cls (mw = Decimal (power . mw .value ))
136136
137- def to_pb (self ) -> energy_pb2 . Energy :
138- """Convert a Energy object to protobuf Energy .
137+ def to_pb (self ) -> power_pb2 . Power :
138+ """Convert a Power object to protobuf Power .
139139
140140 Returns:
141- Protobuf message corresponding to the Energy object.
141+ Protobuf message corresponding to the Power object.
142142 """
143- decimal_mwh = decimal_pb2 .Decimal ()
144- decimal_mwh .value = str (self .mwh )
145- return energy_pb2 . Energy ( mwh = decimal_mwh )
143+ decimal_mw = decimal_pb2 .Decimal ()
144+ decimal_mw .value = str (self .mw )
145+ return power_pb2 . Power ( mw = decimal_mw )
146146
147147
148148class EnergyMarketCodeType (enum .Enum ):
@@ -872,7 +872,7 @@ class Order: # pylint: disable=too-many-instance-attributes
872872 price : Price
873873 """The limit price at which the contract is to be traded."""
874874
875- quantity : Energy
875+ quantity : Power
876876 """The quantity of the contract being traded."""
877877
878878 stop_price : Price | None = None
@@ -882,7 +882,7 @@ class Order: # pylint: disable=too-many-instance-attributes
882882 """Applicable for ICEBERG orders. The price difference between the peak price and
883883 the limit price."""
884884
885- display_quantity : Energy | None = None
885+ display_quantity : Power | None = None
886886 """Applicable for ICEBERG orders. The quantity of the order to be displayed in the order
887887 book."""
888888
@@ -924,7 +924,7 @@ def from_pb(cls, order: electricity_trading_pb2.Order) -> Self:
924924 type = OrderType .from_pb (order .type ),
925925 side = MarketSide .from_pb (order .side ),
926926 price = Price .from_pb (order .price ),
927- quantity = Energy .from_pb (order .quantity ),
927+ quantity = Power .from_pb (order .quantity ),
928928 stop_price = (
929929 Price .from_pb (order .stop_price )
930930 if order .HasField ("stop_price" )
@@ -936,7 +936,7 @@ def from_pb(cls, order: electricity_trading_pb2.Order) -> Self:
936936 else None
937937 ),
938938 display_quantity = (
939- Energy .from_pb (order .display_quantity )
939+ Power .from_pb (order .display_quantity )
940940 if order .HasField ("display_quantity" )
941941 else None
942942 ),
@@ -1019,7 +1019,7 @@ class Trade: # pylint: disable=too-many-instance-attributes
10191019 price : Price
10201020 """The price at which the trade was executed."""
10211021
1022- quantity : Energy
1022+ quantity : Power
10231023 """The executed quantity of the trade."""
10241024
10251025 state : TradeState
@@ -1051,7 +1051,7 @@ def from_pb(cls, trade: electricity_trading_pb2.Trade) -> Self:
10511051 delivery_period = DeliveryPeriod .from_pb (trade .delivery_period ),
10521052 execution_time = trade .execution_time .ToDatetime (tzinfo = timezone .utc ),
10531053 price = Price .from_pb (trade .price ),
1054- quantity = Energy .from_pb (trade .quantity ),
1054+ quantity = Power .from_pb (trade .quantity ),
10551055 state = TradeState .from_pb (trade .state ),
10561056 )
10571057
@@ -1143,8 +1143,8 @@ class OrderDetail:
11431143 order_id : int
11441144 order : Order
11451145 state_detail : StateDetail
1146- open_quantity : Energy
1147- filled_quantity : Energy
1146+ open_quantity : Power
1147+ filled_quantity : Power
11481148 create_time : datetime
11491149 modification_time : datetime
11501150
@@ -1184,8 +1184,8 @@ def from_pb(cls, order_detail: electricity_trading_pb2.OrderDetail) -> Self:
11841184 order_id = order_detail .order_id ,
11851185 order = Order .from_pb (order_detail .order ),
11861186 state_detail = StateDetail .from_pb (order_detail .state_detail ),
1187- open_quantity = Energy .from_pb (order_detail .open_quantity ),
1188- filled_quantity = Energy .from_pb (order_detail .filled_quantity ),
1187+ open_quantity = Power .from_pb (order_detail .open_quantity ),
1188+ filled_quantity = Power .from_pb (order_detail .filled_quantity ),
11891189 create_time = order_detail .create_time .ToDatetime (tzinfo = timezone .utc ),
11901190 modification_time = order_detail .modification_time .ToDatetime (
11911191 tzinfo = timezone .utc
@@ -1236,7 +1236,7 @@ class PublicTrade: # pylint: disable=too-many-instance-attributes
12361236 price : Price
12371237 """The limit price at which the contract is to be traded."""
12381238
1239- quantity : Energy
1239+ quantity : Power
12401240 """The quantity of the contract being traded."""
12411241
12421242 state : TradeState
@@ -1267,7 +1267,7 @@ def from_pb(cls, public_trade: electricity_trading_pb2.PublicTrade) -> Self:
12671267 delivery_period = DeliveryPeriod .from_pb (public_trade .delivery_period ),
12681268 execution_time = public_trade .execution_time .ToDatetime (tzinfo = timezone .utc ),
12691269 price = Price .from_pb (public_trade .price ),
1270- quantity = Energy .from_pb (public_trade .quantity ),
1270+ quantity = Power .from_pb (public_trade .quantity ),
12711271 state = TradeState .from_pb (public_trade .state ),
12721272 )
12731273
@@ -1659,8 +1659,8 @@ class UpdateOrder: # pylint: disable=too-many-instance-attributes
16591659 """The updated limit price at which the contract is to be traded.
16601660 This is the maximum price for a BUY order or the minimum price for a SELL order."""
16611661
1662- quantity : Energy | None = None
1663- """The updated quantity of the contract being traded, specified in MWh ."""
1662+ quantity : Power | None = None
1663+ """The updated quantity of the contract being traded, specified in MW ."""
16641664
16651665 stop_price : Price | None = None
16661666 """Applicable for STOP_LIMIT orders. This is the updated stop price that triggers
@@ -1670,7 +1670,7 @@ class UpdateOrder: # pylint: disable=too-many-instance-attributes
16701670 """Applicable for ICEBERG orders. This is the updated price difference
16711671 between the peak price and the limit price."""
16721672
1673- display_quantity : Energy | None = None
1673+ display_quantity : Power | None = None
16741674 """Applicable for ICEBERG orders. This is the updated quantity of the order
16751675 to be displayed in the order book."""
16761676
@@ -1717,7 +1717,7 @@ def from_pb(
17171717 else None
17181718 ),
17191719 quantity = (
1720- Energy .from_pb (update_order .quantity )
1720+ Power .from_pb (update_order .quantity )
17211721 if update_order .HasField ("quantity" )
17221722 else None
17231723 ),
@@ -1732,7 +1732,7 @@ def from_pb(
17321732 else None
17331733 ),
17341734 display_quantity = (
1735- Energy .from_pb (update_order .display_quantity )
1735+ Power .from_pb (update_order .display_quantity )
17361736 if update_order .HasField ("display_quantity" )
17371737 else None
17381738 ),
0 commit comments