Files
group_xinghuo_jinrong/scripts/core/11-seed-share-rule.sql
T
GaoYiYuan_0626 f056fcd007 基金转换 T+1 模型:T-1~T-6 落地(DDL/数据层/语义收窄/锁/受理事务)
AIcoding 第 5 步 todo 开发(开发计划 v2.0)前半段:

- T-1 3 张新表 DDL(core_convert_request 6 态 ENUM / core_trade_calendar /
  core_share_rule)+ 种子 + sqlite 单一事实源同步 + 列清单断言
- T-2/T-2b calc 扩展(product_round/redeem_amount/partial_qty)+ 真实净值实算回填
- T-3 convert_request_repository(6 态 + 条件 UPDATE 守卫)+ core_ro 三读方法
  + share_lot_repository.available_qty_with_inflight(R-3 在途占用推导)
- T-4 convert_repository.sync_mirror 成为 risk_convert_detail 唯一进度镜像写入口
  (旧三方法标 Deprecated,T-7 后删)
- T-5 locks.py 锁键构造器 convert_req_lock_key / convert_confirm_lock_key
- T-6 convert_service.accept_convert 受理事务(八步:锁→幂等→校验→受理日顺延
  →在途占用校验→落单→镜像+审计→202;不扣份额/不折算/不写流水)
  + tests/test_convert_accept.py(16 用例)
  + scripts/dev/verify_convert_accept.py(真库 36/36 一致)
  + trading_calendar.py 纯函数包(R-5)+ 21 用例

T-6 真库实测暴露并修复:confirm_eta 在日历数据边界抛 ValueError,会让已落库
的受理单在调用方眼里变 500;改为展示性字段容错 + 单测守护。

基线:798 passed / 10 skipped,零回归。
2026-09-11 19:21:15 +08:00

61 lines
3.1 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
USE jinrong_core;
-- ============================================================================
-- 11-seed-share-rule.sql · 产品份额舍入规则种子(D27 / R-13)
-- 版本:v1.0(2026-09-11 · T-1 新增)
-- 依据:开发计划 v2.0 T-14(D27 产品舍入真正接入)
-- 说明 1:core_share_rule(product_id, business_type) 给 share_digits(默认 2);
-- 与 core_product.share_digits 二选一优先 —— 规则行优先(T-14 DoD)。
-- 说明 2:本文件给主要产品按 business_type 落 share_digits = 2(默认口径);
-- 个别指数/货基给 4 位(真实业务中指数基金份额可计到 0.0001 份,
-- 货币基金份额保持 0.01 元面值 2 位 —— 按 22 号文口径,指数基金申购/转
-- 入确认份额允许保留 4 位小数,见 PRD 已知差异)。
-- 说明 3:未被本文件覆盖的产品(business_type 无行)由 product_round 回退
-- core_product.share_digits(默认 2),降级路径有显式用例(T-14 DoD 2)。
-- ============================================================================
INSERT INTO core_share_rule (product_id, business_type, share_digits, rounding_mode) VALUES
-- 主演示产品:统一 2 位(大众口径)
('PROD-110022', 'subscribe', 2, 'half_up'),
('PROD-110022', 'redeem', 2, 'half_up'),
('PROD-110022', 'convert', 2, 'half_up'),
('PROD-110023', 'subscribe', 2, 'half_up'),
('PROD-110023', 'redeem', 2, 'half_up'),
('PROD-110023', 'convert', 2, 'half_up'),
('PROD-005827', 'subscribe', 2, 'half_up'),
('PROD-005827', 'redeem', 2, 'half_up'),
('PROD-005827', 'convert', 2, 'half_up'),
('PROD-005828', 'subscribe', 2, 'half_up'),
('PROD-005828', 'redeem', 2, 'half_up'),
('PROD-005828', 'convert', 2, 'half_up'),
('PROD-003095', 'subscribe', 2, 'half_up'),
('PROD-003095', 'redeem', 2, 'half_up'),
('PROD-003095', 'convert', 2, 'half_up'),
('PROD-000001', 'subscribe', 2, 'half_up'),
('PROD-000001', 'redeem', 2, 'half_up'),
('PROD-000001', 'convert', 2, 'half_up'),
-- 指数/货基:份额 4 位(R13 依据:指数基金份额确认允许 4 位小数)
('PROD-510300', 'subscribe', 4, 'half_up'),
('PROD-510300', 'redeem', 4, 'half_up'),
('PROD-510300', 'convert', 4, 'half_up'),
('PROD-510500', 'subscribe', 4, 'half_up'),
('PROD-510500', 'redeem', 4, 'half_up'),
('PROD-510500', 'convert', 4, 'half_up'),
('PROD-000002', 'subscribe', 4, 'half_up'),
('PROD-000002', 'redeem', 4, 'half_up'),
('PROD-000002', 'convert', 4, 'half_up'),
('PROD-161725', 'subscribe', 2, 'half_up'),
('PROD-161725', 'redeem', 2, 'half_up'),
('PROD-161725', 'convert', 2, 'half_up'),
('PROD-161726', 'subscribe', 2, 'half_up'),
('PROD-161726', 'redeem', 2, 'half_up'),
('PROD-161726', 'convert', 2, 'half_up'),
('PROD-XYZ999', 'subscribe', 2, 'half_up'),
('PROD-XYZ999', 'redeem', 2, 'half_up'),
('PROD-XYZ999', 'convert', 2, 'half_up'),
('PROD-WMG001', 'subscribe', 2, 'half_up'),
('PROD-WMG001', 'redeem', 2, 'half_up'),
('PROD-WMG001', 'convert', 2, 'half_up'),
('PROD-PRIV01', 'subscribe', 2, 'half_up'),
('PROD-PRIV01', 'redeem', 2, 'half_up'),
('PROD-PRIV01', 'convert', 2, 'half_up');