# Skill Grid Singularity - Cariflex Energy

## Description
Intégration des outils Grid Singularity (GSy) pour le projet Carifflex.
Grid Singularity est une plateforme open source pour les marchés décentralisés d'énergie.

## Source
https://github.com/gridsingularity

## Repos principaux

| Repo | Description | Stars | Langage |
|------|-------------|-------|---------|
| `gsy-e` | Grid Singularity Energy Exchange | 88 | Python |
| `gsy-framework` | GSy services framework | 8 | Python |
| `gsy-e-sdk` | Client SDK for Grid Singularity Exchange | 3 | Python |
| `gsy-matching-engine-sdk` | SDK for Myco matching agents | 0 | Python |
| `gsy-decentralized-exchange` | Decentralized Energy Exchange | 0 | Rust |

## Installation

### 1. Cloner les repos
```bash
cd /home/eric/cariflex/tools

# Energy Exchange (principal)
git clone --depth 1 https://github.com/gridsingularity/gsy-e.git

# Framework
git clone --depth 1 https://github.com/gridsingularity/gsy-framework.git

# SDK
git clone --depth 1 https://github.com/gridsingularity/gsy-e-sdk.git
```

### 2. Installation gsy-e
```bash
cd gsy-e
pip install -e .
```

### 3. Installation SDK
```bash
cd gsy-e-sdk
pip install -e .
```

## Architecture Grid Singularity

### Composants
| Composant | Rôle |
|-----------|------|
| **Energy Exchange** | Marché décentralisé d'énergie |
| **Matching Engine** | Appariement offres/demands |
| **SDK Client** | Interface pour participants |
| **Blockchain DEX** | Transactions décentralisées |

### Intégration Cariflex
```
Cariflex CEM → gsy-e-sdk → Grid Singularity Exchange
                                    ↓
                              Matching Engine
                                    ↓
                              Flex Schedules
```

## Utilisation SDK

### Connexion au Exchange
```python
from gsy_e_sdk import GSyEClient

client = GSyEClient(
    gsy_e_api_url="https://api.gsy-e.io",
    username="cariflex",
    password="***"
)

# Submit buy/sell offers
client.submit_buy_offer(
    energy_kwh=100,
    price_eur_mwh=50,
    time_slot="2026-06-09T12:00:00Z"
)
```

### Récupérer les prix du marché
```python
market_prices = client.get_market_prices()
for slot in market_prices:
    print(f"{slot.time}: {slot.price} €/MWh")
```

## Liens
- GitHub: https://github.com/gridsingularity
- Energy Exchange: https://github.com/gridsingularity/gsy-e
- SDK: https://github.com/gridsingularity/gsy-e-sdk
- Documentation: https://gridsingularity.github.io/gsy-e/
