Getting error 'SmartConnect' object has no attribute 'getQuote'


  • I am runnning below code
    def get_live_data(api, stock_symbol):
    scrip_token = get_scrip_token(stock_symbol)
    if scrip_token:
    try:
    live_data = api.getQuote(scrip_token) # Ensure this is the correct method name
    return live_data
    except Exception as e:
    logging.error(f"Error fetching stock data for {stock_symbol}: {str(e)}")
    return None

    I am getting below error,
    INFO:root:Processing BAJAJ-AUTO-EQ
    ERROR:root:Error fetching stock data for BAJAJ-AUTO-EQ: 'SmartConnect' object has no attribute 'getQuote'

    Can you please suggest corrections.


  • @thatte-kailas

    The correct method name is getMarketData(mode,exchangeTokens)

    Regards,
    SmartAPI Team