Initial eth_hedge_sim: P0 market, auth UI, one-click deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-24 16:33:25 +08:00
commit e51f357b48
49 changed files with 4783 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
from __future__ import annotations
from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=(".env", "../.env"),
env_file_encoding="utf-8",
extra="ignore",
)
mode: str = "SIM"
tz: str = "Asia/Shanghai"
env_name: str = "test" # test / prod
api_host: str = "0.0.0.0"
api_port: int = 5155
# Web 登录(仅本机 .env,勿提交真密码)
auth_username: str = "admin"
auth_password: str = "admin123"
auth_secret: str = "change-me-eth-hedge-sim-secret"
auth_token_ttl_sec: int = 60 * 60 * 24 * 7
okx_api_key: str = ""
okx_api_secret: str = ""
okx_api_passphrase: str = ""
okx_rest_base: str = "https://www.okx.com"
okx_ws_public: str = "wss://ws.okx.com:8443/ws/v5/public"
okx_http_proxy: str = ""
perp_inst_id: str = "ETH-USDT-SWAP"
option_inst_family: str = "ETH-USD_UM"
index_inst_id: str = "ETH-USD"
fee_rate: float = 0.0005
initial_equity: float = 100_000.0
max_rounds: int = 3
open_hhmm: str = "16:00"
stop_open_hhmm: str = "08:00"
@property
def is_sim(self) -> bool:
return self.mode.strip().upper() != "LIVE"
@lru_cache
def get_settings() -> Settings:
return Settings()