Skip to content

Apply saved exchange rates to the current month - #213

Open
oviron wants to merge 1 commit into
ardov:masterfrom
oviron:fx-pin-current-month
Open

oviron wants to merge 1 commit into
ardov:masterfrom
oviron:fx-pin-current-month

Conversation

@oviron

@oviron oviron commented Nov 20, 2026

Copy link
Copy Markdown

Refs #206

A saved rates table already applies from its month on to every later past month, but the current month is always priced at live instrument rates. So a foreign-currency envelope that was covered today shows an overspend again after the next quote refresh, and moves once more at rollover, when the month switches from live rates to the inherited table.

This PR applies saved tables to the current month too. Live rates date the calendar only until a table takes effect, so users who never saved rates see no change. 'current' lookups stay live, and a partial table still falls back to live rates per code, as before.

To move to today's rates, the current month's rates panel gets a "Pin current exchange rates" button. It reuses the existing loadFxRates branch for a month that has not ended, so it saves the instrument rates. The panel now also shows when only an envelope is in another currency, so that case gets the button too. The envelope currency tooltip now says the balance is recalculated at the rate of each month.

Tests: read.test.ts covers tables before, in and after the current month; a graph test shows a covered USD envelope staying at zero when the live quote changes and following it again after reset; FxRates.test.tsx pins rates for a USD envelope over an inherited table. pnpm verify passes. I could not run pnpm test:storybook locally (no Playwright browser), so CI decides there.

Saved rates already apply from their month on to every later past month,
but the current month was always priced at live instrument rates. A covered
foreign-currency envelope drifted with each quote refresh and moved again at
rollover, when the month switched to the inherited table.

Live rates now date the calendar only until a first table is saved. The
current month gets a button to pin today's rates instead of the inherited
ones.
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

@oviron is attempting to deploy a commit to the Alexey Ardov's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant