diff --git a/tools/get_shares_stats.py b/tools/get_shares_stats.py new file mode 100644 index 0000000..b88e618 --- /dev/null +++ b/tools/get_shares_stats.py @@ -0,0 +1,23 @@ +import pathlib +import market_trade.constants + +if __name__ == '__main__': + shares_maxsize_by_figi = {} + + for figi_dir in market_trade.constants.SHARES_TRADES_PATH.iterdir(): + + # we check if the path is dir, because there are unwanted files present + if figi_dir.is_dir(): + + # compiling all the shares files to list + shares_filepaths = list(figi_dir.iterdir()) + + #TODO: REDO WITH LINES COUNTING + + # getting maximum file by file size + maxsize_shares_filepath = max(shares_filepaths, key=lambda path: path.stat().st_size) + + shares_maxsize_by_figi[figi_dir.name] = maxsize_shares_filepath.stat().st_size + shares_sorted_by_liquidity = sorted(shares_maxsize_by_figi.items(), + key=lambda dict_item: dict_item[1], + reverse=True)