def get_max_days_to_liquidate_by_ticker(positions, market_data,<EOL>max_bar_consumption=<NUM_LIT>,<EOL>capital_base=<NUM_LIT>,<EOL>mean_volume_window=<NUM_LIT:5>,<EOL>last_n_days=None):
dtlp = days_to_liquidate_positions(positions, market_data,<EOL>max_bar_consumption=max_bar_consumption,<EOL>capital_base=capital_base,<EOL>mean_volume_window=mean_volume_window)<EOL>if last_n_days is not None:<EOL><INDENT>dtlp = dtlp.loc[dtlp.index.max() - pd.Timedelta(days=last_n_days):]<EOL><DEDENT>pos_alloc = pos.get_percent_alloc(positions)<EOL>pos_alloc = pos_alloc.drop('<STR_LIT>', axis=<NUM_LIT:1>)<EOL>liq_desc = pd.DataFrame()<EOL>liq_desc['<STR_LIT>'] = dtlp.unstack()<EOL>liq_desc['<STR_LIT>'] = pos_alloc.unstack() * <NUM_LIT:100><EOL>liq_desc.index.levels[<NUM_LIT:0>].name = '<STR_LIT>'<EOL>liq_desc.index.levels[<NUM_LIT:1>].name = '<STR_LIT:date>'<EOL>worst_liq = liq_desc.reset_index().sort_values(<EOL>'<STR_LIT>', ascending=False).groupby('<STR_LIT>').first()<EOL>return worst_liq<EOL>
Finds the longest estimated liquidation time for each traded
name over the course of backtest (or last n days of the backtest).

Parameters
----------
positions: pd.DataFrame
    Contains daily position values including cash
    - See full explanation in tears.create_full_tear_sheet
market_data : pd.Panel
    Panel with items axis of 'price' and 'volume' DataFrames.
    The major and minor axes should match those of the
    the passed positions DataFrame (same dates and symbols).
max_bar_consumption : float
    Max proportion of a daily bar that can be consumed in the
    process of liquidating a position.
capital_base : integer
    Capital base multiplied by portfolio allocation to compute
    position value that needs liquidating.
mean_volume_window : float
    Trailing window to use in mean volume calculation.
last_n_days : integer
    Compute for only the last n days of the passed backtest data.

Returns
-------
days_to_liquidate : pd.DataFrame
    Max Number of days required to fully liquidate each traded name.
    Index of symbols. Columns for days_to_liquidate and the corresponding
    date and position_alloc on that day.