| | |
| | | if not can_buy_result[0] and can_buy_result[1]: |
| | | info.set_kpl_match_blocks(["独苗"]) |
| | | elif not can_buy_result[0] and not can_buy_result[1]: |
| | | info.set_kpl_match_blocks("非独苗不满足身位") |
| | | info.set_kpl_match_blocks(["非独苗不满足身位"]) |
| | | else: |
| | | info.set_kpl_match_blocks(can_buy_result[0]) |
| | | trade_record_log_util.add_place_order_log(code, info) |
New file |
| | |
| | | # 获取首板溢价率 |
| | | import json |
| | | |
| | | from third_data import kpl_api, kpl_util |
| | | from third_data.history_k_data_util import HistoryKDatasUtils |
| | | from utils import tool |
| | | |
| | | |
| | | def getFirstLimitUpPremium(day): |
| | | results = kpl_api.getHistoryLimitUpInfo(day) |
| | | # 获取下一个交易日 |
| | | 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_shsz_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("2023-12-26") |
New file |
| | |
| | | """ |
| | | 买入条件工具 |
| | | """ |
| | | # 获取自由流通市值限制 |
| | | # 返回:(最大买入,最优自由流通最小,最优自由流通最大) |
| | | from trade.trade_manager import MarketSituationManager |
| | | |
| | | |
| | | def get_zyltgb_threshold(market_sitation: int): |
| | | if market_sitation == MarketSituationManager.SITUATION_GOOD: |
| | | return 100 * 100000000, 20 * 100000000, 60 * 100000000 |
| | | |
| | | return 40 * 100000000, 10 * 100000000, 20 * 100000000 |