Replace HTTP polling with RTDS WebSocket for real-time trade monitoring

- Add rtds_client.py: persistent WebSocket connection to wss://ws-live-data.polymarket.com
  with auto-reconnect, heartbeat, and trade message parsing
- Rewrite trade_monitor.py: single WebSocket receives ALL trades in real-time,
  replacing per-market HTTP polling loops (zero missed trades, sub-second latency)
- Remove QPS rate limiter and per-market polling infrastructure (no longer needed)
- Update default LLM model to gemini-3.1-pro-preview
- Add websockets and python-socks dependencies

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
SII-leiyu
2026-05-06 12:06:45 +08:00
co-authored by Claude Opus 4.6
parent 265c8fb5a1
commit af5bbd0bce
6 changed files with 503 additions and 517 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ class Settings(BaseSettings):
# LLM API (OpenAI-compatible proxy)
gemini_api_key: str = Field(default="", alias="GEMINI_API_KEY")
llm_base_url: str = Field(default="http://apicz.boyuerichdata.com/v1/", alias="LLM_BASE_URL")
llm_base_url: str = Field(default="https://generativelanguage.googleapis.com/v1beta/openai/", alias="LLM_BASE_URL")
# Twitter API (for social sentiment search)
twitter_api_key: str = Field(default="", alias="TWITTER_API_KEY")
@@ -68,7 +68,7 @@ class Settings(BaseSettings):
tier3_poll_interval: int = Field(default=300, alias="TIER3_POLL_INTERVAL")
# LLM Settings
llm_model: str = Field(default="gemini-3-flash-preview", alias="LLM_MODEL")
llm_model: str = Field(default="gemini-3.1-pro-preview", alias="LLM_MODEL")
llm_temperature: float = Field(default=0.0, alias="LLM_TEMPERATURE")