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

Pre-load exchange rates and security prices in the background #1615

Open
zachgoll opened this issue Jan 11, 2025 · 0 comments
Open

Pre-load exchange rates and security prices in the background #1615

zachgoll opened this issue Jan 11, 2025 · 0 comments
Labels
💡 Improvement Improvements to an existing feature or flow 🔧 Backend ⚡ Performance Performance issues to address

Comments

@zachgoll
Copy link
Collaborator

Up to this point, we have dynamically "found or fetched" exchange rates and security prices in the app. If we don't find it in the database, we hit our provider, Synth.

As we write more complex aggregation queries in the app (ie budgeting insights, portfolio returns, etc), this will become more of an issue as many of these require a basic join on rates/prices tables.

There have already been some performance issues highlighted due to the on-demand loading of these rates, so we should move towards pre-fetching rather than on-demand.

When to fetch on-demand

We will keep our on-demand fetching for a few useful cases:

  • Displaying current day stock prices for each holding
  • Displaying current day net worth trends

When to preload

All historical calculations and queries should assume that a rate/price is available in the DB, and provide reasonable fallbacks (ie conversion rate of 1 for exchange rates, last known price for stock prices)

This allows for easier joins on these tables.

Preloading spec

  • Daily background job
  • Query all Account::Entry records in the DB, find any missing rates/prices + dates
  • Query provider for needed rates/prices and save
@zachgoll zachgoll added 💡 Improvement Improvements to an existing feature or flow 🔧 Backend ⚡ Performance Performance issues to address labels Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Improvement Improvements to an existing feature or flow 🔧 Backend ⚡ Performance Performance issues to address
Projects
None yet
Development

No branches or pull requests

1 participant