Add application settings
Этот коммит содержится в:
@@ -0,0 +1,25 @@
|
||||
from functools import lru_cache
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file='.env', env_file_encoding='utf-8', extra='ignore')
|
||||
|
||||
app_name: str = 'Trade Autopilot'
|
||||
app_env: str = 'local'
|
||||
trade_mode: str = 'demo'
|
||||
enable_live_trading: bool = False
|
||||
demo_initial_balance: float = 10000.0
|
||||
demo_quote_asset: str = 'USDT'
|
||||
coinex_api_base: str = 'https://api.coinex.com/v2'
|
||||
coinex_ws_spot: str = 'wss://socket.coinex.com/v2/spot'
|
||||
default_market: str = 'BTCUSDT'
|
||||
|
||||
@property
|
||||
def live_enabled(self) -> bool:
|
||||
return self.trade_mode == 'live' and self.enable_live_trading
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
Ссылка в новой задаче
Block a user