@@ -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 );
0 commit comments