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