@@ -82,7 +82,8 @@ def days_to_liquidate_positions(positions, market_data,
8282 """
8383
8484 DV = market_data ['volume' ] * market_data ['price' ]
85- roll_mean_dv = pd .rolling_mean (DV , mean_volume_window ).shift ()
85+ roll_mean_dv = DV .rolling (window = mean_volume_window ,
86+ center = False ).mean ().shift ()
8687 roll_mean_dv = roll_mean_dv .replace (0 , np .nan )
8788
8889 positions_alloc = pos .get_percent_alloc (positions )
@@ -148,7 +149,7 @@ def get_max_days_to_liquidate_by_ticker(positions, market_data,
148149 liq_desc .index .levels [0 ].name = 'symbol'
149150 liq_desc .index .levels [1 ].name = 'date'
150151
151- worst_liq = liq_desc .reset_index ().sort (
152+ worst_liq = liq_desc .reset_index ().sort_values (
152153 'days_to_liquidate' , ascending = False ).groupby ('symbol' ).first ()
153154
154155 return worst_liq
@@ -184,7 +185,7 @@ def get_low_liquidity_transactions(transactions, market_data,
184185 bar_consumption = txn_daily_w_bar .assign (
185186 max_pct_bar_consumed = (
186187 txn_daily_w_bar .amount / txn_daily_w_bar .volume )* 100
187- ).sort ('max_pct_bar_consumed' , ascending = False )
188+ ).sort_values ('max_pct_bar_consumed' , ascending = False )
188189 max_bar_consumption = bar_consumption .groupby ('symbol' ).first ()
189190
190191 return max_bar_consumption [['date' , 'max_pct_bar_consumed' ]]
0 commit comments