자동매매 관련로직 수정
This commit is contained in:
@@ -73,6 +73,23 @@ class Settings(BaseSettings):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self._apply_kis_mode()
|
||||
self._apply_docker_db_override()
|
||||
|
||||
def _apply_docker_db_override(self):
|
||||
"""If running inside Docker, convert localhost in DATABASE_URL to the
|
||||
postgres service hostname.
|
||||
|
||||
Users often copy `.env.example` which defaults to
|
||||
`postgresql://...@localhost:5432/...`. That works on the host machine,
|
||||
but inside the backend container `localhost` refers to the container
|
||||
itself, not the Postgres server. When `/.dockerenv` exists we assume the
|
||||
code is running in Docker and automatically patch the URL.
|
||||
"""
|
||||
if os.path.exists("/.dockerenv"):
|
||||
# simple string replacement; pydantic does not throw if format
|
||||
# changes after initialization
|
||||
if "localhost" in self.DATABASE_URL:
|
||||
self.DATABASE_URL = self.DATABASE_URL.replace("localhost", "postgres")
|
||||
|
||||
def _apply_kis_mode(self):
|
||||
"""KIS_MODE에 따라 모의/실전 API 설정을 자동 선택"""
|
||||
@@ -254,8 +271,8 @@ class Settings(BaseSettings):
|
||||
# ═════════════════════════════════════════════════════════════════════════════
|
||||
# 감시 목록 (watchlist.py)
|
||||
# ═════════════════════════════════════════════════════════════════════════════
|
||||
WATCHLIST_INIT_SIZE: int = 50 # 아침 배치 초기화 종목 수
|
||||
WATCHLIST_MAX_SIZE: int = 100 # 최대 관리 종목 수
|
||||
WATCHLIST_INIT_SIZE: int = 150 # 아침 배치 초기화 종목 수
|
||||
WATCHLIST_MAX_SIZE: int = 150 # 최대 관리 종목 수
|
||||
WATCHLIST_ENTRY_SCORE: int = 60 # 장중 신규 진입 기준 점수
|
||||
WATCHLIST_EXIT_SCORE: int = 20 # 장중 제거 기준 점수
|
||||
|
||||
|
||||
Reference in New Issue
Block a user