Make a list of (name, shares, price, change) tuples given a portfolio list and prices dictionary.
(portfolio, prices)
| 27 | return dict(fileparse.parse_csv(lines,types=[str,float], has_headers=False, **opts)) |
| 28 | |
| 29 | def make_report_data(portfolio, prices): |
| 30 | ''' |
| 31 | Make a list of (name, shares, price, change) tuples given a portfolio list |
| 32 | and prices dictionary. |
| 33 | ''' |
| 34 | rows = [] |
| 35 | for s in portfolio: |
| 36 | current_price = prices[s.name] |
| 37 | change = current_price - s.price |
| 38 | summary = (s.name, s.shares, current_price, change) |
| 39 | rows.append(summary) |
| 40 | return rows |
| 41 | |
| 42 | def print_report(reportdata, formatter): |
| 43 | ''' |
no test coverage detected