Skip to content

Commit

Permalink
Merge pull request #27 from galacticcouncil/fix-xyk
Browse files Browse the repository at this point in the history
Fix decimals in xyk gecko reporting
  • Loading branch information
green-jay authored Feb 27, 2024
2 parents 2f2e4c7 + 5680086 commit 2ae77af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions queries/coingecko/v1/tickers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -518,13 +518,13 @@ xyk_pools AS (
CONCAT(tm.symbol, '_', tme.symbol) as ticker_id,
tm.symbol as base_currency,
tme.symbol as target_currency,
amount_in / amount_out as last_price,
(amount_in / 10^tm.decimals) / (amount_out / 10^tme.decimals) as last_price,
SUM(amount_in / 10^tm.decimals) OVER (PARTITION BY asset_in) as base_volume,
SUM(amount_out / 10^tme.decimals) OVER (PARTITION BY asset_out) as target_volume,
CONCAT(tm.symbol, '_', tme.symbol) as pool_id,
0 as liquidity_in_usd,
MAX(amount_in / amount_out) OVER (PARTITION BY asset_in) as high,
MIN(amount_in / amount_out) OVER (PARTITION BY asset_in) as low,
MAX((amount_in / 10^tm.decimals) / (amount_out / 10^tme.decimals)) OVER (PARTITION BY asset_in) as high,
MIN((amount_in / 10^tm.decimals) / (amount_out / 10^tme.decimals)) OVER (PARTITION BY asset_in) as low,
ROW_NUMBER() OVER (PARTITION BY tm.id, tme.id ORDER BY timestamp DESC) as rn
FROM xyk_ranking xr
JOIN token_metadata tm ON xr.asset_in = tm.id::text
Expand Down

0 comments on commit 2ae77af

Please sign in to comment.