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

Pindexer metrics fix #4981

Merged
merged 3 commits into from
Jan 11, 2025
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
8 changes: 6 additions & 2 deletions crates/bin/pindexer/src/dex_ex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ mod candle {

impl Candle {
pub fn from_candlestick_data(data: &CandlestickData) -> Self {
// The volume is tracked in terms of input asset.
// We can use the closing price (aka. the common clearing price) to convert
// the volume to the other direction i.e, the batch swap output.
Self {
open: data.open,
close: data.close,
Expand Down Expand Up @@ -88,8 +91,8 @@ mod candle {
close: 1.0 / self.close,
low: 1.0 / self.low,
high: 1.0 / self.high,
direct_volume: self.direct_volume / self.close,
swap_volume: self.swap_volume / self.close,
direct_volume: self.direct_volume * self.close,
swap_volume: self.swap_volume * self.close,
}
}
}
Expand Down Expand Up @@ -545,6 +548,7 @@ mod summary {
ON ed_end.asset = asset_end
JOIN eligible_denoms AS ed_start
ON ed_start.asset = asset_start
WHERE the_window = $3
),
sums AS (
SELECT
Expand Down
Loading