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

Function ticker

Solutions/6_12/ticker.py:33–41  ·  view source on GitHub ↗
(portfile, logfile, fmt)

Source from the content-addressed store, hash-verified

31 yield row
32
33def ticker(portfile, logfile, fmt):
34 portfolio = report.read_portfolio(portfile)
35 lines = follow(logfile)
36 rows = parse_stock_data(lines)
37 rows = filter_symbols(rows, portfolio)
38 formatter = tableformat.create_formatter(fmt)
39 formatter.headings(['Name','Price','Change'])
40 for row in rows:
41 formatter.row([ row['name'], f"{row['price']:0.2f}", f"{row['change']:0.2f}"] )
42
43def main(args):
44 if len(args) != 4:

Callers 1

mainFunction · 0.70

Calls 5

followFunction · 0.90
filter_symbolsFunction · 0.85
parse_stock_dataFunction · 0.70
headingsMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected