mirror of
https://github.com/ryanamay/sparkle.git
synced 2024-09-20 04:20:35 +00:00
add: quote route
This commit is contained in:
parent
8dd9bcadb9
commit
a0d98b197f
1 changed files with 14 additions and 1 deletions
|
@ -19,4 +19,17 @@ async def lookup(query: str, exchange: str | None = None):
|
|||
params["exchange"] = exchange
|
||||
|
||||
response = requests.get("https://finnhub.io/api/v1/search", params=params)
|
||||
return response.json()
|
||||
return response.json()
|
||||
|
||||
@router.get("/quote")
|
||||
async def quote(symbol: str):
|
||||
"""
|
||||
API to get a stock quote.
|
||||
"""
|
||||
params = {
|
||||
"token": settings.FINNHUB_API_KEY,
|
||||
"symbol": symbol
|
||||
}
|
||||
|
||||
response = requests.get("https://finnhub.io/api/v1/quote", params=params)
|
||||
return response.json()
|
||||
|
|
Loading…
Reference in a new issue