市值行业中性化代码,求帮忙更正
由bqkrin4q创建,最终由small_q 被浏览 26 用户
%%sql
SELECT
log(total_market_cap) as f_market_cap,
m_avg(turn,20) as f_trun,
date,
instrument,
industry_level1_code,
c_neutralize(f_trun,industry_level1_code,f_market_cap) as NEW_TURN
FROM cn_stock_factors
JOIN cn_stock_industry_component
USING(date,instrument)
WHERE date >= '2022-01-01' and date <= '2022-12-31' and cn_stock_industry_component.industry = 'sw2021'
--QUALIFY COLUMNS(*) NOT NULL
\