From 21b4ccdc5c940a128466c190cb7df2d9be34b460 Mon Sep 17 00:00:00 2001 From: Ryana May Que Date: Fri, 6 Sep 2024 17:45:27 +0800 Subject: [PATCH] feat: company profile endpoint --- app/api/v1/routes/stock.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/api/v1/routes/stock.py b/app/api/v1/routes/stock.py index 8729c24..6073382 100644 --- a/app/api/v1/routes/stock.py +++ b/app/api/v1/routes/stock.py @@ -33,3 +33,16 @@ async def quote(symbol: str): response = requests.get("https://finnhub.io/api/v1/quote", params=params) return response.json() + +@router.get("/profile") +async def profile(symbol: str): + """ + API to get company profile. + """ + params = { + "token": settings.FINNHUB_API_KEY, + "symbol": symbol + } + + response = requests.get("https://finnhub.io/api/v1/stock/profile2", params=params) + return response.json()