Skip to main content

f_distinct_trades_ratio_vs_all

df.loc[:, 'f_distinct_trades_pc'] = df.loc[:, 'distinct_trades'].pct_change().bfill()
df.loc[:, 'f_distinct_trades_ratio'] = df.loc[:, 'distinct_trades'].rolling(window=pd.offsets.Minute(10)).mean()/df.loc[:, 'distinct_trades'].rolling(window=pd.offsets.Minute(60)).mean()
df.loc[:, 'f_distinct_trades_long_ratio'] = df.loc[:, 'distinct_trades'].rolling(window=pd.offsets.Minute(20)).mean()/df.loc[:, 'distinct_trades'].rolling(window=pd.offsets.Minute(600)).mean()
df.loc[:, 'f_distinct_trades_ratio_vs_all'] = df.loc[:, 'distinct_trades']/df.loc[:, 'distinct_trades_all_pairs']
df.loc[:, 'f_distinct_trades_ratio_vs_all_pct_change'] = df.loc[:, 'distinct_trades_ratio_vs_all'].pct_change(),
df.loc[:, 'f_distinct_trades_ratio_vs_all_pct_change_lag1'] = df.loc[:, 'distinct_trades_ratio_vs_all'].pct_change().shift(1)
df.loc[:, 'f_distinct_trades_all_pairs_pct_change'] = df.loc[:, 'distinct_trades_all_pairs'].pct_change()
df.loc[:, 'f_distinct_trades_all_pairs_roling24_std_pctchange'] = df.loc[:, 'distinct_trades_all_pairs'].rolling(24).std().pct_change()
df.loc[:, 'f_distinct_trades_all_pairs_roling24_std_pctchange_sqrd'] = df.loc[:, 'distinct_trades_all_pairs_roling24_std_pctchange']**2
df.loc[:, 'f_distinct_trades_vs_all_coef_var'] = df.loc[:, 'distinct_trades_ratio_vs_all'].rolling(6).std()/df.loc[:, 'distinct_trades_ratio_vs_all'].rolling(6).mean()
df.loc[:, 'f_distinct_trades_vs_all_coef_var_pctchange'] = df.loc[:, 'distinct_trades_vs_all_coef_var'].pct_change()
df.loc[:, 'f_distinct_trades_coef_var'] = (df.loc[:, 'distinct_trades'].rolling(6).std()/df.loc[:, 'distinct_trades'].rolling(6).mean())
df.loc['f_distinct_trades_all_pairs_coef_var'] = df.loc[:, 'distinct_trades_all_pairs'].rolling(6).std()/df.loc[:, 'distinct_trades_all_pairs'].rolling(6).mean()
df.loc[:,'f_average_trade_value_pct_change'] = df.loc[:, 'average_trade_value'].pct_change()
df.loc[:, 'f_average_trade_val_median_ratio'] = (df.loc[:, 'average_trade_value'].rolling(6).median()/df.loc[:, 'average_trade_value'].rolling(60).median())
df.loc[:, 'f_average_trade_value_short_ratio'] = (df.loc[:, 'average_trade_value']/df.loc[:, 'average_trade_value'].rolling(6).mean().pct_change())
df['f_price_vwap_lagged_pct'] = df['price_vwap'].shift(-1).pct_change()
df['f_price_vwap_rolling_ratio'] = df['price_vwap']/df['price_vwap'].rolling(12).median()
df.loc[:,'f_price_vwap_over_distinct_trades'] = (df['price_vwap']/df['distinct_trades']).pct_change()
df.loc[:,'f_price_max_over_min_rolling_std_pctchange'] = (df['price_max_over_min'].rolling(12).std()).pct_change()
df.loc[:,'f_price_max_over_min_rolling_ratio_pctchnage'] = (df['price_max_over_min'].rolling(6).std()/df['price_max_over_min'].rolling(24).std()).pct_change()
df.loc[:,'f_quantity_traded_pctchange'] = df['quantity_traded'].pct_change()
df['f_quantity_traded_rolling_pctchange'] = (df['quantity_traded'].rolling(6).mean().pct_change())
df['f_quantity_traded_rolling_std_pctchange'] = (df['quantity_traded'].rolling(6).std().pct_change())
df['f_quantity_traded_coef_var'] = df['quantity_traded'].rolling(6).mean()/df['quantity_traded_rolling_std_pctchange']
df.loc[:,'f_quantity_traded_coef_var'] = (df['quantity_traded'].rolling(12).mean()/df['quantity_traded'].rolling(12).std())