Tink.Statistics (Tink v1.0.0)

Copy Markdown View Source

Aggregated spending statistics. Requires statistics:read scope.

Query results are cached 1 hour per user+query combination.

Summary

Functions

Query statistics by period, type, and resolution. Cached 1 hour per user.

Functions

query(client, opts \\ [])

@spec query(
  Tink.Client.t(),
  keyword()
) :: {:ok, map()} | {:error, Tink.Error.t()}

Query statistics by period, type, and resolution. Cached 1 hour per user.

Options

  • :period_mode"MONTHLY", "QUARTERLY", "YEARLY"
  • :statistic_types — list e.g. ["EXPENSES_BY_CATEGORY", "INCOME_BY_CATEGORY"]
  • :resolution"MONTHLY", "QUARTERLY", "YEARLY"
  • :period_start — e.g. "2024-01"
  • :period_end — e.g. "2024-12"
  • :currency — ISO 4217 currency code

Example

Tink.Statistics.query(client,
  statistic_types: ["EXPENSES_BY_CATEGORY"],
  resolution: "MONTHLY",
  period_start: "2024-01",
  period_end: "2024-12"
)