Skip to content

Commit

Permalink
Merge pull request #20 from camille-bouvy-frequenz/energy-type
Browse files Browse the repository at this point in the history
Revert #18 Add unit conversion methods to Energy type
  • Loading branch information
camille-bouvy-frequenz authored Jan 18, 2024
2 parents e2e84c5 + fc6390b commit bbfcbbf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 48 deletions.
10 changes: 2 additions & 8 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

## Summary

Commiting the API definitions and preparing the repo to the pass all CI tests.
This is the first release of the Electricity Trading API.

## Upgrading
It includes protobuf definitions of the Electricity Trading API and a python client with support for streaming of orders and public trades.

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

## New Features

Expand All @@ -16,8 +15,3 @@ Commiting the API definitions and preparing the repo to the pass all CI tests.
- Commiting the electricity trading api specs.
- Rename PublicOrders to PublicTrades
- Add a python client with pyton wrappers for methods & classes and support for streaming orders.
- Add unit conversion methods to the Energy type

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
40 changes: 0 additions & 40 deletions py/frequenz/client/electricity_trading/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,46 +144,6 @@ def to_pb(self) -> energy_pb2.Energy:
decimal_mwh.value = str(self.mwh)
return energy_pb2.Energy(mwh=decimal_mwh)

def as_watt_hours(self) -> Decimal:
"""Return the energy in watt hours.
Returns:
The energy in watt hours.
"""
return self.mwh * Decimal(1e6)

def as_kilowatt_hours(self) -> Decimal:
"""Return the energy in kilowatt hours.
Returns:
The energy in kilowatt hours.
"""
return self.mwh * Decimal(1e3)

@classmethod
def from_watt_hours(cls, watt_hours: Decimal) -> Self:
"""Initialize a new energy quantity from watt hours.
Args:
watt_hours: The energy in watt hours.
Returns:
A new energy quantity.
"""
return cls(mwh=watt_hours / Decimal(1e6))

@classmethod
def from_kilowatt_hours(cls, kilowatt_hours: Decimal) -> Self:
"""Initialize a new energy quantity from kilowatt hours.
Args:
kilowatt_hours: The energy in kilowatt hours.
Returns:
A new energy quantity.
"""
return cls(mwh=kilowatt_hours / Decimal(1e3))


class EnergyMarketCodeType(enum.Enum):
"""
Expand Down

0 comments on commit bbfcbbf

Please sign in to comment.