# 获取首板溢价率
|
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")
|