Print a nicely formated table from a list of (name, shares, price, change) tuples.
(reportdata, formatter)
| 39 | return rows |
| 40 | |
| 41 | def print_report(reportdata, formatter): |
| 42 | ''' |
| 43 | Print a nicely formated table from a list of (name, shares, price, change) tuples. |
| 44 | ''' |
| 45 | formatter.headings(['Name','Shares','Price','Change']) |
| 46 | for name, shares, price, change in reportdata: |
| 47 | rowdata = [ name, str(shares), f'{price:0.2f}', f'{change:0.2f}' ] |
| 48 | formatter.row(rowdata) |
| 49 | |
| 50 | def portfolio_report(portfoliofile, pricefile, fmt='txt'): |
| 51 | ''' |
no test coverage detected