Time-Series Analysis
The API provides pre-computed time-series tables (TimescaleDB continuous aggregates) for efficient analytics. These are available at four granularities: hourly, daily, weekly, and monthly.
Share Price Change Statsβ
Track share price movements over time for any term/curve combination.
query GetDailyPriceStats($termId: String!, $curveId: numeric!, $limit: Int!) {
share_price_change_stats_daily(
where: {
term_id: { _eq: $termId }
curve_id: { _eq: $curveId }
}
order_by: { bucket: desc }
limit: $limit
) {
bucket
term_id
curve_id
first_share_price
last_share_price
difference
change_count
}
}
Fieldsβ
| Field | Type | Description |
|---|---|---|
bucket | timestamptz | Time bucket start |
term_id | String | Term ID |
curve_id | numeric | Bonding curve ID |
first_share_price | numeric | Opening price for the period |
last_share_price | numeric | Closing price for the period |
difference | numeric | Price change (last - first) |
change_count | numeric | Number of price changes in the period |
Relationshipsβ
| Field | Type | Description |
|---|---|---|
term | terms | Associated term entity |
Available Tablesβ
share_price_change_stats_hourlyshare_price_change_stats_dailyshare_price_change_stats_weeklyshare_price_change_stats_monthly
All four share the same field structure.
Signal Statsβ
Track signal volume (deposits and redemptions) over time.
query GetDailySignalStats($termId: String!, $curveId: numeric!, $limit: Int!) {
signal_stats_daily(
where: {
term_id: { _eq: $termId }
curve_id: { _eq: $curveId }
}
order_by: { bucket: desc }
limit: $limit
) {
bucket
term_id
curve_id
count
volume
}
}
Fieldsβ
| Field | Type | Description |
|---|---|---|
bucket | timestamptz | Time bucket start |
term_id | String | Term ID |
curve_id | numeric | Bonding curve ID |
count | numeric | Number of signals in the period |
volume | numeric | Total signal volume (assets) |
Relationshipsβ
| Field | Type | Description |
|---|---|---|
term | terms | Associated term entity |
Available Tablesβ
signal_stats_hourlysignal_stats_dailysignal_stats_weeklysignal_stats_monthly
Term Total State Change Statsβ
Track total market cap changes for a term over time. Unlike share price and signal stats, these tables do not have a curve_id β they aggregate across all curves for a term.
query GetDailyStateStats($termId: String!, $limit: Int!) {
term_total_state_change_stats_daily(
where: { term_id: { _eq: $termId } }
order_by: { bucket: desc }
limit: $limit
) {
bucket
term_id
first_total_market_cap
last_total_market_cap
difference
}
}
Fieldsβ
| Field | Type | Description |
|---|---|---|
bucket | timestamptz | Time bucket start |
term_id | String | Term ID |
first_total_market_cap | numeric | Opening total market cap |
last_total_market_cap | numeric | Closing total market cap |
difference | numeric | Market cap change (last - first) |
Available Tablesβ
term_total_state_change_stats_hourlyterm_total_state_change_stats_dailyterm_total_state_change_stats_weeklyterm_total_state_change_stats_monthly
Raw State Changesβ
The base table term_total_state_changes stores every individual state change:
query GetStateChanges($termId: String!, $limit: Int!) {
term_total_state_changes(
where: { term_id: { _eq: $termId } }
order_by: { created_at: desc }
limit: $limit
) {
term_id
total_assets
total_market_cap
created_at
}
}
| Field | Type | Nullable | Description |
|---|---|---|---|
term_id | String | No | Term ID |
total_assets | numeric | No | Total assets at this point |
total_market_cap | numeric | No | Total market cap at this point |
created_at | timestamptz | No | Timestamp of the state change |
Interactive Exampleβ
Query
query GetDailyPriceStats($termId: String!, $curveId: numeric!, $limit: Int!) {
share_price_change_stats_daily(
where: {
term_id: { _eq: $termId }
curve_id: { _eq: $curveId }
}
order_by: { bucket: desc }
limit: $limit
) {
bucket
first_share_price
last_share_price
difference
change_count
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Choosing Granularityβ
| Granularity | Use Case |
|---|---|
| Hourly | Intraday charts, recent activity monitoring |
| Daily | Standard charts, daily reports |
| Weekly | Trend analysis, weekly summaries |
| Monthly | Long-term trends, monthly reports |
Best Practicesβ
- Use pre-computed tables instead of aggregating raw events client-side
- Choose appropriate granularity for your time range β hourly for < 7 days, daily for < 90 days, weekly/monthly for longer
- Order by
bucketfor chronological data - Filter by
term_id(andcurve_idwhere applicable) to scope results - Use
limitto bound the time window
Relatedβ
- Share Price Changes - Raw share price change events
- Position Changes - Daily/hourly position change aggregates
- Aggregations - Custom aggregations on any table