Magidoc

FinanceExchangeRate
Object

One stored exchange rate: what a unit of fromCurrency was worth in toCurrency on rateDate.

Dated rows supersede rather than retire, so there is no active flag — resolution takes the latest row on or before the date it is asked about, and a newer rate replaces an older one by existing.

Fields

#

_id

ID !
Non-null

workspaceId

ID !
Non-null

glCompanyId

The books this rate belongs to, recorded against the GL companies provisioning will introduce. Null on every rate today — written from the first row rather than backfilled later.

fromCurrency

Non-null

toCurrency

Non-null

rate

Non-null

The rate as a decimal string, exactly as authored — a rate quoted to six places stays quoted to six places. A string rather than a Float because a rate is arithmetic on money: it is parsed to an exact integer fraction, and a double would round it before it ever converted anything.

rateDate

Non-null

The day this rate applies from. Stored at the UTC day boundary: one rate per pair per day.

conflictingInverseRate

The rate in force for the opposite direction of this pair on this row's day, when it disagrees with this rate — null when the two reconcile or when no such row is stored.

The pair is one fact, so two rows stating it both ways must state the same thing. When they do not, a conversion is worth a different amount depending on which row it reaches, and neither row can be read as the truth — so the list says so on the row.

In force, not same-day. A conversion resolves each direction as the latest rate dated on or before the document's day, so the two rows that convert one document are frequently authored for different days. This names whichever row a conversion of this row's day would actually reach, which is why it can be dated earlier than this row — see conflictingInverseRateDate.

conflictingInverseRateDate

The day the rate named by conflictingInverseRate applies from — null whenever that field is.

The contradiction is often not authored for this row's own day, so without the date there is nothing in the marker that says which row to go and correct.

supersededOn

The day a later rate for this same pair takes over, or null when this row is the rate in force — the one a conversion dated today reaches.

Derived from the pair's dated series rather than stored, because that series is what decides it: resolution takes the latest row on or before the date it is asked about, so exactly one row per pair is in force and every earlier one has a successor. Stored, it would be a second copy of the same fact, wrong from the moment a rate is inserted between two existing rows.

source

Non-null

createdAt

Non-null

createdBy

ID !
Non-null

modifiedAt

Non-null

modifiedBy

ID !
Non-null

Usages

#

References

#

  • Field getFinanceExchangeRates from Query
  • Field createFinanceExchangeRate from Mutation
  • Field updateFinanceExchangeRate from Mutation