Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Getting error from candleData method of sample code

    NodeJS SDK
    2
    3
    64
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      softice last edited by

      Trying to run the sample code for HDFC as follows:

      /** Historic Data */
      public void getCandleData(SmartConnect smartConnect) throws SmartAPIException, IOException {
      
      	JSONObject requestObejct = new JSONObject();
      	requestObejct.put("exchange", "NSE");
      	requestObejct.put("symboltoken", "1330");
      	requestObejct.put("interval", "ONE_MINUTE");
      	requestObejct.put("fromdate", "2021-04-06 09:45");
      	requestObejct.put("todate", "2021-04-06 10:25");
      
      	String response = smartConnect.candleData(requestObejct);
      	System.out.println(response);
      }
      

      Getting following error:

      No such host is known (apiconnect.angelbroking.comnull)

      S 1 Reply Last reply Reply Quote 0
      • S
        softice @softice last edited by

        Here is the solution. The candleData method tries to fetch REST API end point from Routes by doing a lookup for "api.candle.data" key. But to my surprise the Routes doesn't have any entry for api.candle.data.

        So I updated the Routes.java file with following line,
        put("api.candle.data","/rest/secure/angelbroking/historical/
        v1/getCandleData");

        After this the example code worked. I don't think this code was ever tested before publishing it.

        My Indian mentality of getting things for free lured me to use these APIs but now I understand why are they free. I am acting as their tester. Thinking of switching to Zerodha Kite Connect.

        V 1 Reply Last reply Reply Quote 0
        • V
          vvbchandrasekhar @softice last edited by

          @softice
          This is fixed now. But, the String response of this method is not really helpful to me.
          How did you work around that?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post