| | |
| | | mysqldb = mysql_data.Mysqldb() |
| | | return mysqldb.select_all(f"select * from kpl_limit_up_record where _code='{code}' and _day='{day}'") |
| | | |
| | | |
| | | @staticmethod |
| | | def list_by_block(block_name, day): |
| | | mysqldb = mysql_data.Mysqldb() |
| | |
| | | cls.__file_content_cache[key] = fdata |
| | | return fdata |
| | | |
| | | |
| | | |
| | | @classmethod |
| | | # 获取最近几天的数据,根据日期倒序返回 |
| | | def get_latest_from_file(cls, type, count): |
| | |
| | | datas = __limit_up_list_records_dict[day] |
| | | else: |
| | | logger_debug.info("从文件中获取前几天的实时涨停数据") |
| | | datas = KPLDataManager().get_latest_from_file(KPLDataType.LIMIT_UP, 10) |
| | | datas = KPLDataManager().get_latest_from_file(KPLDataType.LIMIT_UP, count + 2) |
| | | if datas: |
| | | # 保存数据 |
| | | __limit_up_list_records_dict[day] = datas |
| | |
| | | def get_yesterday_current_limit_up_records(): |
| | | yesterday_limit_up_data_records = get_current_limit_up_data_records(1)[0][1] |
| | | return yesterday_limit_up_data_records |
| | | |
| | | |
| | | # 获取最近几天涨停原因 |
| | | __latest_current_limit_up_records = {} |
| | | |
| | | |
| | | def get_latest_current_limit_up_records(): |
| | | day = tool.get_now_date_str() |
| | | if day not in __latest_current_limit_up_records: |
| | | fdatas = get_current_limit_up_data_records(15) |
| | | __latest_current_limit_up_records[day] = fdatas |
| | | return __latest_current_limit_up_records.get(day) |
| | | |
| | | |
| | | # 运行拉取任务 |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | run_pull_task() |
| | | print(get_latest_current_limit_up_records()) |
| | | print(get_latest_current_limit_up_records()) |
| | | input() |