Trying to retrieve historical data throws insufficient permission error

gautama
Hi,

I am new to Zerodha and kite api's. I am trying to fetch historical candles with 1minute interval for future contract.

I am fetching a login token by logging in using apikey and on successful retrieval I am using java client api to make a call using the apikey, secret and my new token I received.

Its consistently throwing insufficient permission error. Can you help ?

NFO: User received - email -deba***@*******.com access token - ******************************** -- refresh token --
com.zerodhatech.kiteconnect.kitehttp.exceptions.PermissionException: Insufficient permission for that call.
at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:61)
at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:21)
at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.getRequest(KiteRequestHandler.java:72)
at com.zerodhatech.kiteconnect.KiteConnect.getHistoricalData(KiteConnect.java:842)
at com.inwin.market.zerodha.ZerodhaHistoricalFetcher.fetchAndSaveTo(ZerodhaHistoricalFetcher.java:78)
at com.inwin.market.zerodha.ZerodhaHistoricalFetcherTest.testFetchCandles(ZerodhaHistoricalFetcherTest.java:35)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  • gautama
    Commodities button in my kill switch is active along with my futures and commodities trading permissions
  • gautama


    Please see code snippet screenshot
  • gautama
    if my accessToken is invalidated I first generate a session with kiteConnect.generateSession and then retrieve the accessToken from user.accessToken and use
  • sujith
    You need an add on subscription to use historical data API. You can know more on the FAQs.
  • gautama
    Ok. good to know. @sujith can you look into the latest PR for the java kite connect api along with the relevant issue. Has maven compliance / java 1.8 upgrade. Can help with maven central release if you need.

    thanks
  • sujith
    sujith edited November 2023
    I had some queries,
    1. It is a generic library which exists for both maven and non maven users. Why remove dependencies?
    2. Is Maven compiler plugin 1.7 deprecated ?
    3. I am using 1.8 java version without having to change anything. My local is not a maven project but just a core Java app. Why change something for all when it is fine.
    4. Why change package name of library and sample directory?
  • gautama
    1. Maven / Gradle use centralized distribution system for dependencies which is a established / standard way of publishing / using deps / jar files in java projects. This way repository / codebase sizes are not inflated and dependencies are downloaded once automatically and reused as needed. In general sharing copies of jar files is considered a bad practice.

    2. Java is currently at version 21 and Java 8 LTS is already past its timeline. Java 7 is considered insecure ( lack of updated TLS support ) . 1.7 is the java version and not of compiler plugin and Java 1.7 is not used any further for any modern project.

    3. Just because your / one project works is not the best metric to evaluate how a dependeny file should be published / made available. Standards are availed for good reasons and maven is that established standard for distributing java deps.

    4. code without package is discouraged. I simply moved the sample java files into the samples package and used the maven standardized folder structure for the project so that I could use maven with it.



  • gautama
    In addition since the dep is not available in maven central, its a pain to separately manage the dep by downloading its jar and adding it manually.
  • sujith
    Yep, makes sense. We will discuss this internally and finalize.
Sign In or Register to comment.