jarvisx17 commited on
Commit
af55bf7
·
verified ·
1 Parent(s): 0ab41a5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
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: