> For the complete documentation index, see [llms.txt](https://docs.chainargos.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chainargos.com/documentation/api/google_sheets/ygg_stats.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chainargos.com/documentation/api/google_sheets/ygg_stats.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
