# Performance and Data Querying

There are several endpoints in our API that support querying data over time. These include two distinct groups:

1. discrete events (e.g., transactions)
2. continuous values (e.g., plan balance, average contribution rate over all employees, etc.)


We support querying across these data in the following ways:

| Data type | `Get` | `List` |
|  --- | --- | --- |
| **Discrete** | fetch by unique ID where available | time range (`IntervalRequest`) |
| **Continuous** | date, optional, defaults to now | time range + granularity (`NonDiscreteIntervalRequest`) |


### IntervalRequest

```protobuf
message IntervalRequest {
  optional Date start_date = 1;
  optional Date end_date = 2;
}
```

### NonDiscreteIntervalRequest

The NDIR requests data for a particular interval, but also requests a specific cadence over that interval. Endpoints that include this as a query option will return a series of snapshots based on the defined interval.  E.g., requesting account performance with a `WEEKLY` cadence will return a list of performance statistics at weekly intervals. This is often paired with a `LookbackType` (see below), which allows users to request performance to date or per period where applicable.

```protobuf
message NonDiscreteIntervalRequest {
  enum Cadence {
    UNKNOWN_CADENCE = 0;
    MONTHLY = 1;
    WEEKLY = 2;
    DAILY = 3;
    ANNUALLY = 4;
  }

  IntervalRequest interval = 1;
  Cadence granularity = 2;
}
```

### LookbackType

```protobuf
enum LookbackType {
  UNKNOWN_LOOKBACK = 0;
  TO_DATE = 1;
  PER_PERIOD = 2;
}
```