I've made a bit more progress on this. I managed to get it to work with 8 decimal place Bitcoin values. It's a fairly small change and I updated all my values from my wallet with 8 decimals. It works ok but I had one time where it crashed - so I think there is still something wrong in the amount entry parsing. I'd recommend if you try this to keep backups of your moneyguru data file before each use. At least until this has been tested more. (The moneyguru data file appears to be an XML account+transaction list.)
Here is the full patch that adds an XBC symbol and updates entry parsing code to support 8 decimals. This is applied in the /usr/share/moneyguru directory and affects two files with only a few lines each.
--- hscommon/currency.py.orig 2012-12-11 13:14:49.395809143 +0700
+++ hscommon/currency.py 2012-12-20 21:54:09.355576324 +0700
@@ -256,7 +256,9 @@
start_date=date(1998, 1, 2), start_rate=0.5278, latest_rate=0.3793)
XPF = Currency.register('XPF', 'CFP franc',
exponent=0, start_date=date(1998, 1, 2), start_rate=0.01299, latest_rate=0.01114)
-
+XBC = Currency.register('XBC', 'Bitcoin',
+ exponent=8, start_date=date(1998, 1, 2), start_rate=13.50, latest_rate=13.50)
+
class RatesDB:
"""Stores exchange rates for currencies.
--- core/model/amount.py.orig 2012-12-20 21:52:48.043173127 +0700
+++ core/model/amount.py 2012-12-20 21:55:04.127847928 +0700
@@ -30,6 +30,8 @@
re_decimal_sep_2 = re.compile(r"[,.](?=\d{1,2}$)")
# currencies with 3 decimal places
re_decimal_sep_3 = re.compile(r"[,.](?=\d{1,3}$)")
+# currencies with 8 decimal places
+re_decimal_sep_8 = re.compile(r"[,.](?=\d{1,8}$)")
# A valid amount, once it has been pre-processed
re_amount = re.compile(r"\d+\.\d+|\.\d+|\d+")
@@ -86,7 +88,9 @@
# Now, we have a string that might have thousand separators and might or might not have
# a decimal separator, which might be either "," or ".". We'll first find our decimal sep
# and replace it with a placeholder char, find all thousand seps, replace them with nothing.
- if exponent == 3:
+ if exponent == 8:
+ string = re_decimal_sep_8.sub('|', string)
+ elif exponent == 3:
string = re_decimal_sep_3.sub('|', string)
elif exponent == 2:
string = re_decimal_sep_2.sub('|', string)
I'm going to look at a plugin for importing transactions from an Electrum wallet, and probably an exchange rate update function for the Net Worth screen.