Files
group_xinghuo_jinrong/scripts/core/04-seed-holdings.sql
T
zhanghongyu_0626 a0f550646e feat(analyst): Add analyze endpoint and chart specification validation
- Introduced a new `/analyze` endpoint in the analyst API to process analysis requests, allowing users to receive textual interpretations and chart specifications based on provided prompts.
- Enhanced `analyst_schemas.py` with `AnalyzeRequest` and `ChartSpec` models to structure analysis requests and validate chart specifications.
- Implemented chart validation logic in a new `analyst_chart.py` service, ensuring that chart types and fields are correctly specified and conform to allowed values.
- Updated `AnalystAgent` to handle analysis requests, integrating the new logic for generating responses based on user prompts and data availability.
- Added unit tests to verify the functionality of the new endpoint and validation mechanisms, ensuring robustness and reliability.

This update significantly enhances the analytical capabilities of the application, providing users with improved tools for data interpretation and visualization.
2026-09-12 12:33:37 +08:00

92 lines
5.6 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;
-- 持仓 as_of = 2026-09-04(单快照;客户间产品数/市值差异大;历史建仓见 05+08 交易流水 + 07 净值)
INSERT INTO core_holding (customer_id, product_id, qty, cost_amount, market_value, pnl_pct, as_of) VALUES
-- CUST-9527 主 demo
('CUST-9527', 'PROD-005827', 50000.0000, 50000.00, 47500.00, -5.0000, '2026-09-04'),
('CUST-9527', 'PROD-110022', 80000.0000, 80000.00, 82400.00, 3.0000, '2026-09-04'),
('CUST-9527', 'PROD-000001', 20000.0000, 20000.00, 20040.00, 0.2000, '2026-09-04'),
-- CUST-1001 C1 保守
('CUST-1001', 'PROD-110022', 30000.0000, 30000.00, 30900.00, 3.0000, '2026-09-04'),
('CUST-1001', 'PROD-000001', 50000.0000, 50000.00, 50100.00, 0.2000, '2026-09-04'),
-- CUST-1002 接近阈值 -12%
('CUST-1002', 'PROD-005828', 40000.0000, 40000.00, 35200.00, -12.0000, '2026-09-04'),
('CUST-1002', 'PROD-110023', 25000.0000, 25000.00, 24500.00, -2.0000, '2026-09-04'),
-- CUST-1003 高龄 C2
('CUST-1003', 'PROD-110022', 120000.0000, 120000.00, 123600.00, 3.0000, '2026-09-04'),
('CUST-1003', 'PROD-005828', 30000.0000, 30000.00, 29100.00, -3.0000, '2026-09-04'),
-- CUST-1004 ~10087
('CUST-1004', 'PROD-161725', 60000.0000, 60000.00, 55800.00, -7.0000, '2026-09-04'),
('CUST-1004', 'PROD-510300', 40000.0000, 40000.00, 41200.00, 3.0000, '2026-09-04'),
-- CUST-1005
('CUST-1005', 'PROD-005827', 35000.0000, 35000.00, 36750.00, 5.0000, '2026-09-04'),
('CUST-1005', 'PROD-510300', 15000.0000, 15000.00, 15300.00, 2.0000, '2026-09-04'),
-- CUST-1006
('CUST-1006', 'PROD-110023', 90000.0000, 90000.00, 91800.00, 2.0000, '2026-09-04'),
('CUST-1006', 'PROD-000002', 40000.0000, 40000.00, 40200.00, 0.5000, '2026-09-04'),
-- CUST-1007
('CUST-1007', 'PROD-005828', 45000.0000, 45000.00, 43650.00, -3.0000, '2026-09-04'),
-- CUST-1008
('CUST-1008', 'PROD-161726', 20000.0000, 20000.00, 19000.00, -5.0000, '2026-09-04'),
('CUST-1008', 'PROD-510500', 10000.0000, 10000.00, 9800.00, -2.0000, '2026-09-04'),
-- CUST-1009 C1
('CUST-1009', 'PROD-000001', 150000.0000, 150000.00, 150300.00, 0.2000, '2026-09-04'),
('CUST-1009', 'PROD-110022', 80000.0000, 80000.00, 82400.00, 3.0000, '2026-09-04'),
-- CUST-1010 ~10087 跨权限测
('CUST-1010', 'PROD-003095', 55000.0000, 55000.00, 52250.00, -5.0000, '2026-09-04'),
('CUST-1010', 'PROD-005827', 30000.0000, 30000.00, 31500.00, 5.0000, '2026-09-04'),
-- CUST-1011
('CUST-1011', 'PROD-161725', 70000.0000, 70000.00, 73500.00, 5.0000, '2026-09-04'),
-- CUST-1012
('CUST-1012', 'PROD-510300', 65000.0000, 65000.00, 66950.00, 3.0000, '2026-09-04'),
('CUST-1012', 'PROD-110023', 35000.0000, 35000.00, 35700.00, 2.0000, '2026-09-04'),
-- CUST-1013
('CUST-1013', 'PROD-005828', 28000.0000, 28000.00, 27440.00, -2.0000, '2026-09-04'),
-- CUST-1014
('CUST-1014', 'PROD-510500', 90000.0000, 90000.00, 87300.00, -3.0000, '2026-09-04'),
('CUST-1014', 'PROD-161726', 40000.0000, 40000.00, 42000.00, 5.0000, '2026-09-04'),
-- CUST-1015
('CUST-1015', 'PROD-110022', 100000.0000, 100000.00, 103000.00, 3.0000, '2026-09-04'),
-- CUST-1016
('CUST-1016', 'PROD-005827', 42000.0000, 42000.00, 43260.00, 3.0000, '2026-09-04'),
('CUST-1016', 'PROD-003095', 18000.0000, 18000.00, 17100.00, -5.0000, '2026-09-04'),
-- CUST-1017
('CUST-1017', 'PROD-510300', 32000.0000, 32000.00, 32960.00, 3.0000, '2026-09-04'),
-- CUST-1018 C1
('CUST-1018', 'PROD-000001', 200000.0000, 200000.00, 200400.00, 0.2000, '2026-09-04'),
-- CUST-1019
('CUST-1019', 'PROD-110023', 48000.0000, 48000.00, 47040.00, -2.0000, '2026-09-04'),
('CUST-1019', 'PROD-005828', 22000.0000, 22000.00, 22440.00, 2.0000, '2026-09-04'),
-- CUST-1020
('CUST-1020', 'PROD-161725', 85000.0000, 85000.00, 89250.00, 5.0000, '2026-09-04'),
('CUST-1020', 'PROD-XYZ999', 15000.0000, 15000.00, 13500.00, -10.0000, '2026-09-04'),
-- CUST-1021
('CUST-1021', 'PROD-005827', 15000.0000, 15000.00, 15750.00, 5.0000, '2026-09-04'),
-- CUST-1022
('CUST-1022', 'PROD-510300', 72000.0000, 72000.00, 74160.00, 3.0000, '2026-09-04'),
('CUST-1022', 'PROD-110022', 48000.0000, 48000.00, 49440.00, 3.0000, '2026-09-04'),
-- CUST-1023
('CUST-1023', 'PROD-005828', 38000.0000, 38000.00, 37160.00, -2.2000, '2026-09-04'),
-- CUST-1024
('CUST-1024', 'PROD-161726', 95000.0000, 95000.00, 99750.00, 5.0000, '2026-09-04'),
-- CUST-3001 大额客户
('CUST-3001', 'PROD-510300', 200000.0000, 200000.00, 206000.00, 3.0000, '2026-09-04'),
('CUST-3001', 'PROD-005827', 150000.0000, 150000.00, 157500.00, 5.0000, '2026-09-04'),
-- CUST-4001 高龄+C5
('CUST-4001', 'PROD-XYZ999', 80000.0000, 80000.00, 72000.00, -10.0000, '2026-09-04'),
('CUST-4001', 'PROD-161725', 50000.0000, 50000.00, 52500.00, 5.0000, '2026-09-04'),
-- CUST-4002 C1 却持有 R4(适当性冲突测)
('CUST-4002', 'PROD-161725', 10000.0000, 10000.00, 9500.00, -5.0000, '2026-09-04'),
-- 手册示范客户(JR-DATA-2024-001)
('CUST-DEMO-A', 'PROD-510300', 35000.0000, 35000.00, 36050.00, 3.0000, '2026-09-04'),
('CUST-DEMO-A', 'PROD-510500', 25000.0000, 25000.00, 25500.00, 2.0000, '2026-09-04'),
('CUST-DEMO-A', 'PROD-000001', 10000.0000, 10000.00, 10020.00, 0.2000, '2026-09-04'),
('CUST-DEMO-B', 'PROD-161725', 500000.0000, 500000.00, 525000.00, 5.0000, '2026-09-04'),
('CUST-DEMO-B', 'PROD-PRIV01', 2500000.0000, 2500000.00, 2625000.00, 5.0000, '2026-09-04'),
('CUST-DEMO-C', 'PROD-110022', 400000.0000, 400000.00, 412000.00, 3.0000, '2026-09-04'),
('CUST-DEMO-C', 'PROD-WMG001', 200000.0000, 200000.00, 203000.00, 1.5000, '2026-09-04'),
('CUST-DEMO-D', 'PROD-005827', 300000.0000, 300000.00, 315000.00, 5.0000, '2026-09-04'),
('CUST-DEMO-D', 'PROD-510300', 150000.0000, 150000.00, 154500.00, 3.0000, '2026-09-04'),
('CUST-DEMO-E', 'PROD-161725', 120000.0000, 120000.00, 108000.00, -10.0000, '2026-09-04'),
('CUST-DEMO-E', 'PROD-510500', 80000.0000, 80000.00, 88000.00, 10.0000, '2026-09-04');