Initial commit

This commit is contained in:
wanghep
2026-03-20 21:47:30 +08:00
commit 2eab960303
83 changed files with 51694 additions and 0 deletions

193
frontend/src/types/api.ts Normal file
View File

@ -0,0 +1,193 @@
export type Precision = 'realtime_exact' | 'close_final' | 'historical_exact' | 'unavailable'
export type MarketState =
| 'pre_open'
| 'trading_am'
| 'midday_break'
| 'trading_pm'
| 'finalizing'
| 'closed'
export interface ValueWithStatus {
amount_hkd_billion: number | null
precision: Precision
label: string
}
export interface OverviewSnapshot {
trade_date: string
snapshot_time: string | null
market_state: MarketState
total_net_inflow: ValueWithStatus
cumulative_net_inflow: ValueWithStatus
shanghai_net_inflow: ValueWithStatus
shenzhen_net_inflow: ValueWithStatus
buy_amount: ValueWithStatus
sell_amount: ValueWithStatus
net_buy_amount: ValueWithStatus
one_min_change: ValueWithStatus
five_min_change: ValueWithStatus
threshold_progress: number
next_threshold_hkd_billion: number
source_name: string
source_url: string | null
updated_at: string | null
unavailable_reason: string | null
}
export interface TimelinePoint {
timestamp: string
amount_hkd_billion: number | null
precision: Precision
}
export interface BenchmarkTimelinePoint {
timestamp: string
value: number | null
}
export interface BenchmarkTimelineSeries {
key: string
label: string
unit: string
detail_url: string | null
points: BenchmarkTimelinePoint[]
}
export interface PushRecord {
id: string
triggered_at: string
push_type: string
rule_code: string
trigger_value_hkd_billion: number | null
description: string
email_subject: string
email_summary: string
status: 'pending' | 'sent' | 'failed' | 'skipped'
error_message: string | null
}
export interface OverviewResponse {
snapshot: OverviewSnapshot
minute_timeline: TimelinePoint[]
benchmark_series: BenchmarkTimelineSeries[]
recent_push_records: PushRecord[]
}
export interface StatPoint {
period: string
amount_hkd_billion: number
}
export interface RecentTradeDay {
trade_date: string
total_net_inflow_hkd_billion: number
precision: Precision
}
export interface HistorySummary {
cumulative_net_inflow_hkd_billion: number
trading_day_count: number
max_single_day_inflow_hkd_billion: number
max_single_day_outflow_hkd_billion: number
longest_inflow_streak: number
longest_outflow_streak: number
}
export interface HistoryResponse {
start_date: string
daily: StatPoint[]
weekly: StatPoint[]
monthly: StatPoint[]
cumulative: StatPoint[]
benchmark_history: Record<string, StatPoint[]>
recent_trade_days: RecentTradeDay[]
summary: HistorySummary
}
export interface RuleItem {
key: string
label: string
value: string
description: string
}
export interface RulesResponse {
items: RuleItem[]
}
export interface SourceDiagnosticsResponse {
source_name: string
realtime_available: boolean
historical_available: boolean
last_success_at: string | null
last_failure_at: string | null
last_error_reason: string | null
last_success_url: string | null
last_persisted_at: string | null
}
export interface MetaResponse {
product_name: string
version: string
timezone: string
market_state: MarketState
current_trade_date: string
source_name: string
source_strategy: string
note: string
}
export interface AShareFlowRecord {
trade_date: string
code: string
name: string
detail_url: string | null
latest_price: number | null
change_amount: number | null
change_percent: number | null
main_net_inflow: number | null
main_net_inflow_ratio: number | null
super_large_net_inflow: number | null
super_large_net_inflow_ratio: number | null
large_net_inflow: number | null
large_net_inflow_ratio: number | null
medium_net_inflow: number | null
medium_net_inflow_ratio: number | null
small_net_inflow: number | null
small_net_inflow_ratio: number | null
rolling_net_inflow_5d: number | null
rolling_net_inflow_10d: number | null
rolling_net_inflow_30d: number | null
rolling_net_inflow_60d: number | null
rolling_net_inflow_90d: number | null
updated_at: string | null
source_name: string
source_url: string | null
precision: Precision
snapshot_time: string | null
sector_type: string | null
sector_type_label: string | null
}
export interface AShareSectorGroup {
label: string
records: AShareFlowRecord[]
}
export interface AShareIndexFlowResponse {
trade_date: string
updated_at: string | null
source_name: string
source_url: string | null
precision: Precision
records: AShareFlowRecord[]
}
export interface AShareSectorFlowResponse {
trade_date: string
updated_at: string | null
source_name: string
source_url: string | null
precision: Precision
sector_types: Record<string, AShareSectorGroup>
}