Administrator
2025-06-11 01696a5d8c2c3cf3062aa6a8ccbf123547c2dbf0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 获取首板溢价率
import json
 
from third_data import kpl_api, kpl_util
from third_data.history_k_data_util import HistoryKDatasUtils
from third_data.kpl_data_manager import KPLDataManager
from utils import tool
 
 
def getFirstLimitUpPremium(day):
    results = kpl_api.getHistoryLimitUpInfo(day)
    # 保存
    # KPLDataManager.save_data("limit_up", kpl_util.parseDaBanData({"list": results, "errcode": 0}, 1))
 
    # 获取下一个交易日
    next_day = HistoryKDatasUtils.get_next_trading_date(day)
    result_list = kpl_util.parseDaBanData(json.dumps({"list": results, "errcode": 0}), kpl_util.DABAN_TYPE_LIMIT_UP)
    target_codes = set()
    for result in result_list:
        if not tool.is_can_buy_code(result[0]):
            continue
        if result[4] != '首板':
            continue
        target_codes.add(result[0])
        # TODO 获取涨停日的收盘价
 
        # 获取k线
        open_price = None
        high_price = None
        if tool.get_now_date_str() == next_day:
            records = HistoryKDatasUtils.get_gp_current_info([result[0]])
            print(records)
        else:
            records = HistoryKDatasUtils.get_history_tick_n(result[0], 15)
            for record in records:
                print(record)
 
 
if __name__ == "__main__":
    getFirstLimitUpPremium("2024-02-08")