feat: saxo price

This commit is contained in:
OpenSquared
2026-07-30 18:02:30 +02:00
parent b8e2a5169c
commit bef0092ca8
4 changed files with 71 additions and 131 deletions

View File

@@ -17,7 +17,6 @@ from services.instrument_service import (
update_instrument_drivers,
update_instrument_saxo_link,
quick_add_instrument_from_watchlist,
add_manual_instrument,
)
class DriverUpdate(BaseModel):
@@ -31,14 +30,6 @@ class SaxoLinkBody(BaseModel):
class QuickAddBody(BaseModel):
ticker: str
class AddManualBody(BaseModel):
id: str
name: str
category: str
yf_ticker: Optional[str] = None
saxo_quote_symbol: Optional[str] = None
router = APIRouter(prefix="/api/instruments", tags=["instruments"])
@@ -60,20 +51,6 @@ def quick_add(body: QuickAddBody) -> Dict[str, Any]:
raise HTTPException(status_code=404, detail=str(e))
@router.post("/add-manual")
def add_manual(body: AddManualBody) -> Dict[str, Any]:
"""Create a standalone Instrument Analysis entry from scratch — Config page's "Ajouter
un ticker" zone, for instruments that aren't in the Cockpit Watchlist (so quick-add
doesn't apply) and don't warrant hand-authoring an instruments.json entry."""
try:
return add_manual_instrument(
body.id, name=body.name, category=body.category,
yf_ticker=body.yf_ticker, saxo_quote_symbol=body.saxo_quote_symbol,
)
except ValueError as e:
raise HTTPException(status_code=409, detail=str(e))
@router.get("/{instrument_id}/snapshot")
async def instrument_snapshot(
instrument_id: str,