Read a CSV file of price data into a dict mapping names to prices.
(filename)
| 11 | return fileparse.parse_csv(lines, select=['name','shares','price'], types=[str,int,float]) |
| 12 | |
| 13 | def read_prices(filename): |
| 14 | ''' |
| 15 | Read a CSV file of price data into a dict mapping names to prices. |
| 16 | ''' |
| 17 | with open(filename) as lines: |
| 18 | return dict(fileparse.parse_csv(lines, types=[str,float], has_headers=False)) |
| 19 | |
| 20 | def make_report_data(portfolio,prices): |
| 21 | ''' |