@@ -82,7 +82,8 @@ def days_to_liquidate_positions(positions, market_data,
82
82
"""
83
83
84
84
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 ()
86
87
roll_mean_dv = roll_mean_dv .replace (0 , np .nan )
87
88
88
89
positions_alloc = pos .get_percent_alloc (positions )
@@ -148,7 +149,7 @@ def get_max_days_to_liquidate_by_ticker(positions, market_data,
148
149
liq_desc .index .levels [0 ].name = 'symbol'
149
150
liq_desc .index .levels [1 ].name = 'date'
150
151
151
- worst_liq = liq_desc .reset_index ().sort (
152
+ worst_liq = liq_desc .reset_index ().sort_values (
152
153
'days_to_liquidate' , ascending = False ).groupby ('symbol' ).first ()
153
154
154
155
return worst_liq
@@ -184,7 +185,7 @@ def get_low_liquidity_transactions(transactions, market_data,
184
185
bar_consumption = txn_daily_w_bar .assign (
185
186
max_pct_bar_consumed = (
186
187
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 )
188
189
max_bar_consumption = bar_consumption .groupby ('symbol' ).first ()
189
190
190
191
return max_bar_consumption [['date' , 'max_pct_bar_consumed' ]]
0 commit comments