MCPcopy Create free account
hub / github.com/dabeaz-course/practical-python / portfolio_report

Function portfolio_report

Solutions/6_12/report.py:50–63  ·  view source on GitHub ↗

Make a stock report given portfolio and price data files.

(portfoliofile, pricefile, fmt='txt')

Source from the content-addressed store, hash-verified

48 formatter.row(rowdata)
49
50def portfolio_report(portfoliofile, pricefile, fmt='txt'):
51 '''
52 Make a stock report given portfolio and price data files.
53 '''
54 # Read data files
55 portfolio = read_portfolio(portfoliofile)
56 prices = read_prices(pricefile)
57
58 # Create the report data
59 report = make_report_data(portfolio, prices)
60
61 # Print it out
62 formatter = tableformat.create_formatter(fmt)
63 print_report(report, formatter)
64
65def main(args):
66 if len(args) != 4:

Callers 1

mainFunction · 0.70

Calls 4

read_portfolioFunction · 0.70
read_pricesFunction · 0.70
make_report_dataFunction · 0.70
print_reportFunction · 0.70

Tested by

no test coverage detected