Skip to content

Commit ea5ac37

Browse files
hagaetcgitbook-bot
authored andcommitted
GitBook: [dev] 40 pages and 7 assets modified
1 parent 388f6cc commit ea5ac37

File tree

17 files changed

+393
-10
lines changed

17 files changed

+393
-10
lines changed

.gitbook/assets/image (27).png

56.6 KB
Loading

.gitbook/assets/image (28).png

150 KB
Loading

.gitbook/assets/image (29).png

118 KB
Loading

.gitbook/assets/image (30).png

150 KB
Loading

.gitbook/assets/image (31).png

148 KB
Loading

.gitbook/assets/image (32).png

150 KB
Loading

.gitbook/assets/image (33).png

79.7 KB
Loading

SUMMARY.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
* [Prices](data-tables/data-tables/prices.md)
2828
* [Labels](data-tables/data-tables/labels.md)
2929

30-
## Query Handbook <a id="sample-queries"></a>
31-
32-
* [Queries](sample-queries/queries/README.md)
33-
* [Growth Rate](sample-queries/queries/growth-rate.md)
34-
* [Users and amount over a trailing period](sample-queries/queries/untitled-6.md)
35-
* [Filter query by an address in the interface](sample-queries/queries/untitled-5.md)
36-
* [Circulating supply over time of a token](sample-queries/queries/circ-supply.md)
37-
* [USD value of token utilised for an event](sample-queries/queries/untitled-3.md)
38-
* [USD price for a token from Uniswap](sample-queries/queries/untitled-2.md)
39-
* [Token \(and USD value\) per token over time for an address](sample-queries/queries/untitled-1.md)
30+
## Working on Dune
31+
32+
* [Parameters](working-on-dune/parameters.md)
33+
* [Query Handbook](working-on-dune/queries/README.md)
34+
* [Growth Rate](working-on-dune/queries/growth-rate.md)
35+
* [Users and amount over a trailing period](working-on-dune/queries/untitled-6.md)
36+
* [Filter query by an address in the interface](working-on-dune/queries/untitled-5.md)
37+
* [Circulating supply over time of a token](working-on-dune/queries/circ-supply.md)
38+
* [USD value of token utilised for an event](working-on-dune/queries/untitled-3.md)
39+
* [USD price for a token from Uniswap](working-on-dune/queries/untitled-2.md)
40+
* [Token \(and USD value\) per token over time for an address](working-on-dune/queries/untitled-1.md)
4041

4142
## FAQ
4243

working-on-dune/parameters.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
description: >-
3+
Parameters are an easy way to make an interactive dashboard or query in which
4+
multiple parameters/variables can change.
5+
---
6+
7+
# Parameters
8+
9+
### What are Parameters?
10+
11+
Parameters allow you to make changes to certain defined parameters of your code with a few simple clicks. Instead of hard coding `contract_address` , `symbol` or `date ranges` you can just use the parameter function to change these aspects of your code using a parameter. This allows you to build an interactive dashboard that the viewer can use to query for exactly the data he needs.
12+
13+
You can pass on input to the parameter below the query or at the top of your dashboard. Simply run the query or click `apply` in your dashboard to rerun the queries/dashboard with the newly put in parameters.
14+
15+
Parameters in a Dashboard can be shared between different queries, just make sure to use the same name between all of them.
16+
17+
![](../.gitbook/assets/image%20%2833%29.png)
18+
19+
![](../.gitbook/assets/image%20%2830%29.png)
20+
21+
![](../.gitbook/assets/image%20%2829%29.png)
22+
23+
### How to use Parameters?
24+
25+
You can simply add a parameter to your queries by writing `{{parametername}}` or using the button below the query. You can order them by prefacing them with the corresponding position you want the Parameter to appear in the User Interface : `{{1. parametername}}`.
26+
27+
You can edit the properties of single parameters by clicking on the litte gear wheel next to the parameter in the query editor. This allows you to set a default value, define a list of possible parameters and change the type of the parameter.
28+
29+
30+
31+
### Example Query
32+
33+
This query returns the running total of Gas Paid in USD.
34+
35+
The Query Author has chosen to include a parameter for `wallet address`, `start date` and `end date`.
36+
37+
```sql
38+
with alltransactions
39+
AS (
40+
SELECT
41+
block_time,
42+
success,
43+
gas_price/10^9 AS gas_prices,
44+
gas_used,
45+
(gas_price*gas_used)/10^18 AS eth_paid_for_tx,
46+
hash
47+
FROM ethereum.transactions
48+
WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea
49+
AND block_time >= '{{2. Start Date}}'
50+
AND block_time < '{{3. End Date}}')
51+
52+
SELECT
53+
date_trunc('minute', block_time),
54+
SUM(eth_paid_for_tx*price) over (ORDER BY date_trunc('minute', block_time)) AS "Total Gas Fees Paid in USD"
55+
FROM alltransactions
56+
LEFT JOIN
57+
(SELECT
58+
minute,
59+
price
60+
FROM prices.usd
61+
WHERE
62+
symbol = 'WETH' AND
63+
minute > '{{2. Start Date}}') AS prices
64+
ON date_trunc('minute', block_time) = minute
65+
ORDER BY block_time DESC
66+
```
67+
68+
Find this query [here](https://duneanalytics.com/queries/64430/128463)
69+
70+
### **Example Dashboards**
71+
72+
**Find interesting stats on Ethereum Wallets with this dashboard:**
73+
[https://duneanalytics.com/kevdnlol/Transaction-Breakdown](https://duneanalytics.com/kevdnlol/Transaction-Breakdown)
74+
75+
_The author has included the parameters `wallet address`, `start date` and `end date` in this Dashboard._
76+
77+
**Drill down into the single pools of Barnbridge's Smart Yield Product:**
78+
[https://duneanalytics.com/0xBoxer/Barnbridge-or-Smart-Yield](https://duneanalytics.com/0xBoxer/Barnbridge-or-Smart-Yield)
79+
80+
_The Author has chosen to make the parameter `poolsymbol` into a drop down list here. This allows for easy access to all the relevant pools and detailed statistics on those._
81+
82+
**Find out how many people are participating in Yearn Vaults:**
83+
[https://duneanalytics.com/msilb7/Yearn-How-Many-Addresses-are-Participating](https://duneanalytics.com/msilb7/Yearn-How-Many-Addresses-are-Participating)
84+
85+
### Summary
86+
87+
Parameters allow you to make a certain part of your SQL query dynamic and thereby offer you to make queries and dashboards interactive. That way you can easily display detailed data on your dashboard since it allows the viewer to customize the dashboard for his needs.
88+
You could think of parameters like filters, but the possibilities of using this feature go beyond that.
89+

working-on-dune/queries/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Query Handbook
2+
3+
**In our experience, you are best off looking around Dune and finding queries that you might find interesting and looking at the source code of those to learn.**
4+
5+
Dune is a collaborative endeavor that is shared by it's users. The compounded knowledge of all analysts will allow you to get to results the fastest way.
6+
Seeing the queries live and in action does allow you to more intuitively engage with the content and learn faster.
7+
8+
**Find great query creators and fork their queries for maximum efficiency.**
9+
10+
**Some of our best creators are these:**
11+
12+
* [https://duneanalytics.com/hagaetc](https://duneanalytics.com/hagaetc)
13+
* [https://duneanalytics.com/rchen8](https://duneanalytics.com/rchen8)
14+
* [https://duneanalytics.com/kroeger0x](https://duneanalytics.com/kroeger0x)
15+
* \*\*\*\*[https://duneanalytics.com/eliasimos](https://duneanalytics.com/eliasimos)
16+
* [https://duneanalytics.com/0xBoxer](https://duneanalytics.com/0xBoxer)
17+
* \*\*\*\*[https://duneanalytics.com/Siang513](https://duneanalytics.com/Siang513)
18+
* [https://duneanalytics.com/keeganead](https://duneanalytics.com/keeganead)
19+
20+
**Nevertheless we have collected some queries here for a simple introduction:**
21+
22+
{% page-ref page="growth-rate.md" %}
23+
24+
{% page-ref page="untitled-6.md" %}
25+
26+
{% page-ref page="untitled-5.md" %}
27+
28+
{% page-ref page="circ-supply.md" %}
29+
30+
{% page-ref page="untitled-3.md" %}
31+
32+
{% page-ref page="untitled-2.md" %}
33+
34+
{% page-ref page="untitled-1.md" %}
35+

0 commit comments

Comments
 (0)