(positions: Position[], summary: ProfitSummary)
| 67 | |
| 68 | // 导出为 JSON(用于持久化) |
| 69 | export function exportToJSON(positions: Position[], summary: ProfitSummary): void { |
| 70 | const data: ExportData = { |
| 71 | version: '1.0.0', |
| 72 | exportTime: Date.now(), |
| 73 | positions, |
| 74 | summary, |
| 75 | } |
| 76 | |
| 77 | const jsonContent = JSON.stringify(data, null, 2) |
| 78 | |
| 79 | downloadFile(jsonContent, `持仓备份_${getDateString()}.json`, 'application/json') |
| 80 | } |
| 81 | |
| 82 | // 导出完整数据(包含持仓、复盘和事件) |
| 83 | export async function exportCompleteData(positions: Position[], summary: ProfitSummary): Promise<void> { |
no test coverage detected