# Compute statistics on YGG flows

Here we compute statistics on per-day YGG outflows across all active wallets.

Generates a csv for a stacked bar chart across dates for fraction of outflows by wallet for each date compute the fraction of on-chain outflow for each 1/steps fraction of wallets starting from the largest.

If all the outflow is from a single wallet the stacked bar chart will have 1 value per bar if it is evenly distributed over 1/steps wallets you will get an even stack of n\_steps.

The csv can be used for a stacked bar chart in Excel, OpenOffice and the like. You probably want to skip the first column with total outflow on that date.

The Google Sheet [here](https://docs.google.com/spreadsheets/d/1ksitF87TXLb48yLZUqJrv1PwZ9UHGdGPcpAgIa5eYMw/) is used by the code. That sheet is publicly viewable (as this is a demo).

## Details

### Code

{% @github-files/github-code-block url="<https://github.com/ChainArgos/api-demos/blob/main/google-sheets/ygg_stats/example.py>" %}

### CSV Data

An example interim csv output is [here](https://github.com/ChainArgos/api-demos/blob/37e3d1d53a7b17a8f88552b3511febcb13fb1387/ygg_stats/data.csv).

### Final Spreadsheet

And one aggregation into a spreadsheet is [here](https://github.com/ChainArgos/api-demos/blob/f81cc3d88cc6527575cc260f182790d913a4dcf8/ygg_stats/stacked_bar_ygg.ods).


---

# 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.chainargos.com/documentation/api/google_sheets/ygg_stats.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.
