Computes the total cost (shares*price) of a portfolio file
(filename)
| 3 | import report |
| 4 | |
| 5 | def portfolio_cost(filename): |
| 6 | ''' |
| 7 | Computes the total cost (shares*price) of a portfolio file |
| 8 | ''' |
| 9 | portfolio = report.read_portfolio(filename) |
| 10 | return sum([s['shares'] * s['price'] for s in portfolio]) |
| 11 | |
| 12 | def main(args): |
| 13 | if len(args) != 2: |