diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:25:54 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:25:54 +0900 |
| commit | e10d4a96e062818cb2395add1746c733a053c374 (patch) | |
| tree | bbd222cd840d2c7fc58d3109362fb1b0c00aee26 /services/api/src/trading_api/routers/strategies.py | |
| parent | 21c6b777530b4a027aec9c12bf63092e5a7c006d (diff) | |
feat: add FastAPI REST API service
Diffstat (limited to 'services/api/src/trading_api/routers/strategies.py')
| -rw-r--r-- | services/api/src/trading_api/routers/strategies.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/services/api/src/trading_api/routers/strategies.py b/services/api/src/trading_api/routers/strategies.py new file mode 100644 index 0000000..a8d778d --- /dev/null +++ b/services/api/src/trading_api/routers/strategies.py @@ -0,0 +1,28 @@ +"""Strategy endpoints.""" +import sys +from pathlib import Path + +from fastapi import APIRouter + +# Add strategy-engine to path for plugin loading +_STRATEGY_DIR = Path(__file__).resolve().parents[5] / "strategy-engine" +if str(_STRATEGY_DIR) not in sys.path: + sys.path.insert(0, str(_STRATEGY_DIR)) + +router = APIRouter() + + +@router.get("/") +async def list_strategies(): + """List available strategies.""" + from strategy_engine.plugin_loader import load_strategies + strategies_dir = _STRATEGY_DIR / "strategies" + strategies = load_strategies(strategies_dir) + return [ + { + "name": s.name, + "warmup_period": s.warmup_period, + "class": type(s).__name__, + } + for s in strategies + ] |
