Skip to content

Fix database price calc#604

Merged
ice-ares merged 4 commits into
masterfrom
fix_database_price_calc
Mar 16, 2026
Merged

Fix database price calc#604
ice-ares merged 4 commits into
masterfrom
fix_database_price_calc

Conversation

@ice-dionysos

Copy link
Copy Markdown
Contributor

No description provided.

@ice-dionysos ice-dionysos self-assigned this Mar 16, 2026
@ice-dionysos ice-dionysos requested a review from a team as a code owner March 16, 2026 10:48
Copilot AI review requested due to automatic review settings March 16, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the price-change notification pipeline to compute and compare a token USD unit price (USD per token) rather than using a raw USD transaction amount, aligning the Go-side parsing with a new DB-side helper function.

Changes:

  • Added calculateUSDPriceFromTxEvent to derive USD/token from token_symbol + tx_amount tags, and switched price-change queries to compare against unit price.
  • Introduced SQL function subzero_get_token_price_from_tx(tags) and updated queries to use it for the latest-trade baseline.
  • Extended tests to cover USD/token calculation and updated test event fixtures to include the required tags.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
database/query/query_pn_price.go Computes current price as USD/token and updates baseline comparisons to use subzero_get_token_price_from_tx.
database/query/query_pn_price_test.go Adds unit tests for USD/token computation and updates helper events with token_symbol + token tx_amount.
database/query/ddl/00023_pn_price_fn.sql Adds DB function to compute token USD unit price from event tags.
go.mod / go.sum Dependency/version bumps from module update/tidy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread database/query/ddl/00023_pn_price_fn.sql
Comment thread database/query/query_pn_price.go
@ice-ares ice-ares merged commit f9492c2 into master Mar 16, 2026
29 checks passed
@ice-ares ice-ares deleted the fix_database_price_calc branch March 16, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants