articoloquintoTotal amount of opened positions
Updated 2022-06-28
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
select sum("amount in USD") as "total amount in USD" from(
select 'SUSHI' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x6B3595068778DD592e39A122f4f5a5cF09C90fE2') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'MATIC' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270') and ORIGIN_TO_ADDRESS = lower('0xa3db2c0d23720e8cda0f4d80a53b94d20d02b061') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
UNION
select 'WBTC' as "asset", coalesce((sum(RAW_AMOUNT)/10e7)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x2260fac5e5542a773aa44fbcfedf7c193bc2c599') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'USDC' as "asset", coalesce((sum(RAW_AMOUNT)/10e5)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x2791bca1f2de4661ed88a30c99a7a9449aa84174') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'jEUR' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x0f17bc9a994b87b5225cfb6a2cd4d667adb4f20b') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'LINK' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x514910771af9ca656af840dff83e8264ecf986ca') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0xb0897686c545045afc77cf20ec7a532e3120e0f1') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'WETH' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x7ceb23fd6bc0add59e62ac25578270cff1b9f619') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'QUICK' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x6c28aef8977c9b773996d0e8376d2ee379446f2f') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x831753DD7087CaC61aB5644b308642cc1c33Dc13') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'DAI' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x6b175474e89094c44da98b954eedeac495271d0f') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0x8f3cf7ad23cd3cadbd9735aff958023239c6a063') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'MANA' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x0f5d2fb29fb7d3cfee444a200298f468908cc942') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'UNI' as "asset", coalesce((sum(RAW_AMOUNT)/10e17)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0x1f9840a85d5af5bf1d1762f925bdaddc4201f984') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0xb33eaad8d922b1083446dc23f610c2567fb5180f') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
union
select 'USDT' as "asset", coalesce((sum(RAW_AMOUNT)/10e5)*(select PRICE from ethereum.core.fact_hourly_token_prices where TOKEN_ADDRESS = lower('0xdac17f958d2ee523a2206206994597c13d831ec7') and HOUR = '2022-06-28 20:00:00.000'), 0) as "amount in USD" from polygon.core.fact_token_transfers
where CONTRACT_ADDRESS = lower('0xc2132d05d31c914a87c6611c10748aeb04b58e8f') and ORIGIN_TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5') and TO_ADDRESS = lower('0x059d306a25c4ce8d7437d25743a8b94520536bd5')
Run a query to Download Data