| | |
| | | elif code_list_type == outside_api_command_manager.CODE_LIST_GREEN: |
| | | if operate == outside_api_command_manager.OPERRATE_SET: |
| | | gpcode_manager.GreenListCodeManager().add_code(code) |
| | | trade_record_log_util.add_green(code, "人为加绿") |
| | | |
| | | gpcode_manager.WantBuyCodesManager().add_code(code) |
| | | # 加白 |
| | | gpcode_manager.WhiteListCodeManager().add_code(code, is_human=True) |
| | | trade_record_log_util.add_white_buy(code, "加绿加白") |
| | | |
| | | name = gpcode_manager.get_code_name(code) |
| | | if not name: |
| | | results = HistoryKDatasUtils.get_gp_codes_names([code]) |
| | |
| | | gpcode_manager.CodesNameManager.add_first_code_name(code, results[code]) |
| | | elif operate == outside_api_command_manager.OPERRATE_DELETE: |
| | | gpcode_manager.GreenListCodeManager().remove_code(code) |
| | | gpcode_manager.WantBuyCodesManager().remove_code(code) |
| | | gpcode_manager.WhiteListCodeManager().remove_code(code) |
| | | elif operate == outside_api_command_manager.OPERRATE_GET: |
| | | codes = gpcode_manager.GreenListCodeManager().list_codes_cache() |
| | | datas = [] |
| | |
| | | if deal_big_order_info[0] <= 0: |
| | | # 大单足够,将基础比例调整至79% |
| | | threshold_rate = max(threshold_rate, 0.79) |
| | | |
| | | return max(threshold_rate, human_rate), False, (threshold_rate, human_rate) |
| | | else: |
| | | |
| | | deal_rate = round(deal_big_order_info[1] / deal_big_order_info[2], 2) |
| | | threshold_rate = 0.5 * deal_rate + 0.35 |
| | | threshold_rate = max(threshold_rate, 0.375) |
| | |
| | | """ |
| | | # 代码涨幅数据 |
| | | __current_rate_dict = {} |
| | | __current_price_dict = {} |
| | | # 最近上传时间 |
| | | __latest_upload_time = 0 |
| | | |
| | |
| | | @param price: |
| | | @return: |
| | | """ |
| | | cls.__current_price_dict[code] = price |
| | | pre_close_price = CodePrePriceManager.get_price_pre_cache(code) |
| | | if pre_close_price: |
| | | rate = round((price - pre_close_price) * 100 / pre_close_price, 2) |
| | |
| | | def get_current_rate_dict(cls): |
| | | return cls.__current_rate_dict |
| | | |
| | | @classmethod |
| | | def get_current_price_dict(cls): |
| | | return cls.__current_price_dict |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | print(Buy1PriceManager().get_limit_up_info("002777")) |
| | |
| | | codes = huaxin_target_codes_manager.HuaXinL2SubscriptCodesManager.get_subscript_codes() |
| | | if codes: |
| | | current_rate_dict = CurrentPriceManager.get_current_rate_dict() |
| | | current_price_dict = CurrentPriceManager.get_current_price_dict() |
| | | for code in codes: |
| | | deal_big_order_detail_info = None |
| | | try: |
| | |
| | | deal_big_order_info = None |
| | | code_name = gpcode_manager.get_code_name(code) |
| | | |
| | | big_order_enough = 0 |
| | | # 0 - 不够 1-即将够 2-足够 |
| | | big_order_enough_type = 0 |
| | | try: |
| | | total_deal_big_order_result = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | | code)) |
| | | # 取要求大单的10% |
| | | threshold_lack_money = int(round(total_deal_big_order_result[2] / 10)) |
| | | if total_deal_big_order_result and total_deal_big_order_result[0] <= threshold_lack_money: |
| | | big_order_enough = 1 |
| | | if total_deal_big_order_result: |
| | | if total_deal_big_order_result[0] <= 0: |
| | | big_order_enough_type = 2 |
| | | elif total_deal_big_order_result[0] <= threshold_lack_money: |
| | | big_order_enough_type = 1 |
| | | except: |
| | | pass |
| | | try: |
| | | is_limit_up = 1 if abs(current_price_dict.get(code, 0) - gpcode_manager.get_limit_up_price_as_num(code)) < 0.001 else 0 |
| | | except: |
| | | is_limit_up = 0 |
| | | pass |
| | | fresults.append( |
| | | (code, code_name, deal_big_order_info, deal_big_order_detail_info, big_order_enough, current_rate_dict.get(code, 0))) |
| | | (code, code_name, deal_big_order_info, deal_big_order_detail_info, big_order_enough_type, current_rate_dict.get(code, 0), is_limit_up)) |
| | | response_data = json.dumps({"code": 0, "data": fresults}) |
| | | except Exception as e: |
| | | response_data = json.dumps({"code": 1, "data": str(1)}) |
| | |
| | | total_lack_money_info = get_total_deal_big_order_info(code, limit_up_price, is_for_buy=for_buy) |
| | | total_lack_money, total_deal_money, total_threshold_money = total_lack_money_info[0], total_lack_money_info[1], \ |
| | | total_lack_money_info[2] |
| | | if gpcode_manager.GreenListCodeManager().is_in_cache(code): |
| | | # 加绿之后不考虑总大单 |
| | | total_lack_money = 0 |
| | | |
| | | # ===========判断单次大单成交============== |
| | | current_big_order_deal_money = 0 |
| | | current_big_order_deal_money_info = EveryLimitupBigDealOrderManager.get_big_buy_deal_order_money_info(code) |
| | |
| | | # 撤单成功需要移除红名单 |
| | | if GreenListCodeManager().is_in_cache(code): |
| | | GreenListCodeManager().remove_code(code) |
| | | if WantBuyCodesManager().is_in_cache(code): |
| | | WantBuyCodesManager().remove_code(code) |
| | | if MustBuyCodesManager().is_in_cache(code): |
| | | MustBuyCodesManager().remove_code(code) |
| | | |