rebuild(stage-5): establish market data gateway and charts
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class TradeContextResponse(BaseModel):
|
||||
requested_date: str
|
||||
actual_date: str | None
|
||||
previous_date: str | None
|
||||
observed_at: datetime | None
|
||||
state: str | None
|
||||
carried_forward: bool
|
||||
message: str
|
||||
|
||||
|
||||
class MarketSummaryResponse(BaseModel):
|
||||
context: TradeContextResponse
|
||||
values: dict[str, Any] | None
|
||||
|
||||
|
||||
class SearchResultResponse(BaseModel):
|
||||
entity_type: Literal["stock", "sector", "theme", "index"]
|
||||
identifier: str
|
||||
code: str
|
||||
name: str
|
||||
sector: str | None
|
||||
|
||||
|
||||
class SearchGroupResponse(BaseModel):
|
||||
entity_type: Literal["stock", "sector", "theme", "index"]
|
||||
label: str
|
||||
items: list[SearchResultResponse]
|
||||
|
||||
|
||||
class SearchResponse(BaseModel):
|
||||
query: str
|
||||
groups: list[SearchGroupResponse]
|
||||
|
||||
|
||||
class ChartPointResponse(BaseModel):
|
||||
time: str
|
||||
open: float
|
||||
high: float
|
||||
low: float
|
||||
close: float
|
||||
volume: float
|
||||
amount: float
|
||||
average: float | None
|
||||
|
||||
|
||||
class ChartResponse(BaseModel):
|
||||
entity_type: str
|
||||
identifier: str
|
||||
code: str
|
||||
name: str
|
||||
interval: Literal["day", "minute"]
|
||||
trade_date: str
|
||||
observed_at: datetime
|
||||
previous_close: float | None
|
||||
range_start: str | None
|
||||
range_end: str | None
|
||||
points: list[ChartPointResponse]
|
||||
|
||||
|
||||
class ReferenceSyncResponse(BaseModel):
|
||||
calendar_days: int = Field(ge=1)
|
||||
entities: int = Field(ge=1)
|
||||
observed_at: datetime
|
||||
Reference in New Issue
Block a user