feat: 修复报错

This commit is contained in:
Daniel
2026-03-26 14:13:44 +08:00
commit b2223ec058
31 changed files with 17401 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
from __future__ import annotations
import os
from dataclasses import dataclass
@dataclass
class MarketConfig:
channel: str
provider: str
cmes_token: str
futu_host: str
futu_port: int
futu_is_encrypt: bool | None
futu_market: str
def load_market_config() -> MarketConfig:
channel = os.getenv("MARKET_CHANNEL", "cn").strip().lower()
provider = os.getenv("MARKET_PROVIDER", "akshare").strip().lower()
cmes_token = os.getenv("CMES_TOKEN", "").strip()
futu_host = os.getenv("FUTU_HOST", "127.0.0.1").strip()
futu_port = int(os.getenv("FUTU_PORT", "11111").strip())
futu_encrypt_raw = os.getenv("FUTU_IS_ENCRYPT", "").strip().lower()
if futu_encrypt_raw in {"1", "true", "yes", "y"}:
futu_is_encrypt = True
elif futu_encrypt_raw in {"0", "false", "no", "n"}:
futu_is_encrypt = False
else:
futu_is_encrypt = None
futu_market = os.getenv("FUTU_MARKET", "").strip().lower()
return MarketConfig(
channel=channel,
provider=provider,
cmes_token=cmes_token,
futu_host=futu_host,
futu_port=futu_port,
futu_is_encrypt=futu_is_encrypt,
futu_market=futu_market,
)