Skip to content

Commit 32d4671

Browse files
committed
changes to update maven version to 3.0.0
1 parent 66adc3a commit 32d4671

File tree

5 files changed

+38
-33
lines changed

5 files changed

+38
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Kite Connect is a set of REST-like APIs that expose many capabilities required t
1212
## Usage
1313
- [Download Kite Connect 3 jar file](https://github.com/zerodhatech/javakiteconnect/tree/kite3/dist) and include it in your build path.
1414

15-
- Include com.rainmatter.kiteconnect into build path from maven. Use version 1.4.5
15+
- Include com.rainmatter.kiteconnect into build path from maven. Use version 3.0.0
1616

1717
- To use javakiteconnect in **Android**, you need to include jar file in the libs directory and add the following line in you module's gradle file ``` compile files('libs/kiteconnect.jar') ```
1818

dist/kiteconnect.jar

-11 Bytes
Binary file not shown.

kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public User generateSession(String requestToken, String apiSecret) throws KiteEx
186186
* @return TokenSet contains user id, refresh token, api secret.
187187
* @throws IOException is thrown when there is connection error.
188188
* @throws KiteException is thrown for all Kite trade related errors. */
189-
public TokenSet renewAccessToken(String refreshToken, String apiSecret) throws IOException, KiteException {
189+
public TokenSet renewAccessToken(String refreshToken, String apiSecret) throws IOException, KiteException, JSONException {
190190
String hashableText = this.apiKey + refreshToken + apiSecret;
191191
String sha256hex = sha256Hex(hashableText);
192192

@@ -215,7 +215,7 @@ public String sha256Hex(String str) {
215215
* @return Profile is a POJO which contains profile related data.
216216
* @throws IOException is thrown when there is connection error.
217217
* @throws KiteException is thrown for all Kite trade related errors.*/
218-
public Profile getProfile() throws IOException, KiteException {
218+
public Profile getProfile() throws IOException, KiteException, JSONException {
219219
String url = routes.get("user.profile");
220220
JSONObject response = new KiteRequestHandler(proxy).getRequest(url, apiKey, accessToken);
221221
return gson.fromJson(String.valueOf(response.get("data")), Profile.class);
@@ -350,7 +350,7 @@ public Order cancelOrder(String orderId, String variety) throws KiteException, J
350350
* @throws KiteException is thrown for all Kite trade related errors.
351351
* @throws IOException is thrown when there is connection error.
352352
* */
353-
public Order cancelOrder(String orderId, String parentOrderId, String variety) throws KiteException, IOException {
353+
public Order cancelOrder(String orderId, String parentOrderId, String variety) throws KiteException, IOException, JSONException {
354354
String url = routes.get("orders.cancel").replace(":variety", variety).replace(":order_id", orderId);
355355

356356
Map<String, Object> params = new HashMap<>();
@@ -381,7 +381,7 @@ public List<Order> getOrders() throws KiteException, JSONException, IOException
381381
* @throws KiteException is thrown for all Kite trade related errors.
382382
* @throws IOException is thrown when there is connection error.
383383
* */
384-
public List<Order> getOrderHistory(String orderId) throws KiteException, IOException {
384+
public List<Order> getOrderHistory(String orderId) throws KiteException, IOException, JSONException {
385385
String url = routes.get("order").replace(":order_id", orderId);
386386
JSONObject response = new KiteRequestHandler(proxy).getRequest(url, apiKey, accessToken);
387387
return Arrays.asList(gson.fromJson(String.valueOf(response.get("data")), Order[].class));
@@ -490,7 +490,7 @@ public JSONObject convertPosition(String tradingSymbol, String exchange, String
490490
* @throws KiteException is thrown for all Kite trade related errors.
491491
* @throws IOException is thrown when there is connection related errors.
492492
*/
493-
public List<Instrument> getInstruments() throws KiteException, IOException {
493+
public List<Instrument> getInstruments() throws KiteException, IOException, JSONException {
494494
KiteRequestHandler kiteRequestHandler = new KiteRequestHandler(proxy);
495495
return readCSV(kiteRequestHandler.getCSVRequest(routes.get("market.instruments.all"), apiKey, accessToken));
496496
}
@@ -547,7 +547,7 @@ public Map<String, Quote> getQuote(String [] instruments) throws KiteException,
547547
* @throws KiteException is thrown for all Kite trade related errors.
548548
* @throws IOException is thrown when there is connection related error.
549549
* */
550-
public Map<String, OHLCQuote> getOHLC(String [] instruments) throws KiteException, IOException {
550+
public Map<String, OHLCQuote> getOHLC(String [] instruments) throws KiteException, IOException, JSONException {
551551
JSONObject resp = new KiteRequestHandler(proxy).getRequest(routes.get("quote.ohlc"), "i", instruments, apiKey, accessToken);
552552
Type type = new TypeToken<Map<String, OHLCQuote>>(){}.getType();
553553
return gson.fromJson(String.valueOf(resp.get("data")), type);
@@ -560,7 +560,7 @@ public Map<String, OHLCQuote> getOHLC(String [] instruments) throws KiteExceptio
560560
* @throws KiteException is thrown for all Kite trade related errors.
561561
* @throws IOException is thrown when there is connection related error.
562562
* */
563-
public Map<String, LTPQuote> getLTP(String[] instruments) throws KiteException, IOException {
563+
public Map<String, LTPQuote> getLTP(String[] instruments) throws KiteException, IOException, JSONException {
564564
JSONObject response = new KiteRequestHandler(proxy).getRequest(routes.get("quote.ltp"), "i", instruments, apiKey, accessToken);
565565
Type type = new TypeToken<Map<String, LTPQuote>>(){}.getType();
566566
return gson.fromJson(String.valueOf(response.get("data")), type);
@@ -592,7 +592,7 @@ public Map<String, TriggerRange> getTriggerRange(String[] instruments, String tr
592592
* @throws KiteException is thrown for all Kite trade related errors.
593593
* @throws IOException is thrown when there is connection related error.
594594
* */
595-
public HistoricalData getHistoricalData(Date from, Date to, String token, String interval, boolean continuous) throws KiteException, IOException {
595+
public HistoricalData getHistoricalData(Date from, Date to, String token, String interval, boolean continuous) throws KiteException, IOException, JSONException {
596596
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
597597
Map<String, Object> params = new HashMap<>();
598598
params.put("from", format.format(from));
@@ -610,7 +610,7 @@ public HistoricalData getHistoricalData(Date from, Date to, String token, String
610610
* @throws KiteException is thrown for all Kite trade related errors.
611611
* @throws IOException is thrown when there is connection related errors.
612612
* */
613-
public List<MFInstrument> getMFInstruments() throws KiteException, IOException{
613+
public List<MFInstrument> getMFInstruments() throws KiteException, IOException, JSONException {
614614
KiteRequestHandler kiteRequestHandler = new KiteRequestHandler(proxy);
615615
return readMfCSV(kiteRequestHandler.getCSVRequest(routes.get("mutualfunds.instruments"), apiKey, accessToken));
616616
}
@@ -625,7 +625,7 @@ public List<MFInstrument> getMFInstruments() throws KiteException, IOException{
625625
* @throws KiteException is thrown for all Kite trade related errors.
626626
* @throws IOException is thrown when there is connection related error.
627627
* */
628-
public MFOrder placeMFOrder(String tradingsymbol, String transactionType, double amount, double quantity, String tag) throws KiteException, IOException {
628+
public MFOrder placeMFOrder(String tradingsymbol, String transactionType, double amount, double quantity, String tag) throws KiteException, IOException, JSONException {
629629
Map<String, Object> params = new HashMap<String, Object>();
630630
params.put("tradingsymbol", tradingsymbol);
631631
params.put("transaction_type", transactionType);
@@ -645,7 +645,7 @@ public MFOrder placeMFOrder(String tradingsymbol, String transactionType, double
645645
* @throws KiteException is thrown for all Kite trade related errors.
646646
* @throws IOException is thrown when there connection related error.
647647
* */
648-
public boolean cancelMFOrder(String orderId) throws KiteException, IOException {
648+
public boolean cancelMFOrder(String orderId) throws KiteException, IOException, JSONException {
649649
KiteRequestHandler kiteRequestHandler = new KiteRequestHandler(proxy);
650650
kiteRequestHandler.deleteRequest(routes.get("mutualfunds.cancel_order").replace(":order_id", orderId), new HashMap<String, Object>(), apiKey, accessToken);
651651
return true;
@@ -656,7 +656,7 @@ public boolean cancelMFOrder(String orderId) throws KiteException, IOException {
656656
* @throws KiteException is thrown for all Kite trade related errors.
657657
* @throws IOException is thrown when there is connection related error.
658658
* */
659-
public List<MFOrder> getMFOrders() throws KiteException, IOException {
659+
public List<MFOrder> getMFOrders() throws KiteException, IOException, JSONException {
660660
JSONObject response = new KiteRequestHandler(proxy).getRequest(routes.get("mutualfunds.orders"), apiKey, accessToken);
661661
return Arrays.asList(gson.fromJson(String.valueOf(response.get("data")), MFOrder[].class));
662662
}
@@ -667,7 +667,7 @@ public List<MFOrder> getMFOrders() throws KiteException, IOException {
667667
* @throws KiteException is thrown for all Kite trade related errors.
668668
* @throws IOException is thrown when there is connection related error.
669669
* */
670-
public MFOrder getMFOrder(String orderId) throws KiteException, IOException {
670+
public MFOrder getMFOrder(String orderId) throws KiteException, IOException, JSONException {
671671
JSONObject response = new KiteRequestHandler(proxy).getRequest(routes.get("mutualfunds.order").replace(":order_id", orderId), apiKey, accessToken);
672672
return gson.fromJson(response.get("data").toString(), MFOrder.class);
673673
}
@@ -683,7 +683,7 @@ public MFOrder getMFOrder(String orderId) throws KiteException, IOException {
683683
* @throws KiteException is thrown for all Kite trade related errors.
684684
* @throws IOException is thrown when there is connection related error.
685685
* */
686-
public MFSIP placeMFSIP(String tradingsymbol, String frequency, int installmentDay, int instalments, int initialAmount, double amount) throws KiteException, IOException {
686+
public MFSIP placeMFSIP(String tradingsymbol, String frequency, int installmentDay, int instalments, int initialAmount, double amount) throws KiteException, IOException, JSONException {
687687
Map<String, Object> params = new HashMap<String, Object>();
688688
params.put("tradingsymbol", tradingsymbol);
689689
params.put("frequency", frequency);
@@ -710,7 +710,7 @@ public MFSIP placeMFSIP(String tradingsymbol, String frequency, int installmentD
710710
* @throws KiteException is thrown for all Kite trade related errors.
711711
* @throws IOException is thrown when there is connection related error.
712712
* */
713-
public boolean modifyMFSIP(String frequency, int day, int instalments, double amount, String status, String sipId) throws KiteException, IOException {
713+
public boolean modifyMFSIP(String frequency, int day, int instalments, double amount, String status, String sipId) throws KiteException, IOException, JSONException {
714714
Map<String, Object> params = new HashMap<String, Object>();
715715
params.put("frequency", frequency);
716716
params.put("day", day);
@@ -728,7 +728,7 @@ public boolean modifyMFSIP(String frequency, int day, int instalments, double am
728728
* @throws KiteException is thrown for all Kite trade related errors.
729729
* @throws IOException is thrown when there is connection related error.
730730
* */
731-
public boolean cancelMFSIP(String sipId) throws KiteException, IOException {
731+
public boolean cancelMFSIP(String sipId) throws KiteException, IOException, JSONException {
732732
new KiteRequestHandler(proxy).deleteRequest(routes.get("mutualfunds.sip").replace(":sip_id", sipId), new HashMap<String, Object>(), apiKey, accessToken);
733733
return true;
734734
}
@@ -738,7 +738,7 @@ public boolean cancelMFSIP(String sipId) throws KiteException, IOException {
738738
* @throws KiteException is thrown for all Kite trade related errors.
739739
* @throws IOException is thrown when there is connection related error.
740740
* */
741-
public List<MFSIP> getMFSIPs() throws KiteException, IOException {
741+
public List<MFSIP> getMFSIPs() throws KiteException, IOException, JSONException {
742742
JSONObject response = new KiteRequestHandler(proxy).getRequest(routes.get("mutualfunds.sips"), apiKey, accessToken);
743743
return Arrays.asList(gson.fromJson(String.valueOf(response.get("data")), MFSIP[].class));
744744
}
@@ -749,7 +749,7 @@ public List<MFSIP> getMFSIPs() throws KiteException, IOException {
749749
* @throws KiteException is thrown for all Kite trade related errors.
750750
* @throws IOException is thrown when there is connection related error.
751751
* */
752-
public MFSIP getMFSIP(String sipId) throws KiteException, IOException {
752+
public MFSIP getMFSIP(String sipId) throws KiteException, IOException, JSONException {
753753
JSONObject response = new KiteRequestHandler(proxy).getRequest(routes.get("mutualfunds.sip").replace(":sip_id", sipId), apiKey, accessToken);
754754
return gson.fromJson(response.get("data").toString(), MFSIP.class);
755755
}
@@ -759,7 +759,7 @@ public MFSIP getMFSIP(String sipId) throws KiteException, IOException {
759759
* @throws KiteException is thrown for all Kite trade related errors.
760760
* @throws IOException is thrown when there is connection related error.
761761
* */
762-
public List<MFHolding> getMFHoldings() throws KiteException, IOException {
762+
public List<MFHolding> getMFHoldings() throws KiteException, IOException, JSONException {
763763
JSONObject response = new KiteRequestHandler(proxy).getRequest(routes.get("mutualfunds.holdings"), apiKey, accessToken);
764764
return Arrays.asList(gson.fromJson(String.valueOf(response.get("data")), MFHolding[].class));
765765
}
@@ -769,7 +769,7 @@ public List<MFHolding> getMFHoldings() throws KiteException, IOException {
769769
* @throws KiteException is thrown for all Kite trade related errors.
770770
* @throws IOException is thrown when there is connection related error.
771771
*/
772-
public JSONObject logout() throws KiteException, IOException {
772+
public JSONObject logout() throws KiteException, IOException, JSONException {
773773
return invalidateAccessToken();
774774
}
775775

@@ -779,7 +779,7 @@ public JSONObject logout() throws KiteException, IOException {
779779
* @throws KiteException is thrown for all Kite trade related errors.
780780
* @throws IOException is thrown when there is connection related error.
781781
*/
782-
public JSONObject invalidateAccessToken() throws IOException, KiteException {
782+
public JSONObject invalidateAccessToken() throws IOException, KiteException, JSONException {
783783
String url = routes.get("api.token");
784784
Map<String, Object> params = new HashMap<>();
785785
params.put("api_key", apiKey);
@@ -794,7 +794,7 @@ public JSONObject invalidateAccessToken() throws IOException, KiteException {
794794
* @throws IOException is thrown for connection related errors.
795795
* @throws KiteException is thrown for Kite trade related errors.
796796
* */
797-
public JSONObject invalidateRefreshToken(String refreshToken) throws IOException, KiteException {
797+
public JSONObject invalidateRefreshToken(String refreshToken) throws IOException, KiteException, JSONException {
798798
Map<String, Object> param = new HashMap<>();
799799
param.put("refresh_token", refreshToken);
800800
param.put("api_key", apiKey);

kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public JSONObject getRequest(String url, String apiKey, String accessToken) thro
6262
* @throws IOException is thrown when there is a connection related error.
6363
* @throws KiteException is thrown for all Kite Trade related errors.
6464
* @throws JSONException is thrown for parsing errors.*/
65-
public JSONObject getRequest(String url, Map<String, Object> params, String apiKey, String accessToken) throws IOException, KiteException {
65+
public JSONObject getRequest(String url, Map<String, Object> params, String apiKey, String accessToken) throws IOException, KiteException, JSONException {
6666
Request request = createGetRequest(url, params, apiKey, accessToken);
6767
Response response = client.newCall(request).execute();
6868
String body = response.body().string();
@@ -143,7 +143,7 @@ public JSONObject getRequest(String url, String commonKey, String[] values, Stri
143143
* @throws IOException is thrown when there is a connection related error.
144144
* @throws KiteException is thrown for all Kite Trade related errors.
145145
* */
146-
public String getCSVRequest(String url, String apiKey, String accessToken) throws IOException, KiteException {
146+
public String getCSVRequest(String url, String apiKey, String accessToken) throws IOException, KiteException, JSONException {
147147
Request request = new Request.Builder().url(url).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
148148
Response response = client.newCall(request).execute();
149149
String body = response.body().string();
@@ -237,4 +237,4 @@ public Request createDeleteRequest(String url, Map<String, Object> params, Strin
237237
Request request = new Request.Builder().url(httpBuilder.build()).delete().header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
238238
return request;
239239
}
240-
}
240+
}

pom.xml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>com.rainmatter.kiteconnect</groupId>
7+
<groupId>com.zerodhatech.kiteconnect</groupId>
88
<artifactId>kiteconnect</artifactId>
9-
<version>3.0.0-SNAPSHOT</version>
9+
<version>3.0.0</version>
1010
<packaging>jar</packaging>
1111

1212
<distributionManagement>
@@ -20,7 +20,7 @@
2020
</repository>
2121
</distributionManagement>
2222

23-
<name>com.rainmatter.kiteconnect:kiteconnect</name>
23+
<name>com.zerodhatech.kiteconnect:kiteconnect</name>
2424
<description>Kite Connect is a set of REST-like APIs that expose many capabilities required to build a complete investment and trading platform.</description>
2525
<url>https://github.com/rainmattertech/kiteconnectjava</url>
2626

@@ -41,9 +41,9 @@
4141
</developers>
4242

4343
<scm>
44-
<connection>scm:git:git:github.com/rainmattertech/kiteconnectjava.git</connection>
45-
<developerConnection>scm:git:ssh:github.com/rainmattertech/kiteconnectjava.git</developerConnection>
46-
<url>https://github.com/rainmattertech/kiteconnectjava/tree/master</url>
44+
<connection>scm:git:git:github.com/zerodhatech/kiteconnectjava.git</connection>
45+
<developerConnection>scm:git:ssh:github.com/zerodhatech/kiteconnectjava.git</developerConnection>
46+
<url>https://github.com/zerodhatech/javakiteconnect/tree/kite3</url>
4747
</scm>
4848

4949
<build>
@@ -128,13 +128,18 @@
128128
<dependency>
129129
<groupId>com.squareup.okhttp3</groupId>
130130
<artifactId>okhttp</artifactId>
131-
<version>3.9.0</version>
131+
<version>3.9.1</version>
132132
</dependency>
133133
<dependency>
134134
<groupId>com.squareup.okio</groupId>
135135
<artifactId>okio</artifactId>
136136
<version>1.13.0</version>
137137
</dependency>
138+
<dependency>
139+
<groupId>com.squareup.okhttp3</groupId>
140+
<artifactId>logging-interceptor</artifactId>
141+
<version>3.9.1</version>
142+
</dependency>
138143
</dependencies>
139144

140145
</project>

0 commit comments

Comments
 (0)