合约信息拆分为品种和合约两个展示字段

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
fish
2026-05-03 16:14:41 +08:00
parent dc22799985
commit fd1c1c7330
4 changed files with 24 additions and 3 deletions

View File

@@ -0,0 +1,7 @@
export function parseTsCode(tsCode: string): { symbol: string; contract: string } {
const m = tsCode.match(/^([A-Za-z]+)(\d{4})\.[A-Z]+$/)
if (!m) {
return { symbol: tsCode, contract: '' }
}
return { symbol: m[1], contract: m[2] }
}