tbl = loadTable("dfs://hft_stock_ts", 'KLinePartitioned')

// calculate the minute return 
// `eachPre` applies the binary function (the 1st arg) to this row and its previous row
// TODO: m_nDate filter condition should be replaced by groupby
ret = select code, m_nDate, m_nTime, eachPre(\, m_nClose) - 1.0 as ret from tbl where m_nDate=2015.01.05 context by code limit 10;
kurto = select code, m_nDate, sqrt(239) * sum(pow(ret, 3)) / pow(sum(pow(ret, 2)), 1.5) as kurtosis from ret where group by code;