feat: saxo price
This commit is contained in:
@@ -107,6 +107,23 @@ def remove_ticker(ticker: str):
|
||||
return {"removed": ticker.strip().upper()}
|
||||
|
||||
|
||||
class RenameBody(BaseModel):
|
||||
name: str
|
||||
|
||||
|
||||
@router.put("/{ticker}/name")
|
||||
def rename_ticker(ticker: str, body: RenameBody):
|
||||
"""Free-form display name — no longer tied to yfinance's long_name lookup, since an
|
||||
instrument can now be entirely Saxo-sourced."""
|
||||
from services.database import rename_instrument_watchlist
|
||||
if not body.name.strip():
|
||||
raise HTTPException(400, "Name cannot be empty")
|
||||
ok = rename_instrument_watchlist(ticker, body.name)
|
||||
if not ok:
|
||||
raise HTTPException(404, f"'{ticker}' is not in the instruments watchlist")
|
||||
return {"ticker": ticker.strip().upper(), "name": body.name.strip()}
|
||||
|
||||
|
||||
class ReorderBody(BaseModel):
|
||||
tickers: List[str]
|
||||
|
||||
|
||||
@@ -3375,6 +3375,19 @@ def reorder_instruments_watchlist(tickers: List[str]) -> None:
|
||||
conn.close()
|
||||
|
||||
|
||||
def rename_instrument_watchlist(ticker: str, name: str) -> bool:
|
||||
"""Set a free-form display name — the ticker (primary key) no longer has to be a
|
||||
yfinance-recognized code now that an instrument can be entirely Saxo-sourced
|
||||
(saxo_option_symbol + saxo_quote_symbol), so the auto-derived yfinance long_name is
|
||||
just a starting point, not the only option."""
|
||||
conn = get_conn()
|
||||
conn.execute("UPDATE instruments_watchlist SET name=? WHERE ticker=?", (name.strip(), ticker.upper()))
|
||||
changed = conn.total_changes > 0
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return changed
|
||||
|
||||
|
||||
# ── Wavelets — saved simulation/optimization runs ─────────────────────────────
|
||||
|
||||
def save_wavelet_simulation(name: str, form: Dict, results: Optional[List[Dict]] = None,
|
||||
|
||||
Reference in New Issue
Block a user