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 | import sys |
| 13 | if len(sys.argv) == 2: |