diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 18:06:25 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 18:06:25 +0900 |
| commit | 7c05359bccfa0ca50a8f55c1a99cfadd731c8e89 (patch) | |
| tree | e6d182f6ce6c32b6d53aefa5d2cd7677e154e3eb /shared | |
| parent | 1270e5edfa8e00ec6306e0921c54d5c130a01b54 (diff) | |
fix: resolve final 3 issues for production readiness
- Fix API strategies endpoint path resolution (use STRATEGIES_DIR env var)
- Add DATABASE_URL env var override in alembic env.py
- Move risk config fields to shared Settings base class
- Remove duplicate fields from ExecutorConfig
Diffstat (limited to 'shared')
| -rw-r--r-- | shared/alembic/env.py | 8 | ||||
| -rw-r--r-- | shared/src/shared/config.py | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/shared/alembic/env.py b/shared/alembic/env.py index 14303f6..18687f2 100644 --- a/shared/alembic/env.py +++ b/shared/alembic/env.py @@ -1,6 +1,7 @@ """Alembic environment configuration for async PostgreSQL migrations.""" import asyncio +import os from logging.config import fileConfig from alembic import context @@ -14,6 +15,13 @@ config = context.config if config.config_file_name is not None: fileConfig(config.config_file_name) +# Override URL from DATABASE_URL env var if set +database_url = os.environ.get("DATABASE_URL") +if database_url: + if database_url.startswith("postgresql://"): + database_url = database_url.replace("postgresql://", "postgresql+asyncpg://", 1) + config.set_main_option("sqlalchemy.url", database_url) + target_metadata = Base.metadata diff --git a/shared/src/shared/config.py b/shared/src/shared/config.py index 867702b..ab0331c 100644 --- a/shared/src/shared/config.py +++ b/shared/src/shared/config.py @@ -14,6 +14,10 @@ class Settings(BaseSettings): risk_max_position_size: float = 0.1 risk_stop_loss_pct: float = 5.0 risk_daily_loss_limit_pct: float = 10.0 + risk_trailing_stop_pct: float = 0.0 + risk_max_open_positions: int = 10 + risk_volatility_lookback: int = 20 + risk_volatility_scale: bool = False dry_run: bool = True telegram_bot_token: str = "" telegram_chat_id: str = "" |
