ReMe/reme/schema/finance.py
jinliyl ae55e2e570
Some checks are pending
CI / Python packages / Build and verify distributions (push) Waiting to run
CI / Python quality / GitHub Actions (push) Waiting to run
CI / Python quality / Pre-commit (push) Waiting to run
CI / Python tests / Hermes embedded - ubuntu-latest (push) Waiting to run
CI / Python tests / Hermes embedded - windows-latest (push) Waiting to run
CI / Python tests / Unit Tests - py3.11 (push) Waiting to run
CI / Python tests / Unit Tests - py3.12 (push) Waiting to run
CI / Python tests / Unit Tests - py3.13 (push) Waiting to run
CI / Python tests / Unit Tests - py3.14 (push) Waiting to run
CI / ReMe Studio / Studio checks (push) Waiting to run
CI / Windows / CLI smoke - py3.11 (push) Waiting to run
Deploy / Documentation / Build documentation (push) Waiting to run
Deploy / Documentation / deploy (push) Blocked by required conditions
Security / CodeQL / Analyze javascript-typescript (push) Waiting to run
Security / CodeQL / Analyze python (push) Waiting to run
feat!: split proactive runtimes and add Studio backend management (#776)
* refactor(proactive)!: separate runtime ownership and unify delivery

* refactor(proactive): finish runtime and Studio migration

* test(proactive): make scheduled skip coverage deterministic

* refactor(studio): unify navigation and notebook resource loading

* feat(studio): edit workspace documents and update proactive task names

* refactor(studio): simplify task settings and navigation

* feat(studio): secure and supervise backend settings

* feat(studio): unify workbench timelines and refine desktop updates

Use shared timeline panes for notebook, memory, and resources. Add Todo creation ordering, persist companion visibility, and align desktop update handling and release artifacts.

Recheck editor file versions at read and publication boundaries. Retry reminder detail requests from the resource view.

* fix(studio): support unsigned GitHub preview releases

* fix: verify container state and isolate proactive view errors

Mount private supervisor state in Docker smoke tests and verify token and settings persistence. Exercise Studio startup with a loopback-only model fixture, and exclude packaged desktop output from Docker contexts.

Keep Remy subscriptions and healthy tasks available when an individual task has an invalid workspace path or session history.

* fix(home): align candidate Docker context exclusions

* chore(deps): update openai-codex dependency to v0.172.0

- Bump openai-codex from version 0.169.0 to 0.172.0 in pyproject.toml
- Keep other dependencies unchanged
- Ensure compatibility with latest openai-codex features and fixes

* fix(daemon): discover parent dotenv and isolate listeners

Restore parent-directory environment discovery in workers while retaining system precedence. Partition the default supervisor profile and lock by the configured bind address and port.
2026-11-25 21:33:16 +08:00

66 lines
2.2 KiB
Python

"""Source records saved by the scheduled finance collectors."""
from typing import Literal
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, model_validator
class FinanceNewsItem(BaseModel):
"""One complete CLS news item, identified independently of its collection batch."""
model_config = ConfigDict(extra="forbid")
news_id: str = Field(pattern=r"^[1-9]\d*$")
published_at: AwareDatetime
source: Literal["财联社"] = "财联社"
title: str = Field(min_length=1)
content: str = Field(min_length=1)
url: str
class MarketQuote(BaseModel):
"""A Tencent market quote with its previous close."""
model_config = ConfigDict(extra="forbid", allow_inf_nan=False)
symbol: Literal["XAUUSD", "CL", "IXIC"]
currency: Literal["USD"] = "USD"
price: float
previous_close: float
change_percent: float
quoted_at: AwareDatetime
collected_at: AwareDatetime
source: Literal["tencent"] = "tencent"
@model_validator(mode="after")
def validate_quote(self):
"""Validate the provider's time and the prices for this instrument."""
if self.symbol != "CL" and (self.price <= 0 or self.previous_close <= 0):
raise ValueError("Price and previous close must be positive")
if self.quoted_at > self.collected_at:
raise ValueError("quoted_at must not follow collected_at")
return self
class CryptoQuote(BaseModel):
"""BTC/USDT spot statistics over an explicit rolling 24-hour window."""
model_config = ConfigDict(extra="forbid", allow_inf_nan=False)
symbol: Literal["BTCUSDT"] = "BTCUSDT"
market: Literal["CRYPTO"] = "CRYPTO"
currency: Literal["USDT"] = "USDT"
price: float = Field(gt=0)
open_24h: float = Field(gt=0)
change_24h_percent: float
window_start: AwareDatetime
window_end: AwareDatetime
collected_at: AwareDatetime
source: Literal["binance"] = "binance"
@model_validator(mode="after")
def validate_window(self):
"""Keep the statistics window chronological without inventing a last-trade time."""
if self.window_start >= self.window_end:
raise ValueError("window_start must precede window_end")
return self