18 from gnucash
import Session
26 FILE =
"PATH_TO_YOUR_TEST_FILE"
28 session = Session(FILE,
True,
False,
False)
30 root = session.book.get_root_account()
32 pdb = book.get_price_db()
33 comm_table = book.get_table()
34 gbp = comm_table.lookup(
"CURRENCY",
"SOME_CURRENCY")
35 arm = comm_table.lookup(
"NASDAQ",
"SOME_STOCK")
36 latest = pdb.lookup_latest(arm,gbp)
37 value = latest.get_value()
38 pl = pdb.get_prices(arm,gbp)
40 source = pr.get_source()
43 price = float(v.num)/v.denom
44 print time, source, price
47 v0 = pl[0].get_value()
48 print arm.get_fullname(), float(v0.num) / float(v0.denom )