Skip to main content

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​

FieldTypeDescription
buckettimestamptzTime bucket start
term_idStringTerm ID
curve_idnumericBonding curve ID
first_share_pricenumericOpening price for the period
last_share_pricenumericClosing price for the period
differencenumericPrice change (last - first)
change_countnumericNumber of price changes in the period

Relationships​

FieldTypeDescription
termtermsAssociated term entity

Available Tables​

  • share_price_change_stats_hourly
  • share_price_change_stats_daily
  • share_price_change_stats_weekly
  • share_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​

FieldTypeDescription
buckettimestamptzTime bucket start
term_idStringTerm ID
curve_idnumericBonding curve ID
countnumericNumber of signals in the period
volumenumericTotal signal volume (assets)

Relationships​

FieldTypeDescription
termtermsAssociated term entity

Available Tables​

  • signal_stats_hourly
  • signal_stats_daily
  • signal_stats_weekly
  • signal_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​

FieldTypeDescription
buckettimestamptzTime bucket start
term_idStringTerm ID
first_total_market_capnumericOpening total market cap
last_total_market_capnumericClosing total market cap
differencenumericMarket cap change (last - first)

Available Tables​

  • term_total_state_change_stats_hourly
  • term_total_state_change_stats_daily
  • term_total_state_change_stats_weekly
  • term_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
}
}
FieldTypeNullableDescription
term_idStringNoTerm ID
total_assetsnumericNoTotal assets at this point
total_market_capnumericNoTotal market cap at this point
created_attimestamptzNoTimestamp 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​

GranularityUse Case
HourlyIntraday charts, recent activity monitoring
DailyStandard charts, daily reports
WeeklyTrend analysis, weekly summaries
MonthlyLong-term trends, monthly reports

Best Practices​

  1. Use pre-computed tables instead of aggregating raw events client-side
  2. Choose appropriate granularity for your time range β€” hourly for < 7 days, daily for < 90 days, weekly/monthly for longer
  3. Order by bucket for chronological data
  4. Filter by term_id (and curve_id where applicable) to scope results
  5. Use limit to bound the time window