| | |
| | | |
| | | # 代码对应的价格是否正确 |
| | | def is_same_code_with_price(code, price): |
| | | if code == '600066': |
| | | print('进入调试') |
| | | # 昨日收盘价 |
| | | price_close = gpcode_manager.get_price_pre(code) |
| | | max_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal("1.1")) |
| | |
| | | if min_price <= decimal.Decimal(str(price)) <= max_price: |
| | | return True |
| | | return False |
| | | |
| | | |
| | | # 自由流通股本工具类 |
| | | class ZYLTGBUtil: |
| | |
| | | mysqldb.execute( |
| | | "update ths_zylt set zyltgb='{}',zyltgb_unit={},update_time={} where _id='{}'".format( |
| | | data["zyltgb"], data["zyltgb_unit"], round(time.time() * 1000), data["code"])) |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | print(is_same_code_with_price("000617", 17.89)) |
| | |
| | | p4 = __is_near_new_top(limit_up_price, record_datas) |
| | | p5 = __is_n_model(record_datas) |
| | | p6 = __is_v_model(record_datas) |
| | | # N字型包含了N字型 |
| | | if p5: |
| | | p6 = False, '' |
| | | return (p1, p2, p3, p4, p5, p6) |
| | | |
| | | # # N字型包含了N字型 |
| | | # if p5: |
| | | # p6 = False, '' |
| | | |
| | | p7 = (p1[0] or p2[0] or p3[0] or p4[0] or p5[0] or p6[0], '') |
| | | |
| | | return p1, p2, p3, p4, p5, p6, p7 |
| | | |
| | | |
| | | # 是否具有K线形态 |
| | | def is_has_k_format(limit_up_price, record_datas): |
| | | is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v = get_k_format(float(limit_up_price), record_datas) |
| | | |
| | | # if is_too_high: |
| | | # return False, "15个交易日涨幅大于24.9%" |
| | | # if is_near_new_top: |
| | | # return False, "逼近前高" |
| | | if is_new_top: |
| | | return True, "破前高" |
| | | if is_lowest: |
| | | return True, "超跌补涨" |
| | | if is_n: |
| | | return True, "N字型" |
| | | if is_v: |
| | | return True, "V字形" |
| | | return False, "不满足K线形态" |
| | | |
| | | is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v, has_format = get_k_format(float(limit_up_price), record_datas) |
| | | if not has_format: |
| | | return False, "不满足K线形态" |
| | | return True, "有形态" |
| | | |
| | | # 获取股性 |
| | | # 返回(是否涨停,首板溢价率是否大于0.6) |
| | | def get_nature(record_datas): |
| | | limit_up = is_have_limit_up(record_datas) |
| | | premium_rate = get_limit_up_premium_rate(record_datas) |
| | | result = (limit_up, premium_rate >= 0.6,premium_rate) |
| | | result = (limit_up, premium_rate >= 0.6, premium_rate) |
| | | |
| | | return result |
| | | |
| | |
| | | # 设置历史量 |
| | | def set_histry_volumn(code, max60, yesterday, max60_day=''): |
| | | redis = __redis_manager.getRedis() |
| | | global_util.max60_volumn[code] = max60 |
| | | global_util.max60_volumn[code] = (max60,max60_day) |
| | | global_util.yesterday_volumn[code] = yesterday |
| | | redis.setex("volumn_max60-{}".format(code), tool.get_expire(), json.dumps((max60,max60_day))) |
| | | redis.setex("volumn_yes-{}".format(code), tool.get_expire(), yesterday) |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | print(get_histry_volumn("603717")) |
| | | print(get_volume_rate("000059")) |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | codes = ["003021"] |
| | | codes = ["002717"] |
| | | for code in codes: |
| | | export_l2_excel(code) |
| | |
| | | dict = json.loads(str) |
| | | return dict["type"] |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | # logging.exception(e) |
| | | logger_l2_error.error(str) |
| | | raise e |
| | | |
| | | print(str) |
| | | return -1 |
| | |
| | | |
| | | |
| | | # 设置收盘价 |
| | | def set_price_pre(code, price): |
| | | def set_price_pre(code, price, force=False): |
| | | codes = get_gp_list() |
| | | if code not in codes: |
| | | if code not in codes and not FirstCodeManager.is_in_first_record(code) and not force: |
| | | return |
| | | redis_instance = __redisManager.getRedis() |
| | | redis_instance.setex("price-pre-{}".format(code), tool.get_expire(), str(price)) |
| | |
| | | # 取第1个数据 |
| | | return available_positions[0][0], available_positions[0][1] |
| | | |
| | | |
| | | |
| | | return None, None |
| | | |
| | | |
| | |
| | | if val is None: |
| | | return None, None |
| | | val = json.loads(val) |
| | | return val[0], val[1] |
| | | cid, pid = val[0], val[1] |
| | | code_ = get_listen_code_by_pos(cid, pid) |
| | | # 校验代码 |
| | | if code_ == code: |
| | | return cid, pid |
| | | else: |
| | | return None, None |
| | | |
| | | |
| | | # 是否正在监听 |
| | |
| | | re_set_price_pres(codes) |
| | | |
| | | |
| | | def re_set_price_pres(codes): |
| | | def re_set_price_pres(codes, force=False): |
| | | result = JueJinManager.get_gp_latest_info(codes) |
| | | for item in result: |
| | | symbol = item['symbol'] |
| | | symbol = symbol.split(".")[1] |
| | | pre_close = tool.to_price(decimal.Decimal(str(item['pre_close']))) |
| | | gpcode_manager.set_price_pre(symbol, pre_close) |
| | | gpcode_manager.set_price_pre(symbol, pre_close, force) |
| | | |
| | | |
| | | __prices_now = {} |
| | |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | datas = (get_volumns_by_code("603083", 150)) |
| | | print(datas) |
| | | print(get_limit_up_money_percent(datas)) |
| | | # datas = (get_volumns_by_code("603083", 150)) |
| | | # print(datas) |
| | | # print(get_limit_up_money_percent(datas)) |
| | | everyday_init() |
| | |
| | | from l2.l2_data_manager import L2DataException, TradePointManager |
| | | from l2.l2_data_util import local_today_datas, L2DataUtil, load_l2_data, local_today_num_operate_map, local_latest_datas |
| | | import l2.l2_data_util |
| | | from log import logger_l2_trade, logger_l2_trade_cancel, logger_l2_trade_buy, logger_l2_process, logger_l2_error |
| | | from log import logger_l2_trade, logger_l2_trade_cancel, logger_l2_trade_buy, logger_l2_process, logger_l2_error,logger_buy_score |
| | | |
| | | # TODO l2数据管理 |
| | | from trade.trade_data_manager import CodeActualPriceProcessor |
| | |
| | | limit_up_time = limit_up_time_manager.get_limit_up_time(code) |
| | | if limit_up_time is None: |
| | | limit_up_time = tool.get_now_time_str() |
| | | score = first_code_score_manager.get_score(code, volume_rate, limit_up_time) |
| | | score = first_code_score_manager.get_score(code, volume_rate, limit_up_time,True) |
| | | cls.__l2PlaceOrderParamsManagerDict[code] = l2_trade_factor.L2PlaceOrderParamsManager(code, is_first_code, |
| | | volume_rate, |
| | | volume_rate_index, |
| | |
| | | return |
| | | else: |
| | | l2_log.debug(code, "可以下单,原因:{}", reason) |
| | | logger_buy_score.info(f"{code}:{cls.__l2PlaceOrderParamsManagerDict[code].score_info}") |
| | | try: |
| | | l2_log.debug(code, "开始执行买入") |
| | | trade_manager.start_buy(code, capture_timestamp, last_data, |
| | |
| | | score = cls.__l2PlaceOrderParamsManagerDict[code].score |
| | | if score_index < 0: |
| | | return False, True, f"分值:{score}未达到需要买入的分数线" |
| | | if -1 < score_index < 3: |
| | | return True, False, f"分值:{score}达到主动买入的分数线,买入等级:f{score_index}" |
| | | # if -1 < score_index < 3: |
| | | # return True, False, f"分值:{score}达到主动买入的分数线,买入等级:f{score_index}" |
| | | is_limited_up = gpcode_manager.FirstCodeManager.is_limited_up(code) |
| | | gpcode_manager.FirstCodeManager.add_limited_up_record([code]) |
| | | if not code_price_manager.Buy1PriceManager.is_can_buy(code): |
| | |
| | | filter=lambda record: record["extra"].get("name") == "debug", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | logger.add(self.get_path("score", "buy_score"), |
| | | filter=lambda record: record["extra"].get("name") == "score", |
| | | rotation="00:00", compression="zip", enqueue=True) |
| | | |
| | | def get_path(self, dir_name, log_name): |
| | | return "D:/logs/gp/{}/{}".format(dir_name, log_name) + ".{time:YYYY-MM-DD}.log" |
| | | |
| | |
| | | |
| | | logger_debug = __mylogger.get_logger("debug") |
| | | |
| | | logger_buy_score = __mylogger.get_logger("buy_score") |
| | | |
| | | |
| | | class LogUtil: |
| | | @classmethod |
| | |
| | | # 获取当前量信息 |
| | | max_60, yest = code_volumn_manager.get_histry_volumn(code) |
| | | today = code_volumn_manager.get_today_volumn(code) |
| | | score_source_list_new.append(f"实时量【{round(int(today)/10000,2)}万手】÷前高量【{round(max_60[0]/10000,2)}万手-{max_60[1]}】=【{round(score_source_list[6]*100,2)}%】") |
| | | score_source_list_new.append(f"实时量【{round(int(today)/1000000,2)}万手】÷前高量【{round(max_60[0]/1000000,2)}万手-{max_60[1]}】=【{round(score_source_list[6]*100,2)}%】") |
| | | # 竞价强度 |
| | | score_list_new.append(score_list[2]) |
| | | score_source_list_new.append(f"开盘啦今日委停【{score_source_list[2] if score_source_list[2] else 0}万】") |
| | | # 资金力度 |
| | | score_list_new.append(score_list[8]) |
| | | score_source_list_new.append(f"累计金额【{score_source_list[8][0] / 10000}万】&固定m值【{score_source_list[8][1] / 10000}万】") |
| | | score_source_list_new.append(f"累计金额【{score_source_list[8][0] // 10000}万】&固定m值【{score_source_list[8][1] // 10000}万】") |
| | | # K线形态 |
| | | k_score = 0 |
| | | k_source = [] |
| | |
| | | elif k == 5: |
| | | if score_source_list[3][k][0]: |
| | | k_source.append("【V字型】") |
| | | |
| | | if not score_source_list[3][1][0] and not score_source_list[3][2][0] and not score_source_list[3][4][0] and not \ |
| | | score_source_list[3][5][0]: |
| | | k_source.append("【不满足任何形态】") |
| | | elif k == 6: |
| | | if not score_source_list[3][k][0]: |
| | | k_source.append("【不满足任何形态】") |
| | | |
| | | score_list_new.append(k_score) |
| | | score_source_list_new.append("/".join(k_source)) |
| | |
| | | __L2PlaceOrderParamsManager = l2_trade_factor.L2PlaceOrderParamsManager(code, True, volume_rate, |
| | | code_volumn_manager.get_volume_rate_index( |
| | | volume_rate), |
| | | (score, score_list)) |
| | | ((score, score_list),score_source_list)) |
| | | __base_L2PlaceOrderParamsManager = l2_trade_factor.L2PlaceOrderParamsManager(code, False, volume_rate, |
| | | code_volumn_manager.get_volume_rate_index( |
| | | volume_rate), |
| | | (score, score_list)) |
| | | ((score, score_list),score_source_list)) |
| | | buy_params_info = [] |
| | | if -1 < __L2PlaceOrderParamsManager.score_index < 3: |
| | | buy_params_info.append("<font color='red'>【主动买入】</font>") |
| | |
| | | type = -1 |
| | | try: |
| | | type = data_process.parseType(_str) |
| | | except: |
| | | print(_str) |
| | | except Exception as e: |
| | | if str(e).find("Unterminated string starting") > -1: |
| | | _str = _str.replace("\n", "") |
| | | type = data_process.parseType(_str) |
| | | else: |
| | | print(_str) |
| | | return_str = "OK" |
| | | if type == 0: |
| | | try: |
| | |
| | | |
| | | bad_codes = set() |
| | | |
| | | # 获取昨日收盘价 |
| | | for code in codes: |
| | | # 如果涨停价是空值就需要设置昨日收盘价格 |
| | | if gpcode_manager.get_limit_up_price(code) is None: |
| | | juejin.re_set_price_pres([code], True) |
| | | |
| | | # 获取60天最大记录 |
| | | for code in codes: |
| | | need_get_volumn = False |
| | | if code not in global_util.max60_volumn or global_util.max60_volumn.get(code) is None: |
| | | need_get_volumn = True |
| | | if not need_get_volumn and code_nature_analyse.CodeNatureRecordManager.get_nature( |
| | | code) is None: |
| | | need_get_volumn = True |
| | | if need_get_volumn: |
| | | volumes_data = juejin.get_volumns_by_code(code, 150) |
| | | volumes = juejin.parse_max_volume(volumes_data[:60], code_nature_analyse.is_new_top( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data[:60])) |
| | | logger_first_code_record.info("{} 获取到首板60天最大量:{}", code, volumes) |
| | | code_volumn_manager.set_histry_volumn(code, volumes[0], volumes[1], volumes[2]) |
| | | # 判断K线形态 |
| | | is_has_k_format, msg = code_nature_analyse.is_has_k_format( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data) |
| | | if not is_has_k_format: |
| | | logger_first_code_record.info("{}首板K线形态不好,{}", code, msg) |
| | | # 股性不好,就不要加入 |
| | | bad_codes.add(code) |
| | | # 加入禁止交易代码 |
| | | l2_trade_util.forbidden_trade(code) |
| | | code_nature_analyse.set_record_datas(code, |
| | | gpcode_manager.get_limit_up_price(code), |
| | | volumes_data) |
| | | gpcode_manager.FirstCodeManager.add_record(codes) |
| | | if new_add_codes: |
| | | gpcode_manager.set_first_gp_codes_with_data(juejin.JueJinManager.get_gp_latest_info(codes)) |
| | | # 加入首板历史记录 |
| | | gpcode_manager.FirstCodeManager.add_record(new_add_codes) |
| | | |
| | | logger_first_code_record.info("新增首板:{}", new_add_codes) |
| | | # 获取60天最大记录 |
| | | for code in codes: |
| | | need_get_volumn = False |
| | | if code not in global_util.max60_volumn or global_util.max60_volumn.get(code) is None: |
| | | need_get_volumn = True |
| | | if not need_get_volumn and code_nature_analyse.CodeNatureRecordManager.get_nature( |
| | | code) is None: |
| | | need_get_volumn = True |
| | | if need_get_volumn: |
| | | volumes_data = juejin.get_volumns_by_code(code, 150) |
| | | volumes = juejin.parse_max_volume(volumes_data[:60], code_nature_analyse.is_new_top( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data[:60])) |
| | | logger_first_code_record.info("{} 获取到首板60天最大量:{}", code, volumes) |
| | | code_volumn_manager.set_histry_volumn(code, volumes[0], volumes[1], volumes[2]) |
| | | # 判断K线形态 |
| | | is_has_k_format, msg = code_nature_analyse.is_has_k_format( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data) |
| | | if not is_has_k_format: |
| | | logger_first_code_record.info("{}首板K线形态不好,{}", code, msg) |
| | | # 股性不好,就不要加入 |
| | | bad_codes.add(code) |
| | | # 加入禁止交易代码 |
| | | l2_trade_util.forbidden_trade(code) |
| | | code_nature_analyse.set_record_datas(code, |
| | | gpcode_manager.get_limit_up_price(code), |
| | | volumes_data) |
| | | |
| | | # 移除代码 |
| | | listen_codes = gpcode_manager.get_listen_codes() |
| | |
| | | |
| | | gpcode_first_screen_manager.process_ticks(prices) |
| | | except Exception as e: |
| | | pass |
| | | logging.exception(e) |
| | | |
| | | elif type == 3: |
| | | # 交易成功信息 |
| | |
| | | # 获取最近2个交易日涨停代码 |
| | | elif type == 72: |
| | | day = tool.get_now_date_str() |
| | | last_day = juejin.JueJinManager.get_previous_trading_date(day) |
| | | data_list = list(hot_block_data_process.XGBHotBlockDataManager.list_all(day)) |
| | | data_list_last = list(hot_block_data_process.XGBHotBlockDataManager.list_all(last_day)) |
| | | data_list.extend(data_list_last) |
| | | codes_set = set() |
| | | if data_list: |
| | | for d in data_list: |
| | | if len(d[4]) > 6: |
| | | codes_set.add(d[3]) |
| | | return_str = json.dumps({"code": 0, "data": list(codes_set)}) |
| | | data_dict={} |
| | | for i in range(0, 2): |
| | | day = juejin.JueJinManager.get_previous_trading_date(day) |
| | | data_list = list(hot_block_data_process.XGBHotBlockDataManager.list_all(day)) |
| | | codes_set = set() |
| | | if data_list: |
| | | for d in data_list: |
| | | if len(d[4]) > 6: |
| | | codes_set.add(d[3]) |
| | | data_dict[day] = list(codes_set) |
| | | return_str = json.dumps({"code": 0, "data": data_dict}) |
| | | elif type == 201: |
| | | # 加入黑名单 |
| | | data = json.loads(_str) |
| | |
| | | l2_listen_pos_health_manager.init_all(client_infos) |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | codes = ["002153", "002253", "002351"] |
| | | for code in codes: |
| | | global_data_loader.load_zyltgb() |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price(code)) |
| | | volumes_data = juejin.get_volumns_by_code(code, 150) |
| | | volumes_data = volumes_data[1:] |
| | | volumes = juejin.parse_max_volume(volumes_data[:60], |
| | | code_nature_analyse.is_new_top(gpcode_manager.get_limit_up_price(code), |
| | | volumes_data[:60])) |
| | | logger_first_code_record.info("{} 获取到首板60天最大量:{}", code, volumes) |
| | | code_volumn_manager.set_histry_volumn(code, volumes[0], volumes[1], volumes[2]) |
| | | # 判断K线形态 |
| | | is_has_k_format, msg = code_nature_analyse.is_has_k_format( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data) |
| | | if not is_has_k_format: |
| | | logger_first_code_record.info("{}首板K线形态不好,{}", code, msg) |
| | | # 加入禁止交易代码 |
| | | l2_trade_util.forbidden_trade(code) |
| | | if __name__ == "__main__1": |
| | | cid, pid = gpcode_manager.get_listen_code_pos("000070") |
| | | print(cid, pid) |
| | | |
| | | code_nature_analyse.set_record_datas(code, |
| | | gpcode_manager.get_limit_up_price(code), |
| | | volumes_data) |
| | | if __name__ == "__main__": |
| | | codes = ["603655"] |
| | | for code in codes: |
| | | try: |
| | | global_data_loader.load_zyltgb() |
| | | limit_up_price = float(gpcode_manager.get_limit_up_price(code)) |
| | | volumes_data = juejin.get_volumns_by_code(code, 150) |
| | | volumes = juejin.parse_max_volume(volumes_data[:60], |
| | | code_nature_analyse.is_new_top(gpcode_manager.get_limit_up_price(code), |
| | | volumes_data[:60])) |
| | | logger_first_code_record.info("{} 获取到首板60天最大量:{}", code, volumes) |
| | | code_volumn_manager.set_histry_volumn(code, volumes[0], volumes[1], volumes[2]) |
| | | # 判断K线形态 |
| | | is_has_k_format, msg = code_nature_analyse.is_has_k_format( |
| | | gpcode_manager.get_limit_up_price(code), volumes_data) |
| | | if not is_has_k_format: |
| | | logger_first_code_record.info("{}首板K线形态不好,{}", code, msg) |
| | | # 加入禁止交易代码 |
| | | l2_trade_util.forbidden_trade(code) |
| | | |
| | | code_nature_analyse.set_record_datas(code, |
| | | gpcode_manager.get_limit_up_price(code), |
| | | volumes_data) |
| | | except: |
| | | pass |
| | | |
| | | # code_nature_analyse.set_record_datas(code, |
| | | # limit_up_price, |
| | |
| | | import tool |
| | | from db import redis_manager |
| | | from db import mysql_data |
| | | import limit_up_time_manager |
| | | import gpcode_manager |
| | | |
| | | __redisManager = redis_manager.RedisManager(0) |
| | | |
| | |
| | | codes = [] |
| | | for code_data in block[2]: |
| | | code = code_data[0].split(".")[0] |
| | | if gpcode_manager.FirstCodeManager.is_in_first_record(code): |
| | | limit_up_time = code_data[4] |
| | | if limit_up_time and len(limit_up_time) > 6: |
| | | if not limit_up_time_manager.get_limit_up_time(code): |
| | | limit_up_time_manager.save_limit_up_time(code, limit_up_time) |
| | | if code not in code_block_dict: |
| | | code_block_dict[code] = set() |
| | | code_block_dict[code].add(block[0]) |
| | |
| | | # zyltgb自由流通市值是否大于250亿 |
| | | # limit_price 涨停价是否大于100块 |
| | | # limit_up_time 是否10点之前涨停 |
| | | # k_form(15个交易日是否涨幅24.9%,是否破前高,是否超跌,是否接近前高,是否N,是否V) |
| | | # k_form(15个交易日是否涨幅24.9%,是否破前高,是否超跌,是否接近前高,是否N,是否V,是否有形态) |
| | | import code_nature_analyse |
| | | import global_data_loader |
| | | import global_util |
| | |
| | | score_list = [] |
| | | if zyltgb: |
| | | zyltgbs = [0, 10, 31, 51, 101, 150, 250, 1000000] |
| | | zyltgb_score = [5, 25, 20, 15, 10, 5, -80] |
| | | zyltgb_score = [20, 30, 20, 10, 0, -10, -20] |
| | | for i in range(1, len(zyltgbs)): |
| | | if zyltgbs[i - 1] <= zyltgb / 100000000 < zyltgbs[i]: |
| | | score_list.append(zyltgb_score[i - 1]) |
| | |
| | | k_score = [] |
| | | # 15个交易日是否涨幅24.9% |
| | | if k_form[0]: |
| | | k_score.append(-25) |
| | | k_score.append(-55) |
| | | else: |
| | | k_score.append(0) |
| | | # 是否破前高 |
| | | |
| | | # 是否破前高 |
| | | if k_form[1]: |
| | | k_score.append(50) |
| | | k_score.append(65) |
| | | else: |
| | | k_score.append(0) |
| | | # 是否超跌 |
| | | if k_form[2]: |
| | | k_score.append(40) |
| | | k_score.append(45) |
| | | else: |
| | | k_score.append(0) |
| | | |
| | |
| | | k_score.append(0) |
| | | # 是否N |
| | | if k_form[4]: |
| | | k_score.append(35) |
| | | k_score.append(40) |
| | | else: |
| | | k_score.append(0) |
| | | # 是否V |
| | | if k_form[5]: |
| | | k_score.append(30) |
| | | k_score.append(35) |
| | | else: |
| | | k_score.append(0) |
| | | |
| | | # 是否有形态 |
| | | if k_form[6]: |
| | | k_score.append(0) |
| | | else: |
| | | k_score.append(-25) |
| | | |
| | | score_list.append(k_score) |
| | | |
| | | nature_score = [] |
| | |
| | | score_list.append(nature_score) |
| | | |
| | | hot_block_score = [] |
| | | |
| | | if hot_block[1] >= 2: |
| | | hot_block_score.append(40) |
| | | # 板块中只有自己涨停,且无炸板 |
| | | if hot_block[1] == 1 and hot_block[2] == 0: |
| | | hot_block_score.append(25) |
| | | elif hot_block[1] >= 2 and hot_block[2] == 0: |
| | | hot_block_score.append(35) |
| | | else: |
| | | hot_block_score.append(30) |
| | | if hot_block[2] > 0: |
| | | hot_block_score.append(10) |
| | | else: |
| | | hot_block_score.append(0) |
| | | hot_block_score.append(5) |
| | | score_list.append(hot_block_score) |
| | | |
| | | # 量 |
| | | volume_score = [0, 40, 50, 40, 30, 10, -15, -35] |
| | | volume_rates = [0, 0.499, 0.649, 0.799, 0.949, 1.099, 1.249, 1.399] |
| | | volume_score = [0, 35, 45, 55, 45, 35, 15, -5, -30] |
| | | volume_rates = [0, 0.349, 0.499, 0.649, 0.799, 0.949, 1.099, 1.249, 1.399] |
| | | volume_add = False |
| | | for i in range(1, len(volume_rates)): |
| | | if volume_rates[i - 1] <= volume_rate < volume_rates[i]: |
| | |
| | | score_list.append(volume_score[-1]) |
| | | |
| | | if limit_up_time: |
| | | score_list.append(20) |
| | | times = ["10:00:00", "11:30:00", "14:00:00", "15:00:00"] |
| | | time_scores = [15, 10, 5, 0] |
| | | for i in range(0, len(times)): |
| | | if int(times[i].replace(":", "")) >= int(limit_up_time.replace(":", "")): |
| | | score_list.append(time_scores[i]) |
| | | break |
| | | else: |
| | | score_list.append(0) |
| | | |
| | |
| | | |
| | | k_form = code_nature_analyse.CodeNatureRecordManager.get_k_format(code) |
| | | if k_form is None: |
| | | k_form = [(True, ''), (False, ''), (False, ''), (False, ''), (False, ''), (False, '')] |
| | | k_form = [(True, ''), (False, ''), (False, ''), (False, ''), (False, ''), (False, ''), (True, '')] |
| | | source_datas.append(k_form) |
| | | |
| | | code_nature = code_nature_analyse.CodeNatureRecordManager.get_nature(code) |
| | |
| | | source_datas.append(volume_rate) |
| | | |
| | | source_datas.append(limit_up_time) |
| | | if limit_up_time and tool.trade_time_sub(limit_up_time, "10:00:00") < 0: |
| | | limit_up_time = True |
| | | else: |
| | | limit_up_time = False |
| | | |
| | | # 获取成交大单 |
| | | deal_big_num = deal_big_money_manager.get_deal_big_money_num(code) |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | global_data_loader.load_zyltgb() |
| | | score = get_score("000779", 1.2, "15:00:01", True) |
| | | score = get_score("603829", 1.2, "15:00:01", True) |
| | | print(score) |
| | |
| | | self.code = code |
| | | self.is_first_code = is_first_code |
| | | score_ranks = [200, 190, 180, 100] |
| | | self.score = score[0] |
| | | self.score = score[0][0] |
| | | self.score_info = score |
| | | # 为分数设置等级 |
| | | score_index = -1 |
| | | for i in range(0, len(score_ranks)): |