Ответы на комментарии пользователя Фёдор Г.
Фёдор Г., Это разница между суммами сделками на продажу и покупки за день
smart-lab.ru/blog/1090639.php
вот таким SQL запросом
select sec_code, sum(vol) as vol FROM (SELECT sec_code, sum(price * quantity * s.lotsize) as volFROM «default».«transaq_trades»JOIN default.transaq_securities son (transaq_trades.secid = s.secid and transaq_trades.board = s.board)WHERE sec_code not in [$sec_code_etf]AND board = 'TQBR'AND (time >= $__fromTime AND time <= $__toTime)AND (buy_sell = 'B')GROUP By sec_codeUNION ALLSELECT sec_code, sum(price * quantity * s.lotsize)*-1 as volFROM «default».«transaq_trades»JOIN default.transaq_securities son (transaq_trades.secid = s.secid and transaq_trades.board = s.board)WHERE sec_code not in [$sec_code_etf] AND board = 'TQBR'AND (time >= $__fromTime AND time <= $__toTime)AND (buy_sell = 'S')GROUP By sec_code) GROUP by sec_code ORDER by vol desc LIMIT 10