| | |
| | | elif ctype == "set_code_today_ex_rights": |
| | | # 代码今日除权,需要更新K线 |
| | | code = data.get("code") |
| | | volumes_data = history_k_data_manager.update_history_k_bars_of_code(code, force=True) |
| | | volumes_data = history_k_data_manager.update_history_k_bars_of_code(code, force=True, juejin=True) |
| | | if not volumes_data: |
| | | result = {"code": 1, "msg": "拉取K线失败"} |
| | | else: |
| | |
| | | from utils import tool, init_data_util |
| | | |
| | | |
| | | def update_history_k_bars_of_code(code, force=True): |
| | | def update_history_k_bars_of_code(code, force=True, juejin=False): |
| | | try: |
| | | datas = init_data_util.get_volumns_by_code(code, 150) |
| | | datas = init_data_util.get_volumns_by_code(code, 150, juejin=juejin) |
| | | if datas: |
| | | HistoryKDataManager().save_history_bars(code, datas[0]['bob'].strftime("%Y-%m-%d"), datas, |
| | | force=force) |
| | |
| | | return JueJinApi.get_gp_latest_info(codes, fields) |
| | | |
| | | @classmethod |
| | | def get_history_tick_n(cls, code, count, fields=None): |
| | | def get_history_tick_n(cls, code, count, fields=None, juejin=False): |
| | | # return JueJinApi.get_history_tick_n(code, count, fields) |
| | | if constant.is_windows(): |
| | | if constant.is_windows() or juejin: |
| | | return JueJinApi.get_history_tick_n(code, count, fields) |
| | | else: |
| | | try: |
| | |
| | | |
| | | # 获取近90天的最大量与最近的量 |
| | | # 获取最近一次涨停/涨停下一个交易日的最大值 |
| | | def get_volumns_by_code(code, count=60): |
| | | datas = HistoryKDatasUtils.get_history_tick_n(code, count, "open,high,low,close,volume,pre_close,bob,amount") |
| | | def get_volumns_by_code(code, count=60, juejin=False): |
| | | datas = HistoryKDatasUtils.get_history_tick_n(code, count, "open,high,low,close,volume,pre_close,bob,amount", juejin=juejin) |
| | | if not datas: |
| | | return None |
| | | # 计算 |