not able to connect.

greybit
After buying the keys, i am not able to log in using the java client.

Please check it and support.

Userid: ZT7082

Code changes in java client:

KiteConnect kiteconnect = new KiteConnect("s0lyqb0bxxxxxx");
kiteconnect.setUserId("ZT7082");
UserModel userModel = kiteconnect.requestAccessToken("request_token", "yda78c7xxxxxxxxxxxxxxxxxxx");

i hv commented the below code as i am not using proxy,

//set proxy is optional, if you want to set proxy.
// kiteconnect.setProxy(new HttpHost("host_name"))

and i m getting the below error:

session expired
Invalid session credentials
  • sujith
    Hi @greybit,
    The request token is valid for a couple of minutes and it can be used only once whereas access token is valid for one whole day. Once you get access token make sure you store it in app preference and re-use it.
    Don't make requestAccessToken call everytime you run the App.
    Please check out webinar for log in process.
  • greybit
    the code which i have downloaded for java is having many errors. can you please upload the error free version in git.
  • sujith
    Hi @greybit,
    Can you let us know the errors?
  • greybit
    sysntax errors and class name errors..
  • greybit
    hi sujit,

    Using python as per webminar it works well and i can connect.

    using the same credentials [Hard coding from python values]in java it connects..

    But using the plain java code it is not working.


    // Set request token and public token which are obtained from login process.
    // UserModel userModel = kiteconnect.requestAccessToken("request_token", "your_apiSecret");
    // UserModel userModel = kiteconnect.requestAccessToken("nf8hu24fioh7fr0xxxxxxxxxxxxxxxxx","yda78c7hascf1xr6xxxxxxxxxxxx");

    // kiteconnect.setAccessToken(userModel.accessToken);
    // kiteconnect.setPublicToken(userModel.publicToken);

    kiteconnect.setAccessToken("q893l7gwacp520pixxxxxxxxxxxxxxxx");
    kiteconnect.setPublicToken("51ed7daf3ac84d7axxxxxxxxxxxxxxxxx");
  • greybit
    now able to login.. but still its a manual process to get the access token.. please add the code in the test project.. and more over i am not able to get historical data..
  • sujith
    sujith edited August 2017
    Hi @greybit,
    It is mandatory by the exchange that a user has to log in manually at least once a day. I am afraid we can't help you with that.

    As of now, javakiteconnect library contains library module, distribution jar and example files for reference. We will upload project from next version of javakiteconnect.

    Historical API is an add-on subscription, it is not included in the base subscription. You can go to developers console and subscribe for the same.
  • greybit
    Hi Sujit,

    Thanks for your response!!!

    now i am using Python to get a "Access token" using the "request token" and manually pasting in the java code for login..

    is there any other way to get the "Access token " without using python??
  • sujith
    sujith edited August 2017
    @greybit,
    javakiteconnect is an exact replica of pykiteconnect, all the functions available in python client is available in java client also.
    You can fetch access token using requestAccessToken method.
  • greybit
    Hi Sujit,

    I have few more quires,

    1. can i get the intraday 5 mins candles data using tickers?
    2. In example " tokens.add(53287175);" what that 53287175 means?
    3. Do i need to buy the API and historical data for each app? or its based on one zerodha id and can be used for multiple apps?

  • sujith
    Hi @greybit,
    1. can i get the intraday 5 mins candles data using tickers?
    5min candles are built using live market data. You can build 5min candles by storing tick data.
    2. In example " tokens.add(53287175);" what that 53287175 means?
    You need to send instrument token while subscribing for ticker. You can get instrument token from instrument dump. Check out details about instrument dump here. In this dump, you will get the list of all the instruments that are being traded for the day.
    3. Do i need to buy the API and historical data for each app? or its based on one zerodha id and can be used for multiple apps?
    Each Kite Connect App is by default single user App. You can subscribe to only Kite Connect and use it.
    If you want to use it with multiple client ids then you need to create multiple apps.
  • greybit
    Hi Sujit,

    To implement my logic i need SMA and DATR. please let me know if you have any predefined API for the same. or a code to get these values.
  • tonystark
    Hi @greybit,

    KiteConnect is purely an execution platform. We don't provide strategies. One of our community members has created this repo. You can check that out for reference.
  • greybit
    Hi Sujit / ajinasokan,

    Please share me the data structure format in which i will get the response from historic API. or Please share me any doc which explain about historic API output.

    As per code and example i can able to see only for single script.

    1. do i need to call the historic api for each script to get data?
    2. or do i hv option to give the list of scripts and request for data in one call? if yes, please share more info.
  • sujith
    Hi @greybit,
    Check out documentation. You need to make a request for each scrip to get data.
Sign In or Register to comment.