- buy FOO with BAR: transaction.exchange cash->exchange BAR xxxx transaction.exchange exchange->cash FOO yyyy - after trip, sell back all remaining FOO and then there should be no nonzero FOO totals anywhere but in exchange. - in the presence of transactions between foreign currencies, system can be overspecified. in this case, can break the loop by specifying a native equivalent amount for one transaction per extra equation; perhaps use average of exchange rates from transactions that are present in the db? perhaps ask human? perhaps try all ways of breaking the loop and see how much they differ? - add an exchange category type, parallel to i/o/t in categories file, with weird semantics, for exchange transactions. only relevant transactions (x flag): initial purchases: cash: -100CDN, +500SEK; exch: +100CDN, -500SEK cash: -100CDN, +400DKK; exch: +100CDN, -400DKK mid-trip: cash: -100SEK, +75DKK; exch: +100SEK, -75DKK out.*: cash: -350SEK, 400DKK totals at this point: 50SEK, 75DKK end: cash: -50SEK, +8CDN; exch: +50SEK, -8CDN cash: -75DKK, +15CDN; exch: +75DKK, -15CDN totals: cash: CDN: -177 SEK: 0 DKK: 0 exch: CDN: 177 SEK: -350 DKK: -400 out: SEK: 350, DKK: 400 a * convSEK = 350 b * convDKK = 400 a + b = 177 x * convSEK = 100 x * convDKK = 75 ---- a * convSEK = amt1 b * convDKK = amt2 c * convUSD = amt3 a + b + c = amt4 x1 * convSEK = amt5; x1 * convDKK = amt6 x2 * convSEK = amt7; x2 * convUSD = amt8 x3 * convDKK = amt9; x3 * convUSD = amt10 ==== actual rates: 100CDN = 90USD, 500SEK, 400DKK CDN USD SEK DKK sell CDN --- 1 .19 .23 USD .85 --- SEK 5.75 --- DKK 4.5 --- buy sell CDN: 100CDN buys 85USD, 575SEK, 450DKK buy CDN: get 100CDN for 100USD, 550SEK, 450DKK ---- initial: sell 300CDN, get 90USD