| | |
| | | |
| | | elif ctype == "test_place_order": |
| | | # 获取相同板块的涨停代码数量 |
| | | code = data.get("code") |
| | | total_datas = l2_data_util.local_today_datas.get(code) |
| | | trade_manager.test_order(code, total_datas[-1], total_datas[-1]["index"]) |
| | | # code = data.get("code") |
| | | # total_datas = l2_data_util.local_today_datas.get(code) |
| | | # trade_manager.test_order(code, total_datas[-1], total_datas[-1]["index"]) |
| | | self.send_response({"code": 0, "data": {}}, |
| | | client_id, |
| | | request_id) |
| | |
| | | RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL = 20 |
| | | |
| | | # 是否为新版下单 |
| | | IS_NEW_VERSION_PLACE_ORDER = True |
| | | IS_NEW_VERSION_PLACE_ORDER = False |
| | |
| | | deals_month = trade_data_manager.AccountMoneyManager().get_deal_count_info(start_date, end_date) |
| | | cost_month = sum([round(0.1 * x[1], 2) for x in delegates_month]) |
| | | make_month = 0 |
| | | make_month += 5 * deals_month[0][1] + 1 * deals_month[1][1] + 0 * deals_month[2][1] |
| | | make_month += max(1 * deals_month[0][1], deals_month[0][2] * 1.854/10000) + 1 * deals_month[1][1] + 0 * deals_month[2][1] |
| | | fdata["month_commission"] = round(make_month - cost_month, 2) |
| | | # 计算当日手续费详情 |
| | | delegates = trade_data_manager.AccountMoneyManager().get_delegated_count_info() |
| | |
| | | fdata["delegates"]["sell"] = delegates[3] |
| | | deals = trade_data_manager.AccountMoneyManager().get_deal_count_info() |
| | | fdata["deals"] = {} |
| | | fdata["deals"]["stock"] = {"count": deals[0][1], "price": 5, "money": round(5 * deals[0][1], 2)} |
| | | fdata["deals"]["stock"] = {"count": deals[0][1], "price": 1, "money": round(1 * deals[0][1], 2)} |
| | | fdata["deals"]["sh_cb"] = {"count": deals[1][1], "price": 1, "money": round(1 * deals[1][1], 2)} |
| | | fdata["deals"]["sz_cb"] = {"count": deals[2][1], "price": 0, "money": round(0 * deals[2][1], 2)} |
| | | fdata["commission"] = trade_data_manager.AccountMoneyManager().get_commission_cache() |
| | |
| | | datas_ = LatestLimitUpBlockManager().statistics_limit_up_block_infos() |
| | | if datas_: |
| | | for data_ in datas_: |
| | | if data_[2] >= 3: |
| | | # 连续2天的板块就不买 |
| | | if data_[2] >= 2: |
| | | KPLPlateForbiddenManager().save_plate(data_[0]) |
| | | except: |
| | | pass |
| | |
| | | """ |
| | | 最近涨停的板块管理 |
| | | """ |
| | | # 看最近3天,不包含今天 |
| | | __LATEST_DAY_COUNT = 3 |
| | | # 看最近2天,不包含今天 |
| | | __LATEST_DAY_COUNT = 2 |
| | | |
| | | __days = [] |
| | | # 目前涨停 |
| | |
| | | |
| | | sql = "SELECT * FROM ( " |
| | | |
| | | sql += f"SELECT '股票', COUNT(*) FROM (SELECT * FROM `hx_trade_deal_record` r WHERE r.`tradeDate` >='{from_date}' and r.`tradeDate` <='{to_date}' AND (r.`securityID` LIKE '30%' OR r.`securityID` LIKE '60%' OR r.`securityID` LIKE '68%' OR r.`securityID` LIKE '00%') GROUP BY r.`orderSysID`) a" |
| | | sql += f"SELECT '股票', COUNT(*), sum(a.price*a.volume) as '金额' FROM (SELECT * FROM `hx_trade_deal_record` r WHERE r.`tradeDate` >='{from_date}' and r.`tradeDate` <='{to_date}' AND (r.`securityID` LIKE '30%' OR r.`securityID` LIKE '60%' OR r.`securityID` LIKE '68%' OR r.`securityID` LIKE '00%') GROUP BY r.`orderSysID`) a" |
| | | |
| | | sql += " UNION ALL " |
| | | |
| | | sql += f"SELECT '上证基金', COUNT(*) AS '数量' FROM (SELECT * FROM `hx_trade_deal_record` r WHERE r.`tradeDate` >='{from_date}' and r.`tradeDate` <='{to_date}' AND (r.`securityID` LIKE '11%') GROUP BY r.`orderSysID`) a" |
| | | sql += f"SELECT '上证基金', COUNT(*) AS '数量', sum(a.price*a.volume) as '金额' FROM (SELECT * FROM `hx_trade_deal_record` r WHERE r.`tradeDate` >='{from_date}' and r.`tradeDate` <='{to_date}' AND (r.`securityID` LIKE '11%') GROUP BY r.`orderSysID`) a" |
| | | |
| | | sql += " UNION ALL " |
| | | |
| | | sql += f"SELECT '深证基金', COUNT(*) AS '数量' FROM (SELECT * FROM `hx_trade_deal_record` r WHERE r.`tradeDate` >='{from_date}' and r.`tradeDate` <='{to_date}' AND (r.`securityID` LIKE '12%') GROUP BY r.`orderSysID`) a" |
| | | sql += f"SELECT '深证基金', COUNT(*) AS '数量', sum(a.price*a.volume) as '金额' FROM (SELECT * FROM `hx_trade_deal_record` r WHERE r.`tradeDate` >='{from_date}' and r.`tradeDate` <='{to_date}' AND (r.`securityID` LIKE '12%') GROUP BY r.`orderSysID`) a" |
| | | sql += ") a" |
| | | return self.__mysqldb.select_all(sql) |
| | | |
| | |
| | | raise Exception("未获取到L2数据") |
| | | else: |
| | | raise Exception(f"尚未获取到数据(place_index-{place_index} insertTime-{insertTime})") |
| | | |
| | | except Exception as e: |
| | | hx_logger_trade_debug.warning("{}校验真实下单位置出错:{}", code, str(e)) |
| | | return None |