I am new to auto trading and have few queries on auto trading using KiteConnect and Pi Bridge.
Can i fire orders directly to the market/exchange through KiteConnect? using pi-Bridge, order will go to generated alerts window and stay there till we review the order and place it to the market.
Hi Kailash ,
I would like to fully automate simple strategy by using spring , hibernate and kite java api .I just want to run at 9:30 AM and leave the system to trade till 3:20 . does I need to take any approval from exchange as it is fully automated trade .
@Kailash Thanks alot kailash ,Is there any any plan for conducting webinar on Java API .Can i get sample raw data to test code written for a strategy on historic data of any instrument .
@Kailash@vivek Please correct my understanding ? Do I need approval to place orders programmatically if I am going to trade individually?
This is what kite.trade says "Zerodha has already obtained necessary approvals for Kite Connect APIs for individuals. You need not seek any additional approvals and can get started with the APIs immediately."
Is that not approval for placing trades programmatically using kite orders API for individuals ?
@sameer The regulations differentiate between automated algorithmic trades and programmatic trades using APIs. Please e-mail [email protected] for further clarification.
@narasimha After successful login, you will be redirected to registered redirect url. In your case, something like this 127.0.0.1&request_token=o1h586aruoxmysqjqigqmriskehjzivqk
I am using Java Kite Connect API and getting java.lang.ClassCastException. It is thrown by the API code.
For generating access token I'm initializing KiteConnect instance with my API key. Later I'm trying to initialize UserModel with request token and the API secret.
But the code throws ClassCastException which is unexpected and this is issue with API. Below is the code snippet :
System.out.println("Please enter request token :"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String requestToken = br.readLine().trim();
KiteConnect kiteConnect = new KiteConnect("oc1g68oja0hpnjcp"); kiteConnect.setUserId("DR2680");
Please enter request token : 0on4r321vsyl99i7pv946t4wzkfvleja java.lang.ClassCastException: com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonArray at com.google.gson.JsonObjectDeserializationVisitor.visitArrayField(JsonObjectDeserializationVisitor.java:79) at com.google.gson.ObjectNavigator.navigateClassFields(ObjectNavigator.java:154) at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:123) at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:73) at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:51) at com.google.gson.Gson.fromJson(Gson.java:495) at com.google.gson.Gson.fromJson(Gson.java:444) at com.google.gson.Gson.fromJson(Gson.java:396) at com.google.gson.Gson.fromJson(Gson.java:372) at com.rainmatter.models.UserModel.parseResponse(UserModel.java:42) at com.rainmatter.kiteconnect.KiteConnect.requestAccessToken(KiteConnect.java:172) at p1.KiteLoginDemo.main(KiteLoginDemo.java:28)
You must use same client Id with which you have signed up. Your app doesn't have multi user access. Just copy paste code from Test of KiteConnect Java. It is working fine.
Hi Kailash/Kite API Team, Thanks for putting together the Java KiteConnect client. I have recently started to use it and found it to be very helpful. Today while trying to test some use cases i came across some scenarios of data inconsistencies in OHLC returned from getQuote method. I have used the getQuote method code and modified ti to return the OHLC data type instead of void. It seems to return appropriate open/high/low/close values for some stocks(eg. VGUARD) but it seems it is not returning correct values for some other stocks(eg.AHLWEST(NSE)). For AHLWEST i get correct Close value 210 currently but the Open value is 0. I would expect the day open value to be returned and not 0. This is affecting the logic i am trying to build using day OHLC values. Please check this scenario and share some details on the root cause of this issue and how/when can this be addressed.
Hi Sujith, Thanks for the quick update. I had checked the zerodha kite site which shows OHLC all same as 210. Looking at the NSE site link you have shared it seems this stock has not traded today which explains why open is 0. Now i understand that anything which has open returned as 0 is not traded and will modify my logic accordingly. Thanks for looking into this.
Another scenario found for PRAGBOS(BSE),the quote method returned o->4.86, h->5.26, l->4.86, c->5.1 which matches BSE site information but checking the Zerodha Kite chart shows high of 5 instead of 5.26 listed on BSE and returned by API. It seems Kite chart is not accurate for some of these low traded scrips. Is my understanding correct?
I am new to auto trading and have few queries on auto trading using KiteConnect and Pi Bridge.
Can i fire orders directly to the market/exchange through KiteConnect?
using pi-Bridge, order will go to generated alerts window and stay there till we review the order and place it to the market.
I would like to fully automate simple strategy by using spring , hibernate and kite java api .I just want to run at 9:30 AM and leave the system to trade till 3:20 . does I need to take any approval from exchange as it is fully automated trade .
how can i get api_key and secret key. Could you please help me
@AutoTrade Signup here https://developers.kite.trade
thank you so much for the reply.
I don't whether i could ask you or not, could you please convert my below strategy to AFL code or Java.
Green = 100-number of periods since 50 day high/100*100;
Red = 100-number of periods since 50 day low/100*100
You may start a new thread on the forum and see if someone's able to help out.
I am new for this forum
Could you help me in creating new app at https://developers.kite.trade/create.
i am bit confused with "Redirect URL *:" and "Postback URL (optional):"
what should i give, i dont have any websites.....would appreciate your help. thanks
Postback URL is not required?
This is what kite.trade says
"Zerodha has already obtained necessary approvals for Kite Connect APIs for individuals. You need not seek any additional approvals and can get started with the APIs immediately."
Is that not approval for placing trades programmatically using kite orders API for individuals ?
can you get me the Nithin's webinar video which is done recently on KiteConnect
@sameer The regulations differentiate between automated algorithmic trades and programmatic trades using APIs. Please e-mail [email protected] for further clarification.
http://tradingqna.com/52446/laymans-difference-between-algorithmic-programatic-trade
com.rainmatter.kitehttp.exceptions.KiteTokenException
At Usermodel after providing request token & API secrete
Can any one help me
I am using 127.0.0.1 for my testing purpose.
For generating access token I'm initializing KiteConnect instance with my API key. Later I'm trying to initialize UserModel with request token and the API secret.
But the code throws ClassCastException which is unexpected and this is issue with API.
Below is the code snippet :
System.out.println("Please enter request token :");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String requestToken = br.readLine().trim();
KiteConnect kiteConnect = new KiteConnect("oc1g68oja0hpnjcp");
kiteConnect.setUserId("DR2680");
UserModel userModel = null;
try {
userModel = kiteConnect.requestAccessToken(requestToken, "2ixzxrbons888r46x2ljjuzf1yjf8g47");
} catch (JSONException | KiteException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
And below is the stack trace :
Please enter request token :
0on4r321vsyl99i7pv946t4wzkfvleja
java.lang.ClassCastException: com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonArray
at com.google.gson.JsonObjectDeserializationVisitor.visitArrayField(JsonObjectDeserializationVisitor.java:79)
at com.google.gson.ObjectNavigator.navigateClassFields(ObjectNavigator.java:154)
at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:123)
at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:73)
at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:51)
at com.google.gson.Gson.fromJson(Gson.java:495)
at com.google.gson.Gson.fromJson(Gson.java:444)
at com.google.gson.Gson.fromJson(Gson.java:396)
at com.google.gson.Gson.fromJson(Gson.java:372)
at com.rainmatter.models.UserModel.parseResponse(UserModel.java:42)
at com.rainmatter.kiteconnect.KiteConnect.requestAccessToken(KiteConnect.java:172)
at p1.KiteLoginDemo.main(KiteLoginDemo.java:28)
I am generating request token by hitting URL https://kite.trade/connect/login?api_key=XXXX in browser.
Even I tried using https://github.com/rainmattertech/javakiteconnect/blob/master/sample/src/Test.java
It gives same problem.
Are you logging in manually?
You will get request token only after successful login and request token is valid for 3 minutes.
I am logging in manually.
I get the request token in browser address bar as follows:
https://kite.zerodha.com/:// http://127.0.0.1?status=success&request_token=i2rec0jf1zy45tbk6d7p0vqhztjtmikg
And three minutes are sufficient to copy request_token and initialize userModel using request token and api secret key.
Can you write a private message with your client id and email id with which you have signed up for KiteConnect?
DR2680, This client Id doesn't have any app.
Below is the information of the same :
Kite connect + Publisher — expires on 2016-11-25
MyApp1
Active
API Key
oc1g68oja0hpnjcp
API Secret
2ixzxrbons888r46x2ljjuzf1yjf8g47
Please let me know email id. I can also post screen shot of the same.
Make sure you are using latest Java like oracle java 8 or openjdk 8.
I tried with your api key and secret. It is working fine.
Please don't give away, api secret. Others can use it. We have regenerated your api secret. Use new one.
You must use same client Id with which you have signed up. Your app doesn't have multi user access.
Just copy paste code from Test of KiteConnect Java. It is working fine.
Thanks for putting together the Java KiteConnect client. I have recently started to use it and found it to be very helpful. Today while trying to test some use cases i came across some scenarios of data inconsistencies in OHLC returned from getQuote method. I have used the getQuote method code and modified ti to return the OHLC data type instead of void. It seems to return appropriate open/high/low/close values for some stocks(eg. VGUARD) but it seems it is not returning correct values for some other stocks(eg.AHLWEST(NSE)). For AHLWEST i get correct Close value 210 currently but the Open value is 0. I would expect the day open value to be returned and not 0. This is affecting the logic i am trying to build using day OHLC values.
Please check this scenario and share some details on the root cause of this issue and how/when can this be addressed.
Thanks,
Chintan Parmar
I think this scrip is not traded today. Checkout on NSE site, it shows same data https://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuote.jsp?symbol=AHLWEST&illiquid=0&smeFlag=0&itpFlag=0
Thanks for the quick update. I had checked the zerodha kite site which shows OHLC all same as 210. Looking at the NSE site link you have shared it seems this stock has not traded today which explains why open is 0. Now i understand that anything which has open returned as 0 is not traded and will modify my logic accordingly. Thanks for looking into this.
Another scenario found for PRAGBOS(BSE),the quote method returned o->4.86, h->5.26, l->4.86, c->5.1 which matches BSE site information but checking the Zerodha Kite chart shows high of 5 instead of 5.26 listed on BSE and returned by API. It seems Kite chart is not accurate for some of these low traded scrips. Is my understanding correct?