def _stack_positions(positions, pos_in_dollars=True):
if pos_in_dollars:<EOL><INDENT>positions = get_percent_alloc(positions)<EOL><DEDENT>positions = positions.drop('<STR_LIT>', axis='<STR_LIT>')<EOL>positions = positions.stack()<EOL>positions.index = positions.index.set_names(['<STR_LIT>', '<STR_LIT>'])<EOL>return positions<EOL>
Convert positions to percentages if necessary, and change them
to long format.

Parameters
----------
positions: pd.DataFrame
    Daily holdings (in dollars or percentages), indexed by date.
    Will be converted to percentages if positions are in dollars.
    Short positions show up as cash in the 'cash' column.

pos_in_dollars : bool
    Flag indicating whether `positions` are in dollars or percentages
    If True, positions are in dollars.