Not able to get candle for crude oil.


  • Hi @admin ,
    Not able to get candle details for Crude oil.
    Below is my Python code. Its working well for Equity.

    package import statement

    from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
    #import smartapi.smartExceptions(for smartExceptions)

    #create object of call
    obj=SmartConnect(api_key="api_key")
    #optional
    #access_token = "your access token",
    #refresh_token = "your refresh_token")

    #login api call

    data = obj.generateSession("UserName","Password")
    print(data)
    refreshToken= data['data']['refreshToken']

    #fetch the feedtoken
    ft = obj.getfeedToken()
    print(ft)

    #fetch User Profile
    userProfile= obj.getProfile(refreshToken)

    print(userProfile)

    hist = {
    "exchange": "MCX",
    "symboltoken": "235127",
    "interval": "FIFTEEN_MINUTE",
    "fromdate": "2022-05-26 10:00",
    "todate": "2022-05-26 10:16"
    }

    candle=obj.getCandleData(hist);

    print(candle)

    #logout
    try:
    logout=obj.terminateSession('Your Client Id')
    print("Logout Successfull")
    except Exception as e:
    print("Logout failed: {}".format(e.message))


  • @admin i'm looking for current date data. If I can get candle data for current date that will be sufficient.

    I can get LTP data but not the candle.
    Any suggestion on it.


  • Hi @gurdeep , we dont provide historical data for MCX and currency segment. Also, no data is provided for NFO options contracts.