Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -71,10 +71,10 @@ async def get_stocks_data(ticker: str = Query(..., description="Enter your stock
|
|
71 |
@app.get('/chain', response_model=CHAIN, responses={200: {"description": "Successful response", "content": {"application/json": {"example": chain_response_example}}}})
|
72 |
async def get_chain(ticker: str = Query(..., description="Enter your index name from [nifty, nifty-bank]", example='nifty-bank')):
|
73 |
try:
|
74 |
-
response, exp = fetcher.fetch_option_chain(ticker)
|
75 |
response = response.to_dict(orient="records")
|
76 |
if response:
|
77 |
-
return {"expiry": exp, "data" : response}
|
78 |
else:
|
79 |
raise HTTPException(status_code=404, detail="Unable to fetch chain.")
|
80 |
except Exception as e:
|
|
|
71 |
@app.get('/chain', response_model=CHAIN, responses={200: {"description": "Successful response", "content": {"application/json": {"example": chain_response_example}}}})
|
72 |
async def get_chain(ticker: str = Query(..., description="Enter your index name from [nifty, nifty-bank]", example='nifty-bank')):
|
73 |
try:
|
74 |
+
response, exp, index_ltp = fetcher.fetch_option_chain(ticker)
|
75 |
response = response.to_dict(orient="records")
|
76 |
if response:
|
77 |
+
return {"ltp": index_ltp, "expiry": exp, "data" : response}
|
78 |
else:
|
79 |
raise HTTPException(status_code=404, detail="Unable to fetch chain.")
|
80 |
except Exception as e:
|