feat: saxo price
This commit is contained in:
@@ -6387,12 +6387,15 @@ def upsert_saxo_catalog_rows(rows: List[Dict[str, Any]]):
|
||||
|
||||
|
||||
def get_saxo_catalog(asset_type: Optional[str] = None, q: Optional[str] = None, limit: int = 200) -> List[Dict[str, Any]]:
|
||||
"""asset_type accepts a single value or a comma-separated list (e.g. the Instruments
|
||||
Watchlist "Option" picker passes all 4 option AssetTypes at once)."""
|
||||
conn = get_conn()
|
||||
query = "SELECT * FROM saxo_instrument_catalog WHERE 1=1"
|
||||
params: List[Any] = []
|
||||
if asset_type:
|
||||
query += " AND asset_type=?"
|
||||
params.append(asset_type)
|
||||
types = [t.strip() for t in asset_type.split(",") if t.strip()]
|
||||
query += f" AND asset_type IN ({','.join('?' * len(types))})"
|
||||
params.extend(types)
|
||||
if q:
|
||||
query += " AND (symbol LIKE ? OR description LIKE ?)"
|
||||
params.extend([f"%{q}%", f"%{q}%"])
|
||||
|
||||
Reference in New Issue
Block a user