Navigation

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

    getTotalBuyQty and getTotalSellQty returning invalid values

    NodeJS SDK
    0
    13
    96
    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
      sevrus last edited by sevrus

          double buyQuantity = quote.getTotalBuyQty();
          double sellQuantity = quote.getTotalSellQty();
          System.out.println(symbol + ": sellQuantity == " + sellQuantity + ", buyQuantity=" + buyQuantity);
      

      the code prints

      PPLPHARMA: sellQuantity == 2.147483647E9, buyQuantity=2.147483647E9
      M&MFIN: sellQuantity == 2.147483647E9, buyQuantity=2.147483647E9
      JIOFIN: sellQuantity == 2.147483647E9, buyQuantity=2.147483647E9
      ONGC: sellQuantity == 2.147483647E9, buyQuantity=2.147483647E9
      NTPC: sellQuantity == 2.147483647E9, buyQuantity=2.147483647E9
      MOTHERSON: sellQuantity == 2.147483647E9, buyQuantity=2.147483647E9

      I am expecting a valid integer/long.

      I am using java smart api 2.2.3

          <dependency>
              <groupId>com.angelbroking.smartapi</groupId>
              <artifactId>smartapi-java</artifactId>
              <version>2.2.3</version>
          </dependency>
      
      S M 2 Replies Last reply Reply Quote 0
      • S
        sevrus @sevrus last edited by

        Appreciate a quick response

        M 2 Replies Last reply Reply Quote 0
        • M
          Moderator_3 @sevrus last edited by

          Hi @sevrus We are checking currently once done let us know here.

          1 Reply Last reply Reply Quote 0
          • S
            sevrus last edited by

            hi @Moderator_3 , did you get a chance to look into this?

            1 Reply Last reply Reply Quote 0
            • M
              Moderator_3 @sevrus last edited by

              Hi @sevrus 2.147483647E9 representation should not in exponent format it should be 2147483647E9 like this. Verify with your end once. If any concern kindly ping here.

              Regards,
              SmartAPI Team

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

                @Moderator_3

                @Moderator_3 said in getTotalBuyQty and getTotalSellQty returning invalid values:

                2.147483647E9 representation should not in exponent format it should be 2147483647E9 like this

                Thanks for your response @Moderator_3

                2147483647E9 is also exponentital format right? it ends with E9.

                Here is the response i get:

                RCF: sellQuantity == 4.703818195117539E18, buyQuantity=4.69298182083104E18
                HAL: sellQuantity == 4.688502126991639E18, buyQuantity=4.683909879239279E18
                FEDERALBNK: sellQuantity == 4.703985885673161E18, buyQuantity=4.701179397275648E18
                IEX: sellQuantity == 4.698413811999179E18, buyQuantity=4.695479997148692E18
                IRFC: sellQuantity == 4.7132944971428E18, buyQuantity=4.702934520628773E18
                BIKAJI: sellQuantity == 4.678673214593827E18, buyQuantity=4.67073693966454E18
                BLKASHYAP: sellQuantity == 4.6869453903254E18, buyQuantity=4.680789018563052E18

                and my code :

                Quote Class : com.angelbroking.smartapi.smartstream.models.Quote

                public void onQuoteArrival(Quote quote) {
                    String token =  quote.getToken().getToken().trim();
                    long feedTimestamp = quote.getExchangeFeedTimeEpochMillis();
                    float price = quote.getLastTradedPrice()/100;
                    float vwap = quote.getAvgTradedPrice()/100;
                    long v = quote.getVolumeTradedToday();
                    double buyQuantity = quote.getTotalBuyQty();
                    double sellQuantity = quote.getTotalSellQty();
                
                S 1 Reply Last reply Reply Quote 0
                • M
                  Moderator_3 @sevrus last edited by

                  Hi @sevrus Yes equivalent to 2.147483647×10 power of 9, which equals 2147483647. Hope you got it. If any concern kindly let us know here.

                  Regards,
                  SmartAPI Team.

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

                    @Moderator_3

                    I understand what exponent is. but the number looks incorrect for buy/sell quantities.

                    BLKASHYAP: sellQuantity == 4.6869453903254E18, buyQuantity=4.680789018563052E18
                    BFUTILITIE: sellQuantity == 4.678757739550212E18, buyQuantity=4.674815715486728E18
                    CUMMINSIND: sellQuantity == 4.67815795595726E18, buyQuantity=4.67632397056213E18
                    RPSGVENT: sellQuantity == 4.676061874477859E18, buyQuantity=4.66557308330469E18
                    SPENCERS: sellQuantity == 4.685811862556639E18, buyQuantity=4.68152445440308E18
                    SAGARDEEP: sellQuantity == 4.67504221488205E18, buyQuantity=4.675931032594153E18

                    does the code look good to you?

                        double buyQuantity = quote.getTotalBuyQty();
                        double sellQuantity = quote.getTotalSellQty();
                        System.out.println(symbol + ": sellQuantity == " + sellQuantity + ", buyQuantity=" + buyQuantity);
                    
                    1 Reply Last reply Reply Quote 0
                    • S
                      sevrus @sevrus last edited by

                      @Moderator_3

                      Can you share a sample code or a sample value for totalbuyQuantity ? and may i know why buyquantity and SellQuantity must be in double?

                      In com.angelbroking.smartapi.smartstream.models.Quote class

                      private double totalBuyQty;
                      private double totalSellQty;
                      
                          public Quote(ByteBuffer buffer) {
                              ..
                              ...
                              this.totalBuyQty = (double)buffer.getLong(75);
                              this.totalSellQty = (double)buffer.getLong(83);
                              .....
                              .........
                          }
                      public double getTotalBuyQty() {
                          return this.totalBuyQty;
                      }
                      
                      S 2 Replies Last reply Reply Quote 0
                      • S
                        sevrus @sevrus last edited by

                        @Moderator_3

                        Is it supposed to be double in the Quote class?

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

                          @Moderator_3

                          Any update on this please? tbq and tsq are double by definition in the Quote class.

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

                            @sevrus said in getTotalBuyQty and getTotalSellQty returning invalid values:

                            @Moderator_3
                            Is it supposed to be double in the Quote class?

                            @Moderator_3

                            1 Reply Last reply Reply Quote 0
                            • S
                              sevrus last edited by

                              @Moderator_3

                              https://github.com/angel-one/smartapi-java/blob/c568e4f1329ac4b1eb56c3ead08c57c9c29f8351/src/main/java/com/angelbroking/smartapi/smartstream/models/Quote.java#L37

                              should this be double here? totalBuyQty and totalSellQty

                              lombok is casting it to double in the constructor

                                  this.totalBuyQty = (double)buffer.getLong(75);
                                  this.totalSellQty = (double)buffer.getLong(83);
                              

                              why should these be double ?

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