import decimal import l2_data_util from code_attribute.code_data_util import ZYLTGBUtil from code_attribute.gpcode_manager import CodesNameManager from huaxin_client import l1_subscript_codes_manager from third_data.history_k_data_manager import HistoryKDataManager from third_data.history_k_data_util import JueJinHttpApi, HistoryKDatasUtils from utils import tool, init_data_util def test_active_buy(): current_rank = 2 TIME_STR_RANGES = ["10:00:00", "10:30:00", "11:00:00", "13:00:00", "13:30:00", "14:00:00", "14:30:00", "15:00:00"] TIME_INT_RANGES = [int(x.replace(':', '')) for x in TIME_STR_RANGES] MAX_RANKS = [3, 3, 2, 2, 1, 0, 0, 0] now_time_str = "09:36:00".replace(':', '') for i in range(len(TIME_INT_RANGES)): if int(now_time_str) <= TIME_INT_RANGES[i]: if MAX_RANKS[i] > current_rank: return True break return False if __name__ == "__main__": # codes = ["600859", "000333"] # for code in codes: # datas = init_data_util.get_volumns_by_code(code) # HistoryKDataManager().save_history_bars(code, datas[0]['bob'].strftime("%Y-%m-%d"), datas, force=True) codes = HistoryKDataManager().get_history_bars_codes("2024-07-02") print(codes) # print(count) # print(HistoryKDataManager().get_history_bars(code, "2024-07-02"))