@@ -83,6 +83,7 @@ class Currency(enum.Enum):
8383 SGD = price_pb2 .Price .Currency .CURRENCY_SGD
8484
8585 @classmethod
86+ @from_pb
8687 def from_pb (cls , currency : price_pb2 .Price .Currency .ValueType ) -> "Currency" :
8788 """Convert a protobuf Currency value to Currency enum.
8889
@@ -213,6 +214,7 @@ class EnergyMarketCodeType(enum.Enum):
213214 """North American Electric Reliability Corporation identifiers."""
214215
215216 @classmethod
217+ @from_pb
216218 def from_pb (
217219 cls , energy_market_code_type : delivery_area_pb2 .EnergyMarketCodeType .ValueType
218220 ) -> "EnergyMarketCodeType" :
@@ -258,6 +260,7 @@ class DeliveryArea:
258260 """Type of code used for identifying the delivery area itself."""
259261
260262 @classmethod
263+ @from_pb
261264 def from_pb (cls , delivery_area : delivery_area_pb2 .DeliveryArea ) -> Self :
262265 """Convert a protobuf DeliveryArea to DeliveryArea object.
263266
@@ -307,6 +310,7 @@ class DeliveryDuration(enum.Enum):
307310 """1-hour contract duration."""
308311
309312 @classmethod
313+ @from_pb
310314 def from_pb (
311315 cls , delivery_duration : delivery_duration_pb2 .DeliveryDuration .ValueType
312316 ) -> "DeliveryDuration" :
@@ -437,6 +441,7 @@ def __repr__(self) -> str:
437441 return self .__str__ ()
438442
439443 @classmethod
444+ @from_pb
440445 def from_pb (cls , delivery_period : delivery_duration_pb2 .DeliveryPeriod ) -> Self :
441446 """Convert a protobuf DeliveryPeriod to DeliveryPeriod object.
442447
@@ -511,6 +516,7 @@ class OrderExecutionOption(enum.Enum):
511516 immediately will be cancelled."""
512517
513518 @classmethod
519+ @from_pb
514520 def from_pb (
515521 cls ,
516522 order_execution_option : electricity_trading_pb2 .OrderExecutionOption .ValueType ,
@@ -576,6 +582,7 @@ class OrderType(enum.Enum):
576582 order book and has no market impact. (Not yet supported)."""
577583
578584 @classmethod
585+ @from_pb
579586 def from_pb (
580587 cls , order_type : electricity_trading_pb2 .OrderType .ValueType
581588 ) -> "OrderType" :
@@ -615,6 +622,7 @@ class MarketSide(enum.Enum):
615622 """Order to sell electricity, referred to as an 'ask' or 'offer' in the order book."""
616623
617624 @classmethod
625+ @from_pb
618626 def from_pb (
619627 cls , market_side : electricity_trading_pb2 .MarketSide .ValueType
620628 ) -> "MarketSide" :
@@ -677,6 +685,7 @@ class OrderState(enum.Enum):
677685 could be due to certain conditions not yet being met."""
678686
679687 @classmethod
688+ @from_pb
680689 def from_pb (
681690 cls , order_state : electricity_trading_pb2 .OrderState .ValueType
682691 ) -> "OrderState" :
@@ -740,6 +749,7 @@ class TradeState(enum.Enum):
740749 """An approval has been requested."""
741750
742751 @classmethod
752+ @from_pb
743753 def from_pb (
744754 cls , trade_state : electricity_trading_pb2 .TradeState .ValueType
745755 ) -> "TradeState" :
@@ -840,6 +850,7 @@ class StateReason(enum.Enum):
840850 """A quote was partially executed."""
841851
842852 @classmethod
853+ @from_pb
843854 def from_pb (
844855 cls ,
845856 state_reason : electricity_trading_pb2 .OrderDetail .StateDetail .StateReason .ValueType ,
@@ -893,6 +904,7 @@ class MarketActor(enum.Enum):
893904 """The system was the actor."""
894905
895906 @classmethod
907+ @from_pb
896908 def from_pb (
897909 cls ,
898910 market_actor : electricity_trading_pb2 .OrderDetail .StateDetail .MarketActor .ValueType ,
@@ -1145,6 +1157,7 @@ def __post_init__(self) -> None:
11451157 self .execution_time = self .execution_time .astimezone (timezone .utc )
11461158
11471159 @classmethod
1160+ @from_pb
11481161 def from_pb (cls , trade : electricity_trading_pb2 .Trade ) -> Self :
11491162 """Convert a protobuf Trade to Trade object.
11501163
@@ -1202,6 +1215,7 @@ class StateDetail:
12021215 """Actor responsible for the current state."""
12031216
12041217 @classmethod
1218+ @from_pb
12051219 def from_pb (
12061220 cls , state_detail : electricity_trading_pb2 .OrderDetail .StateDetail
12071221 ) -> Self :
@@ -1282,6 +1296,7 @@ def __post_init__(self) -> None:
12821296 self .modification_time = self .modification_time .astimezone (timezone .utc )
12831297
12841298 @classmethod
1299+ @from_pb
12851300 def from_pb (cls , order_detail : electricity_trading_pb2 .OrderDetail ) -> Self :
12861301 """Convert a protobuf OrderDetail to OrderDetail object.
12871302
@@ -1362,6 +1377,7 @@ def __post_init__(self) -> None:
13621377 self .execution_time = self .execution_time .astimezone (timezone .utc )
13631378
13641379 @classmethod
1380+ @from_pb
13651381 def from_pb (cls , public_trade : electricity_trading_pb2 .PublicTrade ) -> Self :
13661382 """Convert a protobuf PublicTrade to PublicTrade object.
13671383
@@ -1460,6 +1476,7 @@ def __hash__(self) -> int:
14601476 )
14611477
14621478 @classmethod
1479+ @from_pb
14631480 def from_pb (
14641481 cls , gridpool_order_filter : electricity_trading_pb2 .GridpoolOrderFilter
14651482 ) -> Self :
@@ -1584,6 +1601,7 @@ def __hash__(self) -> int:
15841601 )
15851602
15861603 @classmethod
1604+ @from_pb
15871605 def from_pb (
15881606 cls , gridpool_trade_filter : electricity_trading_pb2 .GridpoolTradeFilter
15891607 ) -> "GridpoolTradeFilter" :
@@ -1697,6 +1715,7 @@ def __hash__(self) -> int:
16971715 )
16981716
16991717 @classmethod
1718+ @from_pb
17001719 def from_pb (
17011720 cls , public_trade_filter : electricity_trading_pb2 .PublicTradeFilter
17021721 ) -> Self :
@@ -1809,6 +1828,7 @@ def __post_init__(self) -> None:
18091828 self .valid_until = self .valid_until .astimezone (timezone .utc )
18101829
18111830 @classmethod
1831+ @from_pb
18121832 def from_pb (
18131833 cls ,
18141834 update_order : electricity_trading_pb2 .UpdateGridpoolOrderRequest .UpdateOrder ,
0 commit comments