Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Raydium Dex Volumes #654

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions models/staging/raydium/fact_solana_dex_token_prices.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,24 @@ priced_ratio as (
left join {{ ref("fact_raydium_token_prices") }} as token_prices
on swap_pricing_data.date = token_prices.date and swap_pricing_data.priced_asset_address = token_prices.solana_mint_address
where token_amount > 0
),
solana_dex_token_prices as (
select
date
, token_address
, avg(token_price_usd) as price
, count(*) as number_of_swaps
, count(distinct swapper) as unique_traders
from priced_ratio
group by 1, 2
HAVING count(*) > 1000 and count(distinct swapper) > 50
)
select
date
select
solana_dex_token_prices.date
, token_address
, avg(token_price_usd) as price
, count(*) as number_of_swaps
, count(distinct swapper) as unique_traders
from priced_ratio
group by 1, 2
HAVING count(*) > 1000 and count(distinct swapper) > 50
, least(solana_dex_token_prices.price, token_prices.price) as price
, number_of_swaps
, unique_traders
from solana_dex_token_prices
left join {{ ref("fact_raydium_token_prices") }} as token_prices
on solana_dex_token_prices.date = token_prices.date and solana_dex_token_prices.token_address = token_prices.solana_mint_address
Loading