Skip to content

A Go RTE API client enabling Go programs to interact with RTE APIs in a simple and uniform way.

License

Notifications You must be signed in to change notification settings

dhia-gharsallaoui/gorte

Repository files navigation

gorte

An RTE API client enabling Go programs to interact with RTE APIs in a simple and uniform way.

GitHub license GoDoc Go Report Card GitHub issues

Overview

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.

Installation

$ go get -u github.com/dhia-gharsallaoui/gorte

Quick Start

Add this import line to the file you're working in:

import "github.com/dhia-gharsallaoui/gorte"

Client Authentication

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})

Usage

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)

Available APIs

Consumption

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)

Exchanges

Not implemented yet.

Generation

Market

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) 

Partners

Not implemented yet.

Enjoy Coding

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)
        }
}

Todo

  • Tests
  • Add other RTE API

Issues

Sponsored by

Skilld

About

A Go RTE API client enabling Go programs to interact with RTE APIs in a simple and uniform way.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages