An RTE API client enabling Go programs to interact with RTE APIs in a simple and uniform way.
RTE, the french electricity transmission system operator, provides
access to various data through an API on its data
portal. You can retrieve those data
with gorte
.
$ go get -u github.com/dhia-gharsallaoui/gorte
Add this import line to the file you're working in:
import "github.com/dhia-gharsallaoui/gorte"
To access the API, you need to create an account, or login if you have one. Once logged, you can subscribe (create an application) to the desired API (each APIs must be subscribed individualy), you’ll obtain a base64 encoded key. Then to set up a client use the command
key:= "YmFiMWY3NjMtODhjZC00LWE5ZTgtOTRmMDc1ODcyYmNjOmU5YTIxNDVjLTBkOGUZi04YWI2LWRlNjRmODExM2M"
client, err := gorte.NewClient(gorte.ClientConfig{Key: key})
The package came with a useful struct called Period
for calling API's with start date
and end date
configuration. this struct ensure the coding of the time in the suitable format.
layout := "2006-01-02 15:04"
sd, err := time.Parse(layout, "2022-03-01 23:00")
if err != nil {
fmt.Println(err)
}
ed, err := time.Parse(layout, "2022-03-09 13:00")
if err != nil {
fmt.Println(err)
}
opt := utils.Period{StartDate: sd, EndDate: ed}
After preparing our configuration we can call an API from the available categories.
For exemple to get the "Peak Period" signals from 2022-03-01 23:00
to 2022-03-09 13:00
.
signals, _, err := Client.Market.GetSignals(opt)
client.Consumption.GetAnnualForecasts(opt)
client.Consumption.GetShortTerm(opt)
client.Consumption.GetWeeklyForecasts(opt)
client.Consumption.GetOperators(opt)
client.Consumption.GetVolumes(opt)
client.Consumption.GetQualityData(gorte.GetQualityDataOptions{
ID: 0,
StartDate: opt.StartDate,
EndDate: opt.EndDate,
Type: "RMS,RMS_VOLTAGE",
})
client.Consumption.GetSignalEcowatt()
client.Consumption.GetTempoLikeCalendars(opt)
Not implemented yet.
- Actual Generation
- Generation Forecast
- Generation Installed Capacities
- Unavailability Additional Information
client.Market.GetAcceptedOffers(opt)
client.Market.GetAggregatedoffersAFRREnergybids(opt)
client.Market.GetAggregatedoffersEnergybids(opt)
client.Market.GetDailyProcuredReserves(opt)
client.Market.GetImbalance(opt)
client.Market.GetIndividualoffersEnergybids(opt)
client.Market.GetInsufficientsOffers(opt)
client.Market.GetMarginsData(opt)
client.Market.GetNeeds(opt)
client.Market.GetPeakDailyMargins(opt)
client.Market.GetProcuredReservesResp(opt)
client.Market.GetOperators(opt)
client.Market.GetVolumes(opt)
Not implemented yet.
package main
import (
"fmt"
"time"
gorte "github.com/dhia-gharsallaoui/gorte"
goutils "github.com/dhia-gharsallaoui/gorte/utils"
)
func main() {
key := "YmFiMWY3NjMtODhjZC00OTViLWE5ZTgtOtNDdhZi04YWI2LWRlNjRm=="
client, err := gorte.NewClient(gorte.ClientConfig{Key: key})
layout := "2006-01-02 15:04"
sd, err := time.Parse(layout, "2022-03-01 23:00")
if err != nil {
fmt.Println(err)
}
ed, err := time.Parse(layout, "2022-03-09 13:00")
if err != nil {
fmt.Println(err)
}
signals, _, err := client.Market.GetSignals(goutils.Period{StartDate: sd, EndDate: ed})
if err != nil {
fmt.Println(err)
} else {
fmt.Println(signals)
}
}
- Tests
- Add other RTE API
- If you have an issue, please report it on the issue tracker