Navigation

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

    Both getPosition and getHolding API not working from java SDK

    NodeJS SDK
    2
    16
    118
    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.
    • V
      vvbchandrasekhar last edited by

      Lack of this data is causing an issue to know which positions to exit based on my algo. however, i see that this API seems to be working in other languages. can you internally raise a bug and check why it doesn't work for Java?

      Is the route in the java sdk configured correctly?

      log.info(smartConnect.getPosition()); produces JSONObject["data"] is not a JSONObject.

      log.info(smartConnect.getHolding()); also produces JSONObject["data"] is not a JSONObject.

      here is the smartconnect code for getPosition -
      public JSONObject getPosition() {
      try {
      String url = routes.get("api.order.rms.position");
      JSONObject response = smartAPIRequestHandler.getRequest(this.apiKey, url, accessToken);
      return response.getJSONObject("data");
      } catch (Exception | SmartAPIException e) {
      System.out.println(e.getMessage());
      return null;
      }
      }


      smart connect code for getHolding is below

      public JSONObject getHolding() {
      	try {
      		String url = routes.get("api.order.rms.holding");
      		JSONObject response = smartAPIRequestHandler.getRequest(this.apiKey, url, accessToken);
      		return response.getJSONObject("data");
      	} catch (Exception | SmartAPIException e) {
      		System.out.println(e.getMessage());
      		return null;
      	}
      }
      
      A 1 Reply Last reply Reply Quote 0
      • A
        admin @vvbchandrasekhar last edited by

        Hi @vvbchandrasekhar we have noticed this we will revert you back.

        V 2 Replies Last reply Reply Quote 0
        • V
          vvbchandrasekhar @admin last edited by

          @admin any update folks?

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

            @admin any update please? I have been waiting for a while for these API's

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

              @admin said in Both getPosition and getHolding API not working from java SDK:

              Hi @vvbchandrasekhar we have noticed this we will revert you back.

              Hi @admin This is really important for my program to run. without this, I am considering other providers. please provide an ETA for this fix.

              A 1 Reply Last reply Reply Quote 0
              • A
                admin @vvbchandrasekhar last edited by

                HI @vvbchandrasekhar we will update you on this issue soon.

                A 1 Reply Last reply Reply Quote 0
                • A
                  admin @admin last edited by

                  hi @vvbchandrasekhar This has been already resolved.

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    admin @admin last edited by

                    HI @vvbchandrasekhar update the jar files to get latest code.

                    V 2 Replies Last reply Reply Quote 0
                    • V
                      vvbchandrasekhar @admin last edited by

                      @admin nice! thanks @admin

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

                        @admin i picked up the latest code and still it doesn't work! Please address this on priority since it impacts my work.

                        I know it is latest code because i needed to refactor the ticker code (removed OnDisconnect()) that was edited.


                        JSONObject["data"] is not a JSONObject.
                        2021-06-27 17:58:35.399 INFO 11972 --- [pool-3-thread-1] com.trade.bot.DailyBot : get position: null


                        JSONObject["data"] is not a JSONArray.
                        2021-06-27 17:58:35.455 INFO 11972 --- [pool-3-thread-1] com.trade.bot.DailyBot : get holding: null

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

                          @vvbchandrasekhar
                          It works if i use postman to hit the endpoint, but the java call through smartapi is still broken. please take a look at this.

                          POSTMAN call to https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/getPosition
                          {
                          "status": true,
                          "message": "SUCCESS",
                          "errorcode": "",
                          "data": [
                          {
                          "symboltoken": "11006",
                          "symbolname": "LIQUIDBEES",
                          "instrumenttype": "",
                          "priceden": "1.00",
                          "pricenum": "1.00",
                          "genden": "1.00",
                          "gennum": "1.00",
                          "precision": "2",
                          "multiplier": "-1",
                          "boardlotsize": "1",
                          "exchange": "NSE",
                          "producttype": "DELIVERY",
                          "tradingsymbol": "LIQUIDBEES-EQ",
                          "symbolgroup": "EQ",
                          "strikeprice": "-1",
                          "optiontype": "",
                          "expirydate": "",
                          "lotsize": "1",
                          "cfbuyqty": "0",
                          "cfsellqty": "0",
                          "cfbuyamount": "0.00",
                          "cfsellamount": "0.00",
                          "buyavgprice": "1000.00",
                          "sellavgprice": "0.00",
                          "avgnetprice": "1000.00",
                          "netvalue": "-1000.00",
                          "netqty": "1",
                          "totalbuyvalue": "1000.00",
                          "totalsellvalue": "0.00",
                          "cfbuyavgprice": "0.00",
                          "cfsellavgprice": "0.00",
                          "totalbuyavgprice": "1000.00",
                          "totalsellavgprice": "0.00",
                          "netprice": "1000.00",
                          "buyqty": "1",
                          "sellqty": "0",
                          "buyamount": "1000.00",
                          "sellamount": "0.00",
                          "pnl": "-0.01",
                          "realised": "-0.00",
                          "unrealised": "-0.01",
                          "ltp": "999.99",
                          "close": "999.99"
                          }
                          ]
                          }


                          JSONObject["data"] is not a JSONObject.
                          2021-06-28 10:52:59.540 INFO 31972 --- [pool-3-thread-1] com.trade.bot.Bot : get position: null


                          JSONObject["data"] is not a JSONArray.
                          2021-06-28 10:52:59.674 INFO 31972 --- [pool-3-thread-1] com.trade.bot.Bot : get holding: null

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            admin @vvbchandrasekhar last edited by

                            HI @vvbchandrasekhar We will connect you for this issue kindly share your client id.

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

                              @admin
                              User Name / User ID: C66377
                              i am available any day ~1pm

                              A 1 Reply Last reply Reply Quote 0
                              • A
                                admin @vvbchandrasekhar last edited by

                                HI @vvbchandrasekhar noted we will connect you soon.

                                A 1 Reply Last reply Reply Quote 0
                                • A
                                  admin @admin last edited by

                                  Hi @vvbchandrasekhar We tried reaching you it seems you are not reachable .Kindly let us know your feasible time to connect.

                                  A 1 Reply Last reply Reply Quote 0
                                  • A
                                    admin @admin last edited by

                                    HI @vvbchandrasekhar This issue has been resolved.

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