Skip to content

Commit

Permalink
Merge pull request #22 from galacticcouncil/set-stablepool-as-base-cmc
Browse files Browse the repository at this point in the history
Fix CMC reference currency and include stable volumes
  • Loading branch information
green-jay authored Feb 2, 2024
2 parents 6224b6d + 424c70c commit 4480825
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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
8 changes: 6 additions & 2 deletions queries/coinmarketcap/v1/summary.sql
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ lrna_in_usdt AS (
alltime_bal a
JOIN hub_reserve hr ON a.asset_id = hr.asset_id
WHERE
hr.asset_id = '10'
hr.asset_id = '102'
),
spot AS (
SELECT
Expand Down 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 4480825

Please sign in to comment.