| | |
| | | current_price = L1DataManager.get_l1_current_price(code) |
| | | if current_price: |
| | | fdata["cost_price"] = current_price |
| | | pre_close_price = CodePrePriceManager.get_price_pre_cache(code) |
| | | pre_close_price = CodePrePriceManager().get_price_pre_cache(code) |
| | | if current_price and pre_close_price: |
| | | rate = round((float(current_price) - float(pre_close_price)) / float(pre_close_price), 4) |
| | | fdata["cost_price_rate"] = rate |
| | |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | result = {"code": 0, "data": {"account_available_money": account_available_money, "delegates": fdatas}} |
| | | result = {"code": 0, "data": {"account_available_money": account_available_money, "delegates": fdatas, "rate_of_increase_step": constant.L_DOWN_RATE_INCREASE_STEP}} |
| | | self.send_response(result, client_id, request_id) |
| | | elif ctype == "get_delegated_buy_code_infos_v2": |
| | | account_available_money = trade_data_manager.AccountMoneyManager().get_available_money_cache() |
| | |
| | | l_down_cancel_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code, |
| | | buy_mode=OrderBeginPosInfo.MODE_RADICAL) |
| | | |
| | | # 计算大单成交 |
| | | # (缺少的资金, 净成交金额, 要求的大单金额, 计算得到的大单阈值金额, 人为设置的大单) |
| | | deal_big_money_info = radical_buy_data_manager.get_total_deal_big_order_info( |
| | | code, gpcode_manager.get_limit_up_price_as_num(code)) |
| | | |
| | | fdata = {"id": orderSysID, "code_info": (code, code_name), |
| | | "buy1_money": output_util.money_desc(buy1_money), |
| | | "left_count": total_left_count, |
| | |
| | | "block": '', |
| | | "trade_queue": [], |
| | | "l_down_cancel_rate": l_down_cancel_rate, |
| | | "l_down_cancel_rate_info": cancel_rate_info, |
| | | "l_down_cancel_rate_info": cancel_rate_info |
| | | } |
| | | if deal_big_money_info: |
| | | fdata["deal_big_money_info"] = deal_big_money_info |
| | | |
| | | limit_up_data = kpl_data_manager.KPLLimitUpDataRecordManager.record_code_dict.get(code) |
| | | # 获取当前板块 |
| | | try: |
| | |
| | | "special_codes_max_block_in_rank": constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL, |
| | | "ignore_block_in_money_market_strong": constant.IGNORE_BLOCK_IN_MONEY_MARKET_STRONG, |
| | | "buy_first_limit_up": 1 if constant.CAN_BUY_FIRST_LIMIT_UP else 0, |
| | | "can_auto_add_white": 1 if constant.CAN_AUTO_ADD_WHITE else 0 |
| | | "can_auto_add_white": 1 if constant.CAN_AUTO_ADD_WHITE else 0, |
| | | "can_auto_add_want_buy_codes": 1 if constant.CAN_AUTO_ADD_WANT_BUY_CODES else 0 |
| | | }} |
| | | self.send_response({"code": 0, "data": data, "msg": f""}, |
| | | client_id, |
| | |
| | | if radical_buy.get('can_auto_add_white') is not None: |
| | | constant.CAN_AUTO_ADD_WHITE = True if radical_buy.get( |
| | | 'can_auto_add_white') else False |
| | | if radical_buy.get('can_auto_add_want_buy_codes') is not None: |
| | | constant.CAN_AUTO_ADD_WANT_BUY_CODES = True if radical_buy.get( |
| | | 'can_auto_add_want_buy_codes') else False |
| | | |
| | | self.send_response({"code": 0, "data": {}, "msg": f""}, |
| | | client_id, |
| | |
| | | CancelRateHumanSettingManager().set_l_down(code, rate) |
| | | # L后重新囊括 |
| | | # if rate < old_rate: |
| | | # 改小才能重新囊括 |
| | | # 改小才能重新囊括 |
| | | trade_record_log_util.add_common_msg(code, "L后重新囊括", msg=f"修改撤单比例: {old_rate}->{rate}") |
| | | LCancelBigNumComputer().re_compute_l_down_watch_indexes(code, is_force=True) |
| | | |
| | |
| | | self.send_response({"code": 0, "data": {}}, |
| | | client_id, |
| | | request_id) |
| | | |
| | | elif ctype == "set_code_today_ex_rights": |
| | | # 代码今日除权,需要更新K线 |
| | | code = data.get("code") |
| | | volumes_data = history_k_data_manager.update_history_k_bars_of_code(code, force=True, juejin=True) |
| | | if not volumes_data: |
| | | result = {"code": 1, "msg": "拉取K线失败"} |
| | | else: |
| | | # 更新昨日收盘价数据 |
| | | CodePrePriceManager().set_price_pre(code, volumes_data[0]['close'], force=True) |
| | | gpcode_manager.clear_limit_up_price_cache(code) |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | # 更新K线特征数据 |
| | | k_format = code_nature_analyse.get_k_format(code, limit_up_price, volumes_data) |
| | | code_nature_analyse.CodeNatureRecordManager().save_k_format(code, k_format) |
| | | result = {"code": 0, "msg": "设置成功"} |
| | | self.send_response(result, |
| | | client_id, |
| | | request_id) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | logger_debug.exception(e) |