MMEX Desktop assumes that a base currency is always defined and it interprets the conversion rate of a currency C as the rate with respect to the base currency B, i.e.,
1 C = (C.rate) B
This formula assumes that B.rate is always equal to 1.
Problems
If the base currency is changed from B1 to B2, all conversion rates must be scaled with 1/B2.rate, in order to maintain the invariant that the rate of the base currency is always equal to 1.
Depending on the source, conversion rates may not be available for all currency pairs. Typically they are readily available with respect to USD. If conversion rates with respect to the base currency B are not available, the rates of all wanted currencies can be downloaded with respect to USD, and then divided with the rate of B with respect to USD.
Proposed behavior of conversion rates
A base currency may or may not be defined. The conversion rates are interpreted as the rates with respect to an arbitrary (undefined) unit and only the ratio of two conversion rates is important. In practice the unit is the most convenient reference currency for the source of conversion rates, but this choice is not important.
Scaling all conversion rates with the same scale factor has no impact to balance and report calculations.
The exchange formula between two currencies C and B becomes:
(1/C.rate) C = (1/B.rate) B, or equivalently, 1 C = (C.rate/B.rate) B
The flow of a set of transactions, expressed in currency B, is defined as
flow = sum_t ( ± t.amount * t.a.c.rate / B.rate )
where t is one side of a transaction, ±t.amount is the signed amount (positive for deposit and for the "to" side of a transfer, negative for withdrawal and for the "from" side of a transfer), t.a is the account of t, and t.a.c is the currency of t.a.
The flow calculation may be optimized by factoring out common terms, e.g.,
flow = ( sumC flowC * C.rate ) / B.rate
where
flowC = sum{t | t.a.c = C} ( ±t.amount )
As seen in the above formulas, only the ratio C.rate/B.rate is significant.
Currency conversion rates are stored in:
CURRENCYFORMATS_V1.BASECONVRATE
CURRENCYHISTORY_V1.CURRVALUE
MMEX Desktop assumes that a base currency is always defined and it interprets the conversion rate of a currency
C
as the rate with respect to the base currencyB
, i.e.,C
= (C.rate
)B
This formula assumes that
B.rate
is always equal to 1.Problems
If the base currency is changed from
B1
toB2
, all conversion rates must be scaled with1/B2.rate
, in order to maintain the invariant that the rate of the base currency is always equal to 1.Depending on the source, conversion rates may not be available for all currency pairs. Typically they are readily available with respect to USD. If conversion rates with respect to the base currency
B
are not available, the rates of all wanted currencies can be downloaded with respect to USD, and then divided with the rate ofB
with respect to USD.Proposed behavior of conversion rates
A base currency may or may not be defined. The conversion rates are interpreted as the rates with respect to an arbitrary (undefined) unit and only the ratio of two conversion rates is important. In practice the unit is the most convenient reference currency for the source of conversion rates, but this choice is not important.
Scaling all conversion rates with the same scale factor has no impact to balance and report calculations.
The exchange formula between two currencies
C
andB
becomes:1/C.rate
)C
= (1/B.rate
)B
, or equivalently, 1C
= (C.rate/B.rate
)B
The flow of a set of transactions, expressed in currency
B
, is defined ast
( ±t.amount
*t.a.c.rate
/B.rate
)where
t
is one side of a transaction, ±t.amount
is the signed amount (positive for deposit and for the "to" side of a transfer, negative for withdrawal and for the "from" side of a transfer),t.a
is the account oft
, andt.a.c
is the currency oft.a
.The flow calculation may be optimized by factoring out common terms, e.g.,
C
flowC
*C.rate
) /B.rate
where
C
= sum{t | t.a.c = C
} ( ±t.amount
)As seen in the above formulas, only the ratio
C.rate/B.rate
is significant.