Skip to content

Commit

Permalink
Fix CMC reference currency and include stable volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
green-jay committed Feb 2, 2024
1 parent b6dc30a commit 424c70c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions queries/coingecko/v1/tickers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -252,18 +252,22 @@ pair_volumes AS (
SELECT
CASE WHEN asset_in = 100 THEN REPLACE(asset_in::text, '100', CASE WHEN asset_out = '10' THEN '21' ELSE '10' END)
WHEN asset_in = 101 THEN REPLACE(asset_in::text, '101', CASE WHEN asset_out = '11' THEN '19' ELSE '11' END)
WHEN asset_in = 102 THEN REPLACE(asset_in::text, '102', CASE WHEN asset_out = '10' THEN '22' ELSE '10' END)
ELSE asset_in::text
END as asset_1,
CASE WHEN asset_out = 100 THEN REPLACE(asset_out::text, '100', CASE WHEN asset_in = '10' THEN '21' ELSE '10' END)
WHEN asset_out = 101 THEN REPLACE(asset_out::text, '101', CASE WHEN asset_in = '11' THEN '19' ELSE '11' END)
WHEN asset_out = 102 THEN REPLACE(asset_out::text, '102', CASE WHEN asset_in = '10' THEN '22' ELSE '10' END)
ELSE asset_out::text
END as asset_2,
CASE WHEN asset_in = 100 THEN REPLACE(s.symbol, '4-Pool', CASE WHEN s2.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
WHEN asset_in = 101 THEN REPLACE(s.symbol, '2-Pool', CASE WHEN s2.symbol = 'iBTC' THEN 'WBTC' ELSE 'iBTC' END)
WHEN asset_in = 102 THEN REPLACE(s.symbol, '2-Pool-Stbl', CASE WHEN s2.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
ELSE s.symbol
END as asset_1_symbol,
CASE WHEN asset_out = 100 THEN REPLACE(s2.symbol, '4-Pool', CASE WHEN s.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
WHEN asset_out = 101 THEN REPLACE(s2.symbol, '2-Pool', CASE WHEN s.symbol = 'iBTC' THEN 'WBTC' ELSE 'iBTC' END)
WHEN asset_out = 102 THEN REPLACE(s2.symbol, '2-Pool-Stbl', CASE WHEN s.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
ELSE s2.symbol END as asset_2_symbol,
s.price as asset_1_price,
s2.price as asset_2_price,
Expand Down
6 changes: 5 additions & 1 deletion queries/coinmarketcap/v1/summary.sql
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,25 @@ omnipool_totals AS (
2
),
pair_volumes AS (
SELECT
SELECT
CASE WHEN asset_in = 100 THEN REPLACE(asset_in::text, '100', CASE WHEN asset_out = '10' THEN '21' ELSE '10' END)
WHEN asset_in = 101 THEN REPLACE(asset_in::text, '101', CASE WHEN asset_out = '11' THEN '19' ELSE '11' END)
WHEN asset_in = 102 THEN REPLACE(asset_in::text, '102', CASE WHEN asset_out = '10' THEN '22' ELSE '10' END)
ELSE asset_in::text
END as asset_1,
CASE WHEN asset_out = 100 THEN REPLACE(asset_out::text, '100', CASE WHEN asset_in = '10' THEN '21' ELSE '10' END)
WHEN asset_out = 101 THEN REPLACE(asset_out::text, '101', CASE WHEN asset_in = '11' THEN '19' ELSE '11' END)
WHEN asset_out = 102 THEN REPLACE(asset_out::text, '102', CASE WHEN asset_in = '10' THEN '22' ELSE '10' END)
ELSE asset_out::text
END as asset_2,
CASE WHEN asset_in = 100 THEN REPLACE(s.symbol, '4-Pool', CASE WHEN s2.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
WHEN asset_in = 101 THEN REPLACE(s.symbol, '2-Pool', CASE WHEN s2.symbol = 'iBTC' THEN 'WBTC' ELSE 'iBTC' END)
WHEN asset_in = 102 THEN REPLACE(s.symbol, '2-Pool-Stbl', CASE WHEN s2.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
ELSE s.symbol
END as asset_1_symbol,
CASE WHEN asset_out = 100 THEN REPLACE(s2.symbol, '4-Pool', CASE WHEN s.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
WHEN asset_out = 101 THEN REPLACE(s2.symbol, '2-Pool', CASE WHEN s.symbol = 'iBTC' THEN 'WBTC' ELSE 'iBTC' END)
WHEN asset_out = 102 THEN REPLACE(s2.symbol, '2-Pool-Stbl', CASE WHEN s.symbol = 'USDT' THEN 'USDC' ELSE 'USDT' END)
ELSE s2.symbol END as asset_2_symbol,
s.price as asset_1_price,
s2.price as asset_2_price,
Expand Down

0 comments on commit 424c70c

Please sign in to comment.