# Price Signals

Price signals are the time series of prices or costs that drive flex shape optimization. Push them whenever your upstream data changes — day-ahead auctions, forecasted imbalance, intra-day updates, any signal that changes how your portfolio should respond.One zone carries one price signal timeseries, covering whatever horizon you need to trade against.

## Pushing a Price Signal

```http
PUT /flex/price-signals/{zoneId}
Content-Type: application/json

{
  "currency": "EUR",
  "to": "2024-06-16T00:00:00Z",
  "values": [
    { "at": "2024-06-15T00:00:00Z", "price": 0.045 },
    { "at": "2024-06-15T01:00:00Z", "price": 0.038 },
    { "at": "2024-06-15T02:00:00Z", "price": 0.029 },
    { "at": "2024-06-15T06:00:00Z", "price": 0.052 },
    { "at": "2024-06-15T12:00:00Z", "price": 0.089 },
    { "at": "2024-06-15T18:00:00Z", "price": 0.142 }
  ]
}
```

A push specifies a **replacement window**. All existing data in the window `[firstValue.at, to)` is replaced with the provided values. Data outside the window is untouched. Use this to overwrite a forecast horizon repeatedly as new information arrives, without worrying about what you're clobbering.

Each value defines the price from its timestamp until the next value (or until `to` for the final value). In the example above, `0.045` applies from 00:00 to 01:00, `0.038` from 01:00 to 02:00, `0.029` from 02:00 to 06:00, and so on.

### Rules

- At least one value is required.
- Values must be in strictly ascending chronological order.
- The final value's `at` must be strictly before `to`.
- Timestamps must be UTC (ISO 8601 with a `Z` suffix or explicit offset).
- `currency` must match the currency already in use for the zone.

### Currency

A zone's currency is established implicitly by the first price input pushed for it — a price signal or a [tariff cost](https://flex.developers.enode.com/docs/tariffs/introduction). Every subsequent push must use the same ISO 4217 code. Think of the `currency` field as an explicit confirmation — it's there to catch misrouted integrations before they corrupt the zone's data, not as a general-purpose conversion knob. Mismatches are rejected.

## Reading a Price Signal

Retrieve the current price signal for a zone over a time range:

```http
GET /flex/price-signals/{zoneId}?from=2024-06-15T00:00:00Z&to=2024-06-16T00:00:00Z
```

```json
{
  "zoneId": "NO1",
  "currency": "EUR",
  "from": "2024-06-15T00:00:00Z",
  "to": "2024-06-16T00:00:00Z",
  "values": [
    { "at": "2024-06-15T00:00:00Z", "price": 0.045 },
    { "at": "2024-06-15T01:00:00Z", "price": 0.038 },
    { "at": "2024-06-15T02:00:00Z", "price": 0.029 },
    { "at": "2024-06-15T06:00:00Z", "price": 0.052 },
    { "at": "2024-06-15T12:00:00Z", "price": 0.089 },
    { "at": "2024-06-15T18:00:00Z", "price": 0.142 }
  ]
}
```

The response includes every value whose validity overlaps the requested range.


