{"id":26847930,"url":"https://github.com/proselytecoding/citicup","last_synced_at":"2025-07-01T10:04:52.120Z","repository":{"id":282268678,"uuid":"947630337","full_name":"ProselyteCoding/citicup","owner":"ProselyteCoding","description":"花旗杯比赛","archived":false,"fork":false,"pushed_at":"2025-06-24T01:37:52.000Z","size":1207,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T02:34:37.512Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProselyteCoding.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-13T02:00:03.000Z","updated_at":"2025-06-24T01:37:56.000Z","dependencies_parsed_at":"2025-03-13T17:48:30.755Z","dependency_job_id":"333759e5-5964-4169-a050-9de0bfbb6426","html_url":"https://github.com/ProselyteCoding/citicup","commit_stats":null,"previous_names":["proselytecoding/citicup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ProselyteCoding/citicup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProselyteCoding%2Fciticup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProselyteCoding%2Fciticup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProselyteCoding%2Fciticup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProselyteCoding%2Fciticup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProselyteCoding","download_url":"https://codeload.github.com/ProselyteCoding/citicup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProselyteCoding%2Fciticup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262941543,"owners_count":23388148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-30T20:34:45.875Z","updated_at":"2025-07-01T10:04:52.112Z","avatar_url":"https://github.com/ProselyteCoding.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RiskFX 项目交互文档\n\n接口部分需要前后端结合实现，请仔细阅读并参考构建。\n\n## 🆕 新功能：同花顺 iFind API 集成\n\n本项目已集成同花顺 iFind API，实现了真实的外汇数据获取功能：\n\n### 主要功能\n\n- **实时外汇数据**: 获取 USD/CNY, EUR/USD, GBP/USD, USD/JPY 等主要货币对的实时价格\n- **多种图表类型**: 支持分时线、K 线图、移动平均线(MA)、MACD 等技术指标\n- **自动数据更新**: 实时数据每 30 秒更新，图表数据每分钟更新\n- **智能降级**: API 调用失败时自动使用模拟数据确保系统正常运行\n\n### 快速启动\n\n1. 配置同花顺 API Token（编辑 `server/.env` 文件）\n2. 运行 `start.bat` (Windows 批处理) 或 `start.ps1` (PowerShell)\n3. 访问 http://localhost:5173 查看应用\n\n详细配置说明请参考 [FOREX_API_README.md](./FOREX_API_README.md)\n\n---\n\n## 接口一：页面三上传持仓数据\n\n前端向后端以 post 方式发送 json 格式的持仓数据表格\n\njson 数据格式：\n\n```json\n[\n  {\n    \"currency\": \"USD/JPY\", // 货币对 string\n    \"quantity\": 10000, // 持仓量 number\n    \"proportion\": 0.5, // 持仓占比 number\n    \"benefit\": -1000, // 盈亏 number（修正冒号为英文符号）\n    \"dailyVolatility\": 0.125, // 日波动率 number\n    \"valueAtRisk\": \"15000\", // VaR(95%) string ！这里需要修改，不要加逗号，和$这个符号\n    \"beta\": 1.2, // Beta number\n    \"hedgingCost\": 0.0015 // 对冲成本 number\n  }\n  // ...（多个持仓对象）\n]\n```\n\n## 接口二：页面三上传压力测试情景\n\n前端向后端以 post 方式发送 json 格式的压力测试情景并获取测试分析结果\n\n发送 json 数据格式：\n\n```json\n{\n  \"scenario\": \"爆发新一轮全球经济危机\" // 压力测试情景描述 string\n}\n```\n\n返回 json 数据格式：\n\n```json\n{\n    scenario:\"爆发新一轮全球经济危机\" // 压力测试情景描述 string\n    influence: \"高\", // 影响程度 string 高/中/低\n    probability: 0.01, // 发生概率 number\n    suggestion: \"减少EUR敞口\" // 建议措施 string\n}\n```\n\n## 接口三：页面三接受页面三相关信息\n\n前端向后端以 get 方式获取页面三相关信息\n\n后端返回 json 数据格式：\n\n```json\n{\n  \"historicalAnalysis\": null, // 历史回测分析（暂未提供）\n\n  \"currentHedgingAdvice\": {\n    \"volatility\": 0.125, // 波动率 number（12.5%转换为小数）\n    \"emotion\": \"偏多\", // 市场情绪指标 string\n    \"suggestion\": \"减少EUR敞口\"\n  },\n\n  \"positionRiskAssessment\": {\n    \"risk\": \"高风险\", // 当前风险敞口 string\n    \"var\": \"$25,000\", // VaR(95%)\n    \"suggestion\": \"减少EUR敞口\"\n  },\n\n  \"correlationAnalysis\": {\n    \"relative\": \"强正相关\", // 货币对相关性 string\n    \"estimate\": \"中等\", // 对冲效果预估 string\n    \"suggestion\": \"减少EUR敞口\" // 修正拼写错误\n  },\n\n  \"costBenefitAnalysis\": {\n    \"cost\": 0.0015, // 对冲成本 number（0.15%转换为小数）\n    \"influence\": \"高\", // 影响程度 string\n    \"suggestion\": \"减少EUR敞口\"\n  },\n\n  \"recommendedPositions\": [\n    // 货币建议持仓\n    {\n      \"currency\": \"USD/JPY\", // 货币对 string\n      \"quantity\": 10000 // 持仓量 number\n    }\n    // ...其他持仓\n  ]\n}\n```\n\n## 接口四：获取页面二相关风险信息\n\n向后端发送 get 请求，请求页面二相关风险信息\n\n后端发送数据格式(json)：\n\n```json\n{\n  \"currencyExposure\": [\n    // 高风险货币列表\n    {\n      \"currency\": \"USD/JPY\", // 货币对 string\n      \"riskRate\": \"高风险\", // 风险率 string\n      \"tendency\": \"上\" // 趋势 string\n    }\n    // ...其他货币对\n  ],\n\n  \"termRiskDistribution\": [\n    // 账期风险分布\n    {\n      \"time\": 30, // 时间分区（单位：天）\n      \"risk\": 0.01\n    }\n    // ...其他时间段\n  ],\n\n  \"riskTransmissionPath\": [\"JPY30\", \"GBP40\", \"USD50\"], // 风险传导路径\n\n  \"macroRiskCoefficients\": [\n    // 宏观风险系数(ERI)\n    {\n      \"month\": 1, // 月份\n      \"all\": 80, // 综合指数\n      \"economy\": 60, // 经济指数\n      \"policy\": 40, // 政策指标\n      \"market\": 20 // 市场指标\n    }\n    // ...其他月份\n  ],\n\n  \"riskSignalAnalysis\": {\n    \"current\": {\n      \"credit\": 80, // 信用风险\n      \"policy\": 20, // 政策风险\n      \"market\": 10, // 市场流动性\n      \"politician\": 30, // 政治风险\n      \"economy\": 40 // 经济风险\n    },\n    \"warning\": {\n      // 预警阈值\n      \"credit\": 80,\n      \"policy\": 20,\n      \"market\": 10,\n      \"politician\": 30,\n      \"economy\": 40\n    }\n  },\n\n  \"singleCurrencyAnalysis\": [\n    // 单一货币对回测分析\n    {\n      \"time\": \"2021-01-01\",\n      \"currency\": \"USD/JPY\",\n      \"upper\": 1.0513, // 预测上限\n      \"lower\": 0.9487 // 预测下限\n    }\n    // ...其他货币对\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproselytecoding%2Fciticup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproselytecoding%2Fciticup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproselytecoding%2Fciticup/lists"}