合约信息拆分为品种和合约两个展示字段
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
7
web/frontend/src/utils/contract.ts
Normal file
7
web/frontend/src/utils/contract.ts
Normal 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] }
|
||||
}
|
||||
Reference in New Issue
Block a user