(position: Position)
| 251 | * 将批次模式转换为普通模式 |
| 252 | */ |
| 253 | export function convertToNormalMode(position: Position): Position { |
| 254 | if (!position.batches || position.batches.length === 0) { |
| 255 | return position // 已经是普通模式 |
| 256 | } |
| 257 | |
| 258 | // 合并所有批次的交易记录 |
| 259 | const allTransactions = position.batches.flatMap(b => b.transactions) |
| 260 | |
| 261 | return { |
| 262 | ...position, |
| 263 | batches: undefined, |
| 264 | transactions: allTransactions, |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * 拆分普通持仓为多个批次 |
nothing calls this directly
no outgoing calls
no test coverage detected