19 from gnucash
import Session
27 FILE =
"PATH_TO_YOUR_TEST_FILE" 29 session = Session(FILE,
True,
False,
False)
31 root = session.book.get_root_account()
33 pdb = book.get_price_db()
34 comm_table = book.get_table()
35 gbp = comm_table.lookup(
"CURRENCY",
"SOME_CURRENCY")
36 arm = comm_table.lookup(
"NASDAQ",
"SOME_STOCK")
37 latest = pdb.lookup_latest(arm,gbp)
38 value = latest.get_value()
39 pl = pdb.get_prices(arm,gbp)
41 source = pr.get_source()
42 time = pr.get_time64()
44 price = float(v.num)/v.denom
45 print(time, source, price)
48 v0 = pl[0].get_value()
49 print(arm.get_fullname(), float(v0.num) / float(v0.denom ))