diff --git a/tutorials/FundingMetrics.ipynb b/tutorials/FundingMetrics.ipynb
new file mode 100644
index 00000000..d64c4876
--- /dev/null
+++ b/tutorials/FundingMetrics.ipynb
@@ -0,0 +1,1192 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "41b714c9-c749-4d0d-ad59-71e0c035d325",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# ! pip install pyoso"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "413d143d-4494-4812-8cae-d28f47cc397e",
+ "metadata": {},
+ "source": [
+ "## Setup\n",
+ "\n",
+ "Load environment variables, import necessary libraries, and initialize the OSO client"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "988cd219-8b29-469d-9e7a-46f7a965ddc7",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from dotenv import load_dotenv\n",
+ "import os\n",
+ "import pandas as pd\n",
+ "from pyoso import Client\n",
+ "\n",
+ "load_dotenv()\n",
+ "\n",
+ "OSO_API_KEY = os.environ['OSO_API_KEY']\n",
+ "client = Client(api_key=OSO_API_KEY)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4231b926-89ab-48de-8746-b0d10f44c470",
+ "metadata": {},
+ "source": [
+ "## Testing\n",
+ "\n",
+ "Query the metrics table for all metric names containing '_funding_' and display them in alphabetical order"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "77fe6763-7d49-47a5-b5c6-68264034ab0c",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " metric_name | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_biannually | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_daily | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_monthly | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_over_all_time | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_quarterly | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_weekly | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_yearly | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " GITCOIN_MATCHING_funding_awarded_biannually | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " GITCOIN_MATCHING_funding_awarded_daily | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " GITCOIN_MATCHING_funding_awarded_monthly | \n",
+ "
\n",
+ " \n",
+ " | 10 | \n",
+ " GITCOIN_MATCHING_funding_awarded_over_all_time | \n",
+ "
\n",
+ " \n",
+ " | 11 | \n",
+ " GITCOIN_MATCHING_funding_awarded_quarterly | \n",
+ "
\n",
+ " \n",
+ " | 12 | \n",
+ " GITCOIN_MATCHING_funding_awarded_weekly | \n",
+ "
\n",
+ " \n",
+ " | 13 | \n",
+ " GITCOIN_MATCHING_funding_awarded_yearly | \n",
+ "
\n",
+ " \n",
+ " | 14 | \n",
+ " OPEN_COLLECTIVE_funding_received_biannually | \n",
+ "
\n",
+ " \n",
+ " | 15 | \n",
+ " OPEN_COLLECTIVE_funding_received_daily | \n",
+ "
\n",
+ " \n",
+ " | 16 | \n",
+ " OPEN_COLLECTIVE_funding_received_monthly | \n",
+ "
\n",
+ " \n",
+ " | 17 | \n",
+ " OPEN_COLLECTIVE_funding_received_over_all_time | \n",
+ "
\n",
+ " \n",
+ " | 18 | \n",
+ " OPEN_COLLECTIVE_funding_received_quarterly | \n",
+ "
\n",
+ " \n",
+ " | 19 | \n",
+ " OPEN_COLLECTIVE_funding_received_weekly | \n",
+ "
\n",
+ " \n",
+ " | 20 | \n",
+ " OPEN_COLLECTIVE_funding_received_yearly | \n",
+ "
\n",
+ " \n",
+ " | 21 | \n",
+ " OSS_FUNDING_funding_awarded_biannually | \n",
+ "
\n",
+ " \n",
+ " | 22 | \n",
+ " OSS_FUNDING_funding_awarded_daily | \n",
+ "
\n",
+ " \n",
+ " | 23 | \n",
+ " OSS_FUNDING_funding_awarded_monthly | \n",
+ "
\n",
+ " \n",
+ " | 24 | \n",
+ " OSS_FUNDING_funding_awarded_over_all_time | \n",
+ "
\n",
+ " \n",
+ " | 25 | \n",
+ " OSS_FUNDING_funding_awarded_quarterly | \n",
+ "
\n",
+ " \n",
+ " | 26 | \n",
+ " OSS_FUNDING_funding_awarded_weekly | \n",
+ "
\n",
+ " \n",
+ " | 27 | \n",
+ " OSS_FUNDING_funding_awarded_yearly | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " metric_name\n",
+ "0 GITCOIN_DONATIONS_funding_awarded_biannually\n",
+ "1 GITCOIN_DONATIONS_funding_awarded_daily\n",
+ "2 GITCOIN_DONATIONS_funding_awarded_monthly\n",
+ "3 GITCOIN_DONATIONS_funding_awarded_over_all_time\n",
+ "4 GITCOIN_DONATIONS_funding_awarded_quarterly\n",
+ "5 GITCOIN_DONATIONS_funding_awarded_weekly\n",
+ "6 GITCOIN_DONATIONS_funding_awarded_yearly\n",
+ "7 GITCOIN_MATCHING_funding_awarded_biannually\n",
+ "8 GITCOIN_MATCHING_funding_awarded_daily\n",
+ "9 GITCOIN_MATCHING_funding_awarded_monthly\n",
+ "10 GITCOIN_MATCHING_funding_awarded_over_all_time\n",
+ "11 GITCOIN_MATCHING_funding_awarded_quarterly\n",
+ "12 GITCOIN_MATCHING_funding_awarded_weekly\n",
+ "13 GITCOIN_MATCHING_funding_awarded_yearly\n",
+ "14 OPEN_COLLECTIVE_funding_received_biannually\n",
+ "15 OPEN_COLLECTIVE_funding_received_daily\n",
+ "16 OPEN_COLLECTIVE_funding_received_monthly\n",
+ "17 OPEN_COLLECTIVE_funding_received_over_all_time\n",
+ "18 OPEN_COLLECTIVE_funding_received_quarterly\n",
+ "19 OPEN_COLLECTIVE_funding_received_weekly\n",
+ "20 OPEN_COLLECTIVE_funding_received_yearly\n",
+ "21 OSS_FUNDING_funding_awarded_biannually\n",
+ "22 OSS_FUNDING_funding_awarded_daily\n",
+ "23 OSS_FUNDING_funding_awarded_monthly\n",
+ "24 OSS_FUNDING_funding_awarded_over_all_time\n",
+ "25 OSS_FUNDING_funding_awarded_quarterly\n",
+ "26 OSS_FUNDING_funding_awarded_weekly\n",
+ "27 OSS_FUNDING_funding_awarded_yearly"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "client.to_pandas(\"\"\"\n",
+ "SELECT metric_name\n",
+ "FROM metrics_v0\n",
+ "WHERE metric_name LIKE '%_funding_%'\n",
+ "ORDER BY 1\n",
+ "\"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e85f23d4-3605-40f6-8228-ce175de20f30",
+ "metadata": {},
+ "source": [
+ "## Aggregate funding metrics\n",
+ "\n",
+ "### By source\n",
+ "\n",
+ "We currently support CSV data uploads via [oss-funding](https://github.com/opensource-observer/oss-funding) and Gitcoin Grants. We also have Open Collective deposits, but they don't show up here (yet)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "aa31b0d1-2117-4fb0-8b6e-f206500602d2",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " metric_name | \n",
+ " total_amount_in_usd | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " OSS_FUNDING_funding_awarded_over_all_time | \n",
+ " 364887873.600968 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " GITCOIN_MATCHING_funding_awarded_over_all_time | \n",
+ " 13305117.158144 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " GITCOIN_DONATIONS_funding_awarded_over_all_time | \n",
+ " 11666103.711711 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " metric_name total_amount_in_usd\n",
+ "0 OSS_FUNDING_funding_awarded_over_all_time 364887873.600968\n",
+ "1 GITCOIN_MATCHING_funding_awarded_over_all_time 13305117.158144\n",
+ "2 GITCOIN_DONATIONS_funding_awarded_over_all_time 11666103.711711"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "client.to_pandas(\"\"\"\n",
+ "SELECT\n",
+ " m.metric_name,\n",
+ " SUM(km.amount) AS total_amount_in_usd\n",
+ "FROM key_metrics_by_project_v0 AS km\n",
+ "JOIN metrics_v0 AS m ON km.metric_id = m.metric_id\n",
+ "WHERE m.metric_name LIKE '%_funding_%'\n",
+ "GROUP BY 1\n",
+ "ORDER BY 2 DESC\n",
+ "\"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0d2902b8-468b-44ae-bae9-d797ec18de0d",
+ "metadata": {},
+ "source": [
+ "### To projects\n",
+ "\n",
+ "We can also see the largest project recipients with this query."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "c9edc7a4-19d1-443c-bc01-ced2c6ffda65",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " project_display_name | \n",
+ " total_amount_in_usd | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " GMX | \n",
+ " 21000000.0 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " MUX Protocol | \n",
+ " 10876479.0 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Synthetix | \n",
+ " 10022628.074157 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Perpetual Protocol | \n",
+ " 9287212.140718 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Gains Network | \n",
+ " 7898396.135 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " Velodrome | \n",
+ " 7895037.76024 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " Camelot | \n",
+ " 5407500.0 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " Stargate Finance | \n",
+ " 5289458.865658 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " Vertex Protocol | \n",
+ " 5250000.0 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " Radiant | \n",
+ " 4991077.0 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " project_display_name total_amount_in_usd\n",
+ "0 GMX 21000000.0\n",
+ "1 MUX Protocol 10876479.0\n",
+ "2 Synthetix 10022628.074157\n",
+ "3 Perpetual Protocol 9287212.140718\n",
+ "4 Gains Network 7898396.135\n",
+ "5 Velodrome 7895037.76024\n",
+ "6 Camelot 5407500.0\n",
+ "7 Stargate Finance 5289458.865658\n",
+ "8 Vertex Protocol 5250000.0\n",
+ "9 Radiant 4991077.0"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "client.to_pandas(\"\"\"\n",
+ "SELECT\n",
+ " p.display_name AS project_display_name,\n",
+ " SUM(km.amount) AS total_amount_in_usd\n",
+ "FROM key_metrics_by_project_v0 AS km\n",
+ "JOIN metrics_v0 AS m ON km.metric_id = m.metric_id\n",
+ "JOIN projects_v1 AS p ON km.project_id = p.project_id\n",
+ "WHERE m.metric_name LIKE '%_funding_awarded_over_all_time'\n",
+ "GROUP BY 1\n",
+ "ORDER BY 2 DESC\n",
+ "LIMIT 10\n",
+ "\"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0841ca11-505d-47bc-acdc-5ca8314af991",
+ "metadata": {},
+ "source": [
+ "### To projects from a specific source"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "9783c7e0-c2e0-4f1c-9dda-42d458cb39ce",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " project_display_name | \n",
+ " total_amount_in_usd | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Gitcoin | \n",
+ " 1099895.038376 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Revoke | \n",
+ " 748859.365745 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " DefiLlama | \n",
+ " 429924.507285 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Hey | \n",
+ " 360529.24178 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " JediSwap | \n",
+ " 333277.670918 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " Dark Forest | \n",
+ " 332205.420888 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " ZigZag Exchange | \n",
+ " 210175.931949 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " ethers.js | \n",
+ " 190702.539836 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " rotki | \n",
+ " 174990.340416 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " Taho | \n",
+ " 170854.869607 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " project_display_name total_amount_in_usd\n",
+ "0 Gitcoin 1099895.038376\n",
+ "1 Revoke 748859.365745\n",
+ "2 DefiLlama 429924.507285\n",
+ "3 Hey 360529.24178\n",
+ "4 JediSwap 333277.670918\n",
+ "5 Dark Forest 332205.420888\n",
+ "6 ZigZag Exchange 210175.931949\n",
+ "7 ethers.js 190702.539836\n",
+ "8 rotki 174990.340416\n",
+ "9 Taho 170854.869607"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "client.to_pandas(\"\"\"\n",
+ "SELECT\n",
+ " p.display_name AS project_display_name,\n",
+ " SUM(km.amount) AS total_amount_in_usd\n",
+ "FROM key_metrics_by_project_v0 AS km\n",
+ "JOIN metrics_v0 AS m ON km.metric_id = m.metric_id\n",
+ "JOIN projects_v1 AS p ON km.project_id = p.project_id\n",
+ "WHERE m.metric_name = 'GITCOIN_DONATIONS_funding_awarded_over_all_time'\n",
+ "GROUP BY 1\n",
+ "ORDER BY 2 DESC\n",
+ "LIMIT 10\n",
+ "\"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "807ac8df-5c90-4c14-821b-d29ebab1089c",
+ "metadata": {},
+ "source": [
+ "### To projects from a specific source and time frame"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "69f8d8ff-f902-4cce-bc3f-d23182f84de3",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " project_display_name | \n",
+ " total_amount_in_usd | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Gitcoin | \n",
+ " 797206.330376 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Dark Forest | \n",
+ " 297517.115925 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " ZigZag Exchange | \n",
+ " 199746.433382 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " ethers.js | \n",
+ " 129500.966707 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Prysm Ethereum Client | \n",
+ " 128522.705766 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " rotki | \n",
+ " 122666.927997 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " ZeroPool | \n",
+ " 116795.642612 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " Lighthouse by Sigma Prime | \n",
+ " 114759.839844 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " The Tor Project | \n",
+ " 110669.738113 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " Hardhat | \n",
+ " 110539.758225 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " project_display_name total_amount_in_usd\n",
+ "0 Gitcoin 797206.330376\n",
+ "1 Dark Forest 297517.115925\n",
+ "2 ZigZag Exchange 199746.433382\n",
+ "3 ethers.js 129500.966707\n",
+ "4 Prysm Ethereum Client 128522.705766\n",
+ "5 rotki 122666.927997\n",
+ "6 ZeroPool 116795.642612\n",
+ "7 Lighthouse by Sigma Prime 114759.839844\n",
+ "8 The Tor Project 110669.738113\n",
+ "9 Hardhat 110539.758225"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "client.to_pandas(\"\"\"\n",
+ "SELECT\n",
+ " p.display_name AS project_display_name,\n",
+ " SUM(tm.amount) AS total_amount_in_usd\n",
+ "FROM timeseries_metrics_by_project_v0 AS tm\n",
+ "JOIN metrics_v0 AS m ON tm.metric_id = m.metric_id\n",
+ "JOIN projects_v1 AS p ON tm.project_id = p.project_id\n",
+ "WHERE m.metric_name = 'GITCOIN_DONATIONS_funding_awarded_yearly'\n",
+ "AND tm.sample_date < DATE '2022-01-01'\n",
+ "GROUP BY 1\n",
+ "ORDER BY 2 DESC\n",
+ "LIMIT 10\n",
+ "\"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fe5ad20c-7772-4e94-83ec-77baea215d00",
+ "metadata": {},
+ "source": [
+ "## More granular analysis\n",
+ "\n",
+ "### Gitcoin\n",
+ "\n",
+ "Deep dive on Gitcoin grants to a specific project"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "60aa05c7-098f-4e6f-8183-a01fc5ed9652",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " time | \n",
+ " round_number | \n",
+ " round_name | \n",
+ " event_source | \n",
+ " donor_address | \n",
+ " amount_in_usd | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 2023-02-09 15:58:07.078 | \n",
+ " <NA> | \n",
+ " Gitcoin Grants | \n",
+ " GITCOIN_DONATIONS | \n",
+ " 0x386ea3171dcc9405311fd75b316cc2a87ecadeca | \n",
+ " 617893.575 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 2023-08-29 08:32:57.000 | \n",
+ " 18 | \n",
+ " Web3 Open Source Software | \n",
+ " GITCOIN_MATCHING | \n",
+ " <NA> | \n",
+ " 15001.1375 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 2024-11-25 14:26:59.000 | \n",
+ " 22 | \n",
+ " GG22 OSS - dApps and Apps | \n",
+ " GITCOIN_MATCHING | \n",
+ " <NA> | \n",
+ " 14984.28125 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 2024-05-31 14:35:02.000 | \n",
+ " 20 | \n",
+ " dApps & Apps | \n",
+ " GITCOIN_MATCHING | \n",
+ " <NA> | \n",
+ " 14979.978125 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 2023-11-29 20:18:47.000 | \n",
+ " 19 | \n",
+ " Web3 Open Source Software | \n",
+ " GITCOIN_MATCHING | \n",
+ " <NA> | \n",
+ " 14849.591509 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 2022-08-24 00:00:00.000 | \n",
+ " 15 | \n",
+ " <NA> | \n",
+ " GITCOIN_MATCHING | \n",
+ " <NA> | \n",
+ " 12500.0 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 2024-08-26 15:19:00.000 | \n",
+ " 21 | \n",
+ " GG21: Thriving Arbitrum Summer | \n",
+ " GITCOIN_MATCHING | \n",
+ " <NA> | \n",
+ " 9839.680095 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 2022-08-24 00:00:00.000 | \n",
+ " 15 | \n",
+ " <NA> | \n",
+ " GITCOIN_MATCHING | \n",
+ " <NA> | \n",
+ " 7410.488854 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 2024-05-07 10:04:49.000 | \n",
+ " 20 | \n",
+ " dApps & Apps | \n",
+ " GITCOIN_DONATIONS | \n",
+ " 0xe2a26d5174b133abc4b338df1b07295f03a4c85e | \n",
+ " 1000.42865 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 2024-05-06 17:29:47.000 | \n",
+ " 20 | \n",
+ " dApps & Apps | \n",
+ " GITCOIN_DONATIONS | \n",
+ " 0x60a06b2eee871e349331143ef173ecefd7a8ce01 | \n",
+ " 537.338562 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " time round_number round_name \\\n",
+ "0 2023-02-09 15:58:07.078 Gitcoin Grants \n",
+ "1 2023-08-29 08:32:57.000 18 Web3 Open Source Software \n",
+ "2 2024-11-25 14:26:59.000 22 GG22 OSS - dApps and Apps \n",
+ "3 2024-05-31 14:35:02.000 20 dApps & Apps \n",
+ "4 2023-11-29 20:18:47.000 19 Web3 Open Source Software \n",
+ "5 2022-08-24 00:00:00.000 15 \n",
+ "6 2024-08-26 15:19:00.000 21 GG21: Thriving Arbitrum Summer \n",
+ "7 2022-08-24 00:00:00.000 15 \n",
+ "8 2024-05-07 10:04:49.000 20 dApps & Apps \n",
+ "9 2024-05-06 17:29:47.000 20 dApps & Apps \n",
+ "\n",
+ " event_source donor_address \\\n",
+ "0 GITCOIN_DONATIONS 0x386ea3171dcc9405311fd75b316cc2a87ecadeca \n",
+ "1 GITCOIN_MATCHING \n",
+ "2 GITCOIN_MATCHING \n",
+ "3 GITCOIN_MATCHING \n",
+ "4 GITCOIN_MATCHING \n",
+ "5 GITCOIN_MATCHING \n",
+ "6 GITCOIN_MATCHING \n",
+ "7 GITCOIN_MATCHING \n",
+ "8 GITCOIN_DONATIONS 0xe2a26d5174b133abc4b338df1b07295f03a4c85e \n",
+ "9 GITCOIN_DONATIONS 0x60a06b2eee871e349331143ef173ecefd7a8ce01 \n",
+ "\n",
+ " amount_in_usd \n",
+ "0 617893.575 \n",
+ "1 15001.1375 \n",
+ "2 14984.28125 \n",
+ "3 14979.978125 \n",
+ "4 14849.591509 \n",
+ "5 12500.0 \n",
+ "6 9839.680095 \n",
+ "7 7410.488854 \n",
+ "8 1000.42865 \n",
+ "9 537.338562 "
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "client.to_pandas(\"\"\"\n",
+ " SELECT\n",
+ " time,\n",
+ " round_number,\n",
+ " round_name,\n",
+ " event_source,\n",
+ " donor_address,\n",
+ " amount_in_usd\n",
+ " FROM int_events__gitcoin_funding\n",
+ " WHERE gitcoin_group_project_name = 'revokecash'\n",
+ " ORDER BY amount_in_usd DESC\n",
+ " LIMIT 10\n",
+ "\"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "144e833e-cf24-4659-a43b-35505d95501a",
+ "metadata": {},
+ "source": [
+ "## OSS Funding\n",
+ "\n",
+ "Overview of specific funders and grant pools in oss-funding data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "fa50c103-7c3c-4fb2-bcb1-ff754a8b53f6",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " from_funder_name | \n",
+ " grant_pools | \n",
+ " amount_in_usd | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " optimism | \n",
+ " 12 | \n",
+ " 240450291.744 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " arbitrumfoundation | \n",
+ " 1 | \n",
+ " 122850952.0 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " stellar | \n",
+ " 29 | \n",
+ " 32989032.98 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " octant-golemfoundation | \n",
+ " 5 | \n",
+ " 3965429.51329 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " dao-drops-dorgtech | \n",
+ " 1 | \n",
+ " 250001.0 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " clrfund | \n",
+ " 1 | \n",
+ " 83028.740386 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " from_funder_name grant_pools amount_in_usd\n",
+ "0 optimism 12 240450291.744\n",
+ "1 arbitrumfoundation 1 122850952.0\n",
+ "2 stellar 29 32989032.98\n",
+ "3 octant-golemfoundation 5 3965429.51329\n",
+ "4 dao-drops-dorgtech 1 250001.0\n",
+ "5 clrfund 1 83028.740386"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "client.to_pandas(\"\"\"\n",
+ "SELECT\n",
+ " from_funder_name,\n",
+ " COUNT(DISTINCT grant_pool_name) AS grant_pools,\n",
+ " SUM(amount) AS amount_in_usd\n",
+ "FROM stg_ossd__current_funding\n",
+ "GROUP BY 1\n",
+ "ORDER BY 3 DESC\n",
+ "\"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f7aaf46c-45b8-444e-a6f1-27286085a463",
+ "metadata": {},
+ "source": [
+ "## Funding flows\n",
+ "\n",
+ "We can use this to construct a simple sankey diagram of funding flows"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "1bd3a7a8-8cac-420e-9e7b-5259ff0e3b2d",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " from_project_id | \n",
+ " to_project_id | \n",
+ " funder | \n",
+ " project | \n",
+ " amount | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 2142 | \n",
+ " Qgbm336fY9862LN2Czg3UX04A3p7I/79Bv2M4D61DAI= | \n",
+ " 8IKXraxq1pDuQD1xaDI20cjFrel55TZ/zf6LmP69qEg= | \n",
+ " Gitcoin | \n",
+ " efdevcon | \n",
+ " 13.531599 | \n",
+ "
\n",
+ " \n",
+ " | 2143 | \n",
+ " Qgbm336fY9862LN2Czg3UX04A3p7I/79Bv2M4D61DAI= | \n",
+ " 79HQoZtyZftibazh6Yz63aU06XODWs7b/9h4JAqPa1s= | \n",
+ " Gitcoin | \n",
+ " LexDAO | \n",
+ " 86499.728685 | \n",
+ "
\n",
+ " \n",
+ " | 2144 | \n",
+ " 5Fgf9xv3CxTV+YbSShdY9XCJs7tgW8KNwQWq9rHUEsQ= | \n",
+ " 79HQoZtyZftibazh6Yz63aU06XODWs7b/9h4JAqPa1s= | \n",
+ " clr.fund | \n",
+ " LexDAO | \n",
+ " 193.952856 | \n",
+ "
\n",
+ " \n",
+ " | 2145 | \n",
+ " Qgbm336fY9862LN2Czg3UX04A3p7I/79Bv2M4D61DAI= | \n",
+ " yEebFy4M1iAdb9+YQmdssSx9Qf+ZXfSVguL/JyidngI= | \n",
+ " Gitcoin | \n",
+ " DeFiEye | \n",
+ " 224058.115245 | \n",
+ "
\n",
+ " \n",
+ " | 2146 | \n",
+ " 5Fgf9xv3CxTV+YbSShdY9XCJs7tgW8KNwQWq9rHUEsQ= | \n",
+ " JQtLQErRk0u41xS292Cg+s3cRr8LaD5lQ2kME/Syp2Q= | \n",
+ " clr.fund | \n",
+ " Asilo Digital | \n",
+ " 703.639308 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " from_project_id \\\n",
+ "2142 Qgbm336fY9862LN2Czg3UX04A3p7I/79Bv2M4D61DAI= \n",
+ "2143 Qgbm336fY9862LN2Czg3UX04A3p7I/79Bv2M4D61DAI= \n",
+ "2144 5Fgf9xv3CxTV+YbSShdY9XCJs7tgW8KNwQWq9rHUEsQ= \n",
+ "2145 Qgbm336fY9862LN2Czg3UX04A3p7I/79Bv2M4D61DAI= \n",
+ "2146 5Fgf9xv3CxTV+YbSShdY9XCJs7tgW8KNwQWq9rHUEsQ= \n",
+ "\n",
+ " to_project_id funder project \\\n",
+ "2142 8IKXraxq1pDuQD1xaDI20cjFrel55TZ/zf6LmP69qEg= Gitcoin efdevcon \n",
+ "2143 79HQoZtyZftibazh6Yz63aU06XODWs7b/9h4JAqPa1s= Gitcoin LexDAO \n",
+ "2144 79HQoZtyZftibazh6Yz63aU06XODWs7b/9h4JAqPa1s= clr.fund LexDAO \n",
+ "2145 yEebFy4M1iAdb9+YQmdssSx9Qf+ZXfSVguL/JyidngI= Gitcoin DeFiEye \n",
+ "2146 JQtLQErRk0u41xS292Cg+s3cRr8LaD5lQ2kME/Syp2Q= clr.fund Asilo Digital \n",
+ "\n",
+ " amount \n",
+ "2142 13.531599 \n",
+ "2143 86499.728685 \n",
+ "2144 193.952856 \n",
+ "2145 224058.115245 \n",
+ "2146 703.639308 "
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "query = \"\"\"\n",
+ "SELECT\n",
+ " fp.project_id AS from_project_id,\n",
+ " tp.project_id AS to_project_id,\n",
+ " fp.display_name AS funder,\n",
+ " tp.display_name AS project,\n",
+ " SUM(e.amount) AS amount\n",
+ "FROM int_events_daily__funding AS e\n",
+ "JOIN artifacts_by_project_v1 AS fa\n",
+ " ON e.from_artifact_id = fa.artifact_id\n",
+ "JOIN artifacts_by_project_v1 AS ta\n",
+ " ON e.to_artifact_id = ta.artifact_id\n",
+ "JOIN projects_v1 AS fp\n",
+ " ON fa.project_id = fp.project_id\n",
+ "JOIN projects_v1 AS tp\n",
+ " ON ta.project_id = tp.project_id\n",
+ "GROUP BY 1,2,3,4\n",
+ "\"\"\"\n",
+ "df = client.to_pandas(query)\n",
+ "df.tail()"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.11.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}