feat(calibration): complete step 1 data inspection with data quality v1
This commit is contained in:
18
scripts/common/env.py
Normal file
18
scripts/common/env.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# scripts/common/env.py
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
from src.utils.logger import log
|
||||
|
||||
|
||||
def setup_environment():
|
||||
"""
|
||||
Carga variables de entorno desde config/secrets.env
|
||||
"""
|
||||
env_path = Path(__file__).parent.parent.parent / "config" / "secrets.env"
|
||||
|
||||
if not env_path.exists():
|
||||
log.warning(f"⚠️ Archivo .env no encontrado: {env_path}")
|
||||
return
|
||||
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
log.success("✓ Variables de entorno cargadas")
|
||||
12
scripts/paper/run_paper_loop.py
Normal file
12
scripts/paper/run_paper_loop.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
||||
|
||||
from scripts.common.env import setup_environment
|
||||
setup_environment() # 👈 SIEMPRE LO PRIMERO
|
||||
|
||||
from src.paper.loop import PaperTradingLoop
|
||||
|
||||
if __name__ == "__main__":
|
||||
PaperTradingLoop().run_forever()
|
||||
@@ -35,7 +35,7 @@ from src.metrics.equity_metrics import compute_equity_metrics
|
||||
# --------------------------------------------------
|
||||
# CONFIG
|
||||
# --------------------------------------------------
|
||||
SYMBOL = "BTC/USDT"
|
||||
SYMBOL = "ETH/USDT"
|
||||
TIMEFRAME = "1h"
|
||||
INITIAL_CAPITAL = 10_000
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ from src.metrics.equity_metrics import (
|
||||
# --------------------------------------------------
|
||||
# CONFIG
|
||||
# --------------------------------------------------
|
||||
SYMBOL = "BTC/USDT"
|
||||
SYMBOL = "ETH/USDT"
|
||||
TIMEFRAME = "1h"
|
||||
INITIAL_CAPITAL = 10_000
|
||||
|
||||
|
||||
31
scripts/web/run_web_api.py
Normal file
31
scripts/web/run_web_api.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# scripts/web/run_web_api.py
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import uvicorn
|
||||
|
||||
# Añade el root del proyecto al PYTHONPATH
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
||||
|
||||
from scripts.common.env import setup_environment
|
||||
|
||||
|
||||
def main():
|
||||
# 🔑 Cargar entorno UNA sola vez
|
||||
setup_environment()
|
||||
|
||||
host = os.getenv("WEB_HOST", "127.0.0.1")
|
||||
port = int(os.getenv("WEB_PORT", 8000))
|
||||
reload = os.getenv("WEB_RELOAD", "false").lower() == "true"
|
||||
|
||||
uvicorn.run(
|
||||
"src.web.api.v2.main:app",
|
||||
host=host,
|
||||
port=port,
|
||||
reload=reload,
|
||||
log_level="info",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user