80 lines
1.7 KiB
TypeScript
80 lines
1.7 KiB
TypeScript
export type AssetType = 'etf' | 'stock'
|
||
|
||
export type IntervalKey =
|
||
| 'daily'
|
||
| 'weekly'
|
||
| 'biweekly'
|
||
| 'monthly'
|
||
| 'quarterly'
|
||
| 'semiannual'
|
||
| 'annual'
|
||
|
||
export type EndMode = 'date' | 'count'
|
||
|
||
export type PlanStatus = 'active' | 'created' | 'cancelled'
|
||
|
||
export interface InvestAsset {
|
||
code: string
|
||
name: string
|
||
type: AssetType
|
||
/** 产品英文名称(来自 getSimpleStockPage) */
|
||
engName?: string
|
||
/** 产品本地名称(来自 getSimpleStockPage) */
|
||
localName?: string
|
||
/** 对接产品接口时的主键,如 SZMK-2728 */
|
||
productKey?: string
|
||
exchangeCode?: string
|
||
productCodeUnique?: string
|
||
}
|
||
|
||
export interface RecurringPlan {
|
||
id: string
|
||
/** 接口计划编号,如 SI-2026-10-08-… */
|
||
planNo?: string
|
||
assets: InvestAsset[]
|
||
amount: number
|
||
/** 按数量定投时的每次股数 */
|
||
quantity?: number | null
|
||
investmentType?: 'AMOUNT' | 'QUANTITY'
|
||
frequencyType?: 'DAILY' | 'WEEKLY' | 'MONTHLY'
|
||
frequencyDay?: string
|
||
interval: IntervalKey
|
||
startDate: string
|
||
endMode: EndMode
|
||
endDate: string
|
||
endCount: number | null
|
||
noEnd: boolean
|
||
endDisplay: string
|
||
status: PlanStatus
|
||
/** 接口原始状态,如 ACTIVE */
|
||
apiStatus?: string
|
||
}
|
||
|
||
export interface RecurringPlanDraft {
|
||
assets: InvestAsset[]
|
||
amount: number
|
||
interval: IntervalKey
|
||
startDate: string
|
||
endDisplay: string
|
||
endMode: EndMode
|
||
endDate: string
|
||
endCount: number | null
|
||
noEnd: boolean
|
||
investmentType?: 'AMOUNT' | 'QUANTITY'
|
||
quantity?: number
|
||
orderPriceType?: 'MARKET' | 'LIMIT'
|
||
limitPrice?: number
|
||
frequencyDay?: string
|
||
ctOffsetMinutes?: number
|
||
}
|
||
|
||
export const INTERVAL_KEYS: IntervalKey[] = [
|
||
'daily',
|
||
'weekly',
|
||
'biweekly',
|
||
'monthly',
|
||
'quarterly',
|
||
'semiannual',
|
||
'annual',
|
||
]
|