# Data Analysis

<details>

<summary><strong>Top Expense Categories This Quarter</strong></summary>

**The Script**

bash

```bash
#!/bin/bash
# top-expense-categories.sh

QUARTER_START="2026-01-01"
QUARTER_END="2026-03-31"

echo "Top Expense Categories: $QUARTER_START to $QUARTER_END"
echo ""

kick transactions list \
  --from="$QUARTER_START" \
  --to="$QUARTER_END" \
  --filter="amount<0" \
  --format=json | \
jq -r '
  group_by(.category) |
  map({
    category: .[0].category // "Uncategorized",
    total: (map(.amount) | add),
    count: length
  }) |
  sort_by(.total) |
  .[] |
  "\(.category): $\(.total | fabs) (\(.count) transactions)"
'
```

**How to Customize**

* Change to revenue categories
* Group by counterparty instead
* Add percentage of total

**What It Outputs**

```
Cloud Infrastructure: $12,500.00 (36 transactions)
Payroll: $75,000.00 (3 transactions)
```

</details>

<details>

<summary><strong>Cash Flow Trend Analysis</strong></summary>

**The Script**

bash

```bash
#!/bin/bash
# cash-flow-trends.sh

START_DATE="2026-01-01"
END_DATE="2026-03-31"

echo "Week Starting,Inflows,Outflows,Net"

kick transactions list \
  --from="$START_DATE" \
  --to="$END_DATE" \
  --format=json | \
jq -r '
  group_by(.date[0:10] | strptime("%Y-%m-%d") | strftime("%Y-W%U")) |
  map({
    week: (.[0].date[0:10] | strptime("%Y-%m-%d") | strftime("%Y-%m-%d")),
    inflows: (map(select(.amount > 0) | .amount) | add // 0),
    outflows: (map(select(.amount < 0) | .amount | fabs) | add // 0)
  }) |
  map("\(.week),\(.inflows),\(.outflows),\(.inflows - .outflows)") |
  .[]
'
```

**How to Customize**

* Change to monthly instead of weekly
* Add rolling averages
* Export to CSV for charting

**What It Outputs**

```
Week Starting,Inflows,Outflows,Net
2026-01-06,25000.00,18500.00,6500.00
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kick.co/ai/kick-cli/cli-use-case-library/data-analysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
