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