Skip to content

Commit fcd7124

Browse files
Add definitions for Electricity Trading API (#148)
Add some protobuf definitions necessary for the Electricity Trading (and for Ancillary Services Market). This folder structure is a proposal, if anyone is against it for whatever reason, please suggest another folder structure that you would consider better. FYI @thomas-nicolai-frequenz @tiyash-basu-frequenz @frequenz-floss/api-electricity-trading-team
2 parents 5e01b38 + 6cf10e8 commit fcd7124

File tree

7 files changed

+123
-4
lines changed

7 files changed

+123
-4
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "submodules/api-common-protos"]
22
path = submodules/api-common-protos
3-
url = https://github.com/googleapis/api-common-protos.git
3+
url = https://github.com/googleapis/googleapis.git

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This release:
1616

1717
## New Features
1818

19-
<!-- Here goes the main new features and examples or instructions on how to use them -->
19+
Add protobufs definition necesary for Electricity Trading (and for Ancillary Services Market).
2020

2121
## Bug Fixes
2222

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Frequenz definitions of the time increment used for electricity
2+
// deliveries and trading.
3+
//
4+
// Copyright 2023 Frequenz Energy-as-a-Service GmbH
5+
//
6+
// Licensed under the MIT License (the "License");
7+
// you may not use this file except in compliance with the License.
8+
9+
syntax = "proto3";
10+
11+
package frequenz.api.common.v1.grid;
12+
13+
import "google/protobuf/timestamp.proto";
14+
15+
// DeliveryDuration represents the time increment, in minutes,
16+
// used for electricity deliveries and trading. These durations
17+
// serve as the basis for defining the delivery period in contracts,
18+
// and they dictate how energy is scheduled and delivered to meet
19+
// contractual obligations.
20+
//
21+
// !!! note "Compatibility Constraints"
22+
// Not all delivery durations are universally
23+
// compatible with all delivery areas or markets.
24+
//
25+
enum DeliveryDuration {
26+
// Default value, indicates that the duration is unspecified.
27+
DELIVERY_DURATION_UNSPECIFIED = 0;
28+
29+
// 5-minute duration
30+
DELIVERY_DURATION_5 = 1;
31+
32+
// 15-minute contract duration.
33+
DELIVERY_DURATION_15 = 2;
34+
35+
// 30-minute contract duration.
36+
DELIVERY_DURATION_30 = 3;
37+
38+
// 1-hour contract duration.
39+
DELIVERY_DURATION_60 = 4;
40+
}
41+
42+
// DeliveryPeriod represents the time period during which the contract
43+
// is delivered. It is defined by a start timestamp and a duration.
44+
message DeliveryPeriod {
45+
// Start UTC timestamp represents the beginning of the delivery period.
46+
// This timestamp is inclusive, meaning that the delivery period starts
47+
// from this point in time.
48+
//
49+
// !!! note
50+
// Delivery period start time constraints:
51+
// - 5-minute durations must start at times that are multiples of
52+
// 5 minutes past the hour.
53+
// - 15-minute durations must start at :00, :15, :30, or
54+
// :45 past the hour.
55+
// - 30-minute durations must start at :00 or :30 past the hour.
56+
// - 60-minute durations must start at :00 past the hour.
57+
google.protobuf.Timestamp start = 1;
58+
59+
// The length of the delivery period.
60+
DeliveryDuration duration = 2;
61+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Frequenz definitions of price for electricity trading.
2+
//
3+
// Copyright 2023 Frequenz Energy-as-a-Service GmbH
4+
//
5+
// Licensed under the MIT License (the "License");
6+
// you may not use this file except in compliance with the License.
7+
8+
syntax = "proto3";
9+
10+
package frequenz.api.common.v1.market;
11+
12+
import "google/type/decimal.proto";
13+
14+
// Represents a monetary price for electricity trading, including
15+
// the amount and currency. The currency used should align with the
16+
// delivery area's standard currency.
17+
//
18+
// !!! caution "Validation Required"
19+
// It's essential to ensure that the currency aligns with the
20+
// standard currency of the associated delivery area. Failure to
21+
// do so may result in the API service rejecting the request due to currency
22+
// mismatches.
23+
//
24+
// !!! info "Relation to Delivery Area"
25+
// The currency specified is intrinsically related to the delivery area
26+
// for the contract. Make sure the chosen currency is compatible with
27+
// the delivery area's currency standards.
28+
//
29+
message Price {
30+
// List of supported currencies.
31+
//
32+
// !!! info "Extensibility"
33+
// New currencies can be added to this enum to support additional markets.
34+
enum Currency {
35+
CURRENCY_UNSPECIFIED = 0;
36+
CURRENCY_USD = 1;
37+
CURRENCY_CAD = 2;
38+
CURRENCY_EUR = 3;
39+
CURRENCY_GBP = 4;
40+
CURRENCY_CHF = 5;
41+
CURRENCY_CNY = 6;
42+
CURRENCY_JPY = 7;
43+
CURRENCY_AUD = 8;
44+
CURRENCY_NZD = 9;
45+
CURRENCY_SGD = 10;
46+
}
47+
48+
// The amount of the price.
49+
google.type.Decimal amount = 1;
50+
51+
// The currency in which the price is denominated.
52+
Currency currency = 2;
53+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# License: MIT
2+
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Frequenz common gRPC API and bindings."""

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ classifiers = [
2626
]
2727
requires-python = ">= 3.11, < 4"
2828
dependencies = [
29-
"googleapis-common-protos >= 1.56.2, < 2",
29+
"googleapis-common-protos >= 1.56.4, < 2",
30+
"googleapis-common-protos-stubs == 2.2.0",
3031
"grpcio >= 1.51.1, < 2",
3132
]
3233
dynamic = ["version"]

submodules/api-common-protos

0 commit comments

Comments
 (0)