This commit is contained in:
parent
3c0f3ce7a5
commit
60ee3a6585
|
|
@ -1037,5 +1037,36 @@ def main() -> None:
|
|||
print("\nCache build complete.")
|
||||
|
||||
|
||||
def phase5_only() -> None:
|
||||
"""Load fundamentals from DB and recompute sector stats — no cache rebuild."""
|
||||
print("=" * 55)
|
||||
print(" PHASE 5 ONLY — Sector statistics recompute")
|
||||
print(f" TABLE_PREFIX={_TABLE_PREFIX!r}")
|
||||
print("=" * 55 + "\n")
|
||||
|
||||
print(f"Loading fundamentals from {_TABLE_PREFIX}fundamentals_cache ...")
|
||||
cols = [c for c in _FUND_COLS if c != "updated_at"]
|
||||
col_str = ", ".join(f'"{c}"' for c in cols)
|
||||
try:
|
||||
conn = _get_conn()
|
||||
with conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor) as cur:
|
||||
cur.execute(f'SELECT {col_str} FROM "{_TABLE_PREFIX}fundamentals_cache"')
|
||||
rows = cur.fetchall()
|
||||
conn.close()
|
||||
except Exception as e:
|
||||
print(f"ERROR: Could not load fundamentals: {e}")
|
||||
raise SystemExit(1)
|
||||
|
||||
fundamentals = {r["ticker"]: dict(r) for r in rows}
|
||||
print(f" Loaded {len(fundamentals)} rows\n")
|
||||
|
||||
run_sector_stats_phase(fundamentals)
|
||||
print("\nPhase 5 complete.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
import sys
|
||||
if "--phase5-only" in sys.argv:
|
||||
phase5_only()
|
||||
else:
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
echo ============================================================
|
||||
echo Release BETA (code deploy + exe build + beta user update)
|
||||
echo ============================================================
|
||||
echo.
|
||||
|
||||
set /p COMMIT_MSG=Commit message:
|
||||
if "%COMMIT_MSG%"=="" (
|
||||
echo Error: Commit message cannot be empty.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set /p RELEASE_NOTES=Release notes (shown to users, press Enter to skip):
|
||||
|
||||
echo.
|
||||
echo [1/5] Staging all changes...
|
||||
git add -A
|
||||
|
||||
echo [2/5] Committing...
|
||||
git commit -m "%COMMIT_MSG%"
|
||||
if errorlevel 1 (
|
||||
echo Nothing to commit — continuing to build.
|
||||
)
|
||||
|
||||
echo [3/5] Pushing to Gitea beta branch...
|
||||
git push gitea HEAD:beta
|
||||
if errorlevel 1 (
|
||||
echo Push failed. Check Gitea connection.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [4/5] Deploying server-side files to VPS...
|
||||
ssh root@87.99.133.95 "cd /srv/stock-tool-beta && git pull origin beta && cp api/main.py /srv/api/main.py && cp health_monitor.py /srv/health_monitor.py && pm2 restart api && echo VPS beta deploy OK"
|
||||
if errorlevel 1 (
|
||||
echo VPS deploy failed. Check SSH connection.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [5/5] Building exe and pushing update to beta users...
|
||||
if "%RELEASE_NOTES%"=="" (
|
||||
python push_update.py --channel beta
|
||||
) else (
|
||||
python push_update.py --channel beta --notes "%RELEASE_NOTES%"
|
||||
)
|
||||
if errorlevel 1 (
|
||||
echo Exe build or upload failed.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ============================================================
|
||||
echo Beta release complete. Beta users will update on next launch.
|
||||
echo ============================================================
|
||||
pause
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
echo ============================================================
|
||||
echo Release STABLE (code deploy + exe build + user update)
|
||||
echo ============================================================
|
||||
echo.
|
||||
|
||||
set /p COMMIT_MSG=Commit message:
|
||||
if "%COMMIT_MSG%"=="" (
|
||||
echo Error: Commit message cannot be empty.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set /p RELEASE_NOTES=Release notes (shown to users, press Enter to skip):
|
||||
|
||||
echo.
|
||||
echo [1/5] Staging all changes...
|
||||
git add -A
|
||||
|
||||
echo [2/5] Committing...
|
||||
git commit -m "%COMMIT_MSG%"
|
||||
if errorlevel 1 (
|
||||
echo Nothing to commit — continuing to build.
|
||||
)
|
||||
|
||||
echo [3/5] Pushing to Gitea main branch...
|
||||
git push gitea main
|
||||
if errorlevel 1 (
|
||||
echo Push failed. Check Gitea connection.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [4/5] Deploying server-side files to VPS...
|
||||
ssh root@87.99.133.95 "cd /srv/stock-tool && git pull && cp api/main.py /srv/api/main.py && cp health_monitor.py /srv/health_monitor.py && pm2 restart api && echo VPS deploy OK"
|
||||
if errorlevel 1 (
|
||||
echo VPS deploy failed. Check SSH connection.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [5/5] Building exe and pushing update to users...
|
||||
if "%RELEASE_NOTES%"=="" (
|
||||
python push_update.py --channel stable
|
||||
) else (
|
||||
python push_update.py --channel stable --notes "%RELEASE_NOTES%"
|
||||
)
|
||||
if errorlevel 1 (
|
||||
echo Exe build or upload failed.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ============================================================
|
||||
echo Stable release complete. Users will update on next launch.
|
||||
echo ============================================================
|
||||
pause
|
||||
|
|
@ -19,7 +19,7 @@ import requests
|
|||
# ---------------------------------------------------------------------------
|
||||
# Current app version — kept in sync by push_update.py before each build.
|
||||
# ---------------------------------------------------------------------------
|
||||
APP_VERSION = "1.3.8"
|
||||
APP_VERSION = "1.3.9"
|
||||
|
||||
|
||||
def _exe_dir() -> str:
|
||||
|
|
|
|||
Loading…
Reference in New Issue