def portfolio_snapshot(p):
    """Extract all of the fields from the portfolio as a new dictionary.
    """
    fields = (
        'cash_flow',
        'starting_cash',
        'portfolio_value',
        'pnl',
        'returns',
        'cash',
        'positions',
        'positions_value',
        'positions_exposure',
    )
    return {field: getattr(p, field) for field in fields}