GnuCash fec5643+
Loading...
Searching...
No Matches
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

str quotes_historic.FILE = "./test.gnucash"
 
str 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)
 
 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 = comm_table.lookup("CURRENCY", "USD")
 
 quotes_historic.price_denom = cur.get_fraction() * COMMODITY_DENOM_MULT
 
 quotes_historic.p_new = GncPrice(book)
 

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.

Variable Documentation

◆ ac

quotes_historic.ac = find_account(account, 'Intel')[0]

Definition at line 58 of file quotes_historic.py.

◆ account

quotes_historic.account = book.get_root_account()

Definition at line 53 of file quotes_historic.py.

◆ book

quotes_historic.book = session.book

Definition at line 52 of file quotes_historic.py.

◆ comm_table

quotes_historic.comm_table = book.get_table()

Definition at line 55 of file quotes_historic.py.

◆ cur

quotes_historic.cur = comm_table.lookup("CURRENCY", "USD")

Definition at line 60 of file quotes_historic.py.

◆ data

list quotes_historic.data = []

Definition at line 30 of file quotes_historic.py.

◆ day

quotes_historic.day = int(data[i].rsplit(',')[1].rsplit('/')[2])

Definition at line 45 of file quotes_historic.py.

◆ f

quotes_historic.f = open('INTC')

Definition at line 29 of file quotes_historic.py.

◆ FILE

str quotes_historic.FILE = "./test.gnucash"

Definition at line 25 of file quotes_historic.py.

◆ month

quotes_historic.month = int(data[i].rsplit(',')[1].rsplit('/')[1])

Definition at line 44 of file quotes_historic.py.

◆ p_new

quotes_historic.p_new = GncPrice(book)

Definition at line 70 of file quotes_historic.py.

◆ pdb

quotes_historic.pdb = book.get_price_db()

Definition at line 54 of file quotes_historic.py.

◆ price_denom

quotes_historic.price_denom = cur.get_fraction() * COMMODITY_DENOM_MULT

Definition at line 66 of file quotes_historic.py.

◆ root

quotes_historic.root = session.book.get_root_account()

Definition at line 51 of file quotes_historic.py.

◆ session

quotes_historic.session = Session(url)

Definition at line 50 of file quotes_historic.py.

◆ stock

quotes_historic.stock = ac.GetCommodity()

Definition at line 59 of file quotes_historic.py.

◆ stock_date

list quotes_historic.stock_date = []

Definition at line 40 of file quotes_historic.py.

◆ stock_price

list quotes_historic.stock_price = []

Definition at line 41 of file quotes_historic.py.

◆ tmp

quotes_historic.tmp = f.readline()

Definition at line 32 of file quotes_historic.py.

◆ url

str quotes_historic.url = "xml://"+FILE

Definition at line 26 of file quotes_historic.py.

◆ year

quotes_historic.year = int(data[i].rsplit(',')[1].rsplit('/')[0])

Definition at line 43 of file quotes_historic.py.