'Retrieve the list of closed Positions objects from the portfolio
and reformat into a pandas dataframe to be returned'

def _get_positions(self):

    def x(p):
        return PriceParser.display(p)
    pos = self.portfolio_handler.portfolio.closed_positions
    a = []
    for p in pos:
        a.append(p.__dict__)
    if (len(a) == 0):
        return None
    else:
        df = pd.DataFrame(a)
        df['avg_bot'] = df['avg_bot'].apply(x)
        df['avg_price'] = df['avg_price'].apply(x)
        df['avg_sld'] = df['avg_sld'].apply(x)
        df['cost_basis'] = df['cost_basis'].apply(x)
        df['init_commission'] = df['init_commission'].apply(x)
        df['init_price'] = df['init_price'].apply(x)
        df['market_value'] = df['market_value'].apply(x)
        df['net'] = df['net'].apply(x)
        df['net_incl_comm'] = df['net_incl_comm'].apply(x)
        df['net_total'] = df['net_total'].apply(x)
        df['realised_pnl'] = df['realised_pnl'].apply(x)
        df['total_bot'] = df['total_bot'].apply(x)
        df['total_commission'] = df['total_commission'].apply(x)
        df['total_sld'] = df['total_sld'].apply(x)
        df['unrealised_pnl'] = df['unrealised_pnl'].apply(x)
        df['trade_pct'] = ((df['avg_sld'] / df['avg_bot']) - 1.0)
        return df
