GnuCash  4.11-137-g155922540d+
Variables
quotes_historic.py File Reference

Example Script to read historic stock data into gnucash. More...

Go to the source code of this file.

Variables

string quotes_historic.FILE = "./test.gnucash"
 
string quotes_historic.url = "xml://"+FILE
 
 quotes_historic.f = open('INTC')
 
list quotes_historic.data = []
 
 quotes_historic.tmp = f.readline()
 
list quotes_historic.stock_date = []
 
list quotes_historic.stock_price = []
 
 quotes_historic.year = int(data[i].rsplit(',')[1].rsplit('/')[0])
 
 quotes_historic.month = int(data[i].rsplit(',')[1].rsplit('/')[1])
 
 quotes_historic.day = int(data[i].rsplit(',')[1].rsplit('/')[2])
 
 quotes_historic.session = Session(url, True, False, False)
 
 quotes_historic.root = session.book.get_root_account()
 
 quotes_historic.book = session.book
 
 quotes_historic.account = book.get_root_account()
 
 quotes_historic.pdb = book.get_price_db()
 
 quotes_historic.comm_table = book.get_table()
 
 quotes_historic.ac = find_account(account,'Intel')[0]
 
 quotes_historic.stock = ac.GetCommodity()
 
 quotes_historic.cur = ac.GetSplitList()[0].GetParent().GetCurrency()
 
 quotes_historic.pl = pdb.get_prices(stock,cur)
 
 quotes_historic.pl0 = pl[0]
 
 quotes_historic.p_new = pl0.clone(book)
 
 quotes_historic.v = p_new.get_value()
 
 quotes_historic.num
 
 quotes_historic.denom
 

Detailed Description

Example Script to read historic stock data into gnucash.

Author
Peter Holtermann
Date
January 2011

Call the perl-script

./get_quotes.pl INTC

first to achieve data into file INTC which can thereafter be imported to GnuCash using this script.

For explanation of use have a look at the wiki: https://wiki.gnucash.org/wiki/Stocks/get_prices

Definition in file quotes_historic.py.