I am not getting any data, errorCode":"UDAPI100500","message":"Something went wrong... please contact us"

{“status”:“error”,“errors”:[{“errorCode”:“UDAPI100500”,“message”:“Something went wrong… please contact us”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100500”,“property_path”:null,“invalid_value”:null}]}

@Devaprasad_48484024 Can you share request details for which you are getting this error ?

def fetch_market_quote(api_key, access_token):
url = “https://api.upstox.com/v2/market-quote/quotes
headers = {
“Accept”: “application/json”,
“Authorization”: f"Bearer {access_token}“,
“x-api-key”: api_key
}
query_params = {
“symbol”: “NSE_INDEX|NIFTY 50”
}
try:
print(“Fetching quotes with symbol parameter…”)
response = requests.get(url, headers=headers, params=query_params)
print(f"Response Status Code: {response.status_code}”)
if response.status_code == 200:
data = response.json()
print(f"Quote Data: {data}“)
if ‘data’ in data and data[‘data’]:
for symbol, quote in data[‘data’].items():
print(f"Found data for: {symbol}”)
if ‘ohlc’ in quote:
ohlc = quote[‘ohlc’]
df = pd.DataFrame({
‘open’: [float(ohlc.get(‘open’, 0))],
‘high’: [float(ohlc.get(‘high’, 0))],
‘low’: [float(ohlc.get(‘low’, 0))],
‘close’: [float(ohlc.get(‘close’, 0))]
})
window_df = pd.concat([df] * 10, ignore_index=True)
return window_df
return None
else:
print(f"Error fetching quotes with symbol: {response.status_code}“)
print(response.text)
print(“Trying alternative approach with instrument_key…”)
alt_url = “https://api.upstox.com/v2/market-quote/ltp?instrument_key=NSE_INDEX|NIFTY 50”
alt_response = requests.get(alt_url, headers=headers)
if alt_response.status_code == 200:
alt_data = alt_response.json()
print(f"LTP Data: {alt_data}”)
if ‘data’ in alt_data and alt_data[‘data’]:
for key, ltp_data in alt_data[‘data’].items():
print(f"Found LTP data for: {key}“)
last_price = float(ltp_data.get(‘last_price’, 0))
df = pd.DataFrame({
‘open’: [last_price],
‘high’: [last_price],
‘low’: [last_price],
‘close’: [last_price]
})
window_df = pd.concat([df] * 10, ignore_index=True)
return window_df
else:
print(f"Alternative approach failed: {alt_response.status_code}”)
print(alt_response.text)
return None
except Exception as e:
print(f"Exception fetching quotes: {e}")
return None

@Devaprasad_48484024 Kindly try using the correct instrument key NSE_INDEX|Nifty 50 and let me know if it resolves the issue. Thank you.

Yes the issue is resolved. @Anand_Sajankar, Thank you for your support.

2 Likes