Navigation

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

    Square Off API

    Test
    2
    9
    132
    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
      vragency007 last edited by

      I am able to place order. But after than if I want to exit it, is there any API available to exit it?

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

        @vragency007 said in Square Off API:

        I am able to place order. But after than if I want to exit it, is there any API available to exit it?

        HI, You need to get the position book and execute exact reverse order to exit positions.

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

          @admin Reverse means only "transactiontype":"BUY" will be replaced with "transactiontype":"SELL". Only this change or any other changes in request payload?

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

            @vragency007 rest same qty etc..

            1 Reply Last reply Reply Quote 0
            • B
              bh_nil last edited by

              @admin Why are u not releasing SQUARE OFF FEATURE. see I am doing ALGO TRADING using TRADING VIEW webhook ,Probably there are many trends which don't exit smooth as others so ,It gives us multiple signals while exiting,
              SUPPOSE BUY was previous order ,IF I do EXIT using reverse transaction like TRANSACTION.SELL it will exit my trade on first signal ,if second EXIT signal comes it will buy which makes a non sense.thats why square off is required, if NO position was there it will not execute any order but if i do reverse it will buy or sell

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

                @Harman08 said in Square Off API:

                Why are u not releasing SQUARE OFF FEATURE. see I am doing ALGO TRADING using TRADING VIEW webhook ,Probably there are many trends which don't exit smooth as others so ,It gives us multiple signals while exiting,
                SUPPOSE BUY was previous order ,IF I do EXIT using reverse transaction like TRANSACTION.SELL it will exit my trade on first signal ,if second EXIT signal comes it will buy which makes a non sense.thats why square off is required, if NO position was there it will not execute any order but if i do reverse it will buy or sell

                ok we have noted your requirement.

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

                  @admin IF possible, please Either provide us SQUARE OFF FUNCTION as a java code.
                  or provide us a SQUARE OFF logic.
                  also your JAVA CODE is not working in android Studio, All people are getting Null pointer Exception while getting USER TOKEN . After generating a session request .TOKEN method is giving NULL VALUE, Please look at this problem also

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

                    @Harman08 said in Square Off API:

                    also your JAVA CODE is not working in android Studio, All people are getting Null pointer Exception while getting USER TOKEN . After generating a session request .TOKEN method is giving NULL VALUE, Please look at this problem also

                    post your request(java) here.

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

                      @admin
                      public void main() throws SmartAPIException {
                      try{
                      // PROVIDE YOUR API KEY HERE
                      SmartConnect smartConnect = new SmartConnect("XXXX");
                      User user = smartConnect.generateSession("XXXX","XXXX");

                      	 smartConnect.setAccessToken(user.getAccessToken());
                                   smartConnect.setUserId(user.getUserId());
                      	// ;  
                      

                      ///////// Above is partial Code of class//////
                      Error:

                      	 Exception: Attempt to invoke virtual method 'java.lang.String com.angelbroking.smartapi.models.User.getAccessToken()' on a null object reference
                      

                      12-21 14:56:40.986 3779 3779 W System.err

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