frequenz-floss / frequenz-sdk-python

Frequenz Python Software Development Kit (SDK)
https://frequenz-floss.github.io/frequenz-sdk-python/
MIT License
13 stars 17 forks source link

Add a `Decimal`-backed `Price` `Quantity`-like class #850

Open llucax opened 5 months ago

llucax commented 5 months ago

What's needed?

The electricity trading API needs to deal with prices that are represented by a Decimal.

Proposed solution

Add a Price class to the quantities module, but Quantity is backed by a float.

Ideally we should have Price inherit from Quantity, and if that's not possible to at least have the same/similar interface.

Also price probably need to have attached a currency as unit, so we don't mix up prices in USD with prices in EUR for example, but this is much trickier because conversion rates are dynamic and should be retrieved by some API or something. So it is pretty different to normal quantities.

Use cases

Electricity trading client

Alternatives and workarounds

Add this class to the electricity trading API client.

Additional context

No response

llucax commented 5 months ago

@camille-bouvy-frequenz FYI