Merged
Conversation
…line visualization of PnL
…vent injection vulnerabilities
…and caching; update AppService to utilize new syncAllFromApi method for initialization and cron job; adjust portfolio service tests to reflect method name changes
… parameters and enhancing error logging; clean up unnecessary whitespace in AppService
…ming logic; ensure rates are only refreshed when null
…rove cache management; streamline price feed controller by removing unused cache manager
…L history with optional date range and interval; enhance portfolio service to support per-token PnL breakdown
…maries and descriptions; update query DTO for clarity on included fields
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| includePnl: true, | ||
| useRangeBasedPnl, | ||
| includeTokensPnl: true, | ||
| }); |
There was a problem hiding this comment.
Duplicated interval/date parsing logic across two controller methods
Low Severity
getTokensPnlHistory duplicates the date-parsing, interval-clamping, and include-field splitting logic from getPortfolioHistory. If the interval calculation or date handling changes in one method but not the other, responses from the two endpoints will silently diverge. Extracting the shared query-to-options mapping into a private helper would keep both endpoints consistent.
Additional Locations (1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Note
Medium Risk
Adds new API routes and changes portfolio/pricing data retrieval paths (including cached CoinGecko access), which could affect response shapes/performance and historical pricing behavior if edge cases slip through.
Overview
Adds two new account portfolio endpoints:
:address/portfolio/tokens/historyto explicitly return per-token PnL (tokens_pnl), and:address/portfolio/pnl-chart.svgto serve a cached SVG sparkline of realized PnL (daily, or hourly for single-day ranges).Refactors portfolio history/PnL plumbing so
tokens_pnlis no longer returned from the general history endpoint unless explicitly requested, and introducesPortfolioService.getPnlTimeSeries()as a lightweight, single-query path for charting (with updated controller/service tests).Adjusts pricing integration to rely on CoinGeckoService cache/DB-backed getters (no eager fetch on service construction, trims supported
intervaltodaily|hourly, removes minute aggregation/caching inPriceFeedController), and updates dependencies/lockfile (dropsmysql2,ts-loader,source-map-support, bumps several packages).Written by Cursor Bugbot for commit bd7837d. This will update automatically on new commits. Configure here.