Skip to content

Commit

Permalink
Fix query
Browse files Browse the repository at this point in the history
  • Loading branch information
vrtnd committed Jan 30, 2024
1 parent a05c331 commit 6af25a9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/wrappa/postgres/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ const queryAggregatedDailyTimestampRange = async (
bridgeNetworkNameEqual = bridgeNetworkName ? sql`WHERE bridge_name = ${bridgeNetworkName}` : sql``;
chainEqual = chain ? sql`WHERE chain = ${chain}` : sql``;
}

return await sql<IAggregatedData[]>`
SELECT
bridge_id,
date_trunc('day', ts) AS ts,
CAST(SUM(total_deposited_usd) AS INTEGER) AS total_deposited_usd,
CAST(SUM(total_withdrawn_usd) AS INTEGER) AS total_withdrawn_usd,
CAST(SUM(total_deposit_txs) AS INTEGER) AS total_deposit_txs,
CAST(SUM(total_withdrawal_txs) AS INTEGER) AS total_withdrawal_txs
CAST(SUM(total_deposited_usd) AS BIGINT) AS total_deposited_usd,
CAST(SUM(total_withdrawn_usd) AS BIGINT) AS total_withdrawn_usd,
CAST(SUM(total_deposit_txs) AS BIGINT) AS total_deposit_txs,
CAST(SUM(total_withdrawal_txs) AS BIGINT) AS total_withdrawal_txs
FROM
bridges.hourly_aggregated
WHERE
Expand Down

0 comments on commit 6af25a9

Please sign in to comment.