Navigation

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

    Token

    General Discussion
    2
    16
    67
    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.
    • R
      rishi6310 last edited by

      How to place order with token?
      After generating token how to place order without generating new session or feed token

      In python sdk
      Plz write piece of code for every person searching it

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

        Hi @rishi6310 You can go through below piece of code
        https://smartapi.angelbroking.com/topic/1194/basic-smartapi-integration-using-python

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

          @admin if i have feedtoken and to place order multiple times how can i able to do it
          for eg; if a position is open and want to close and open new position with same token how to do it
          if my orderparams are in different python file
          this is generate by token as you mention
          from smartapi import SmartConnect

          ####generate session #####

          obj =SmartConnect(api_key="AW41v31e")

          login = obj.generateSession('Your client id', 'Your password')

          refreshToken = login['data']['refreshToken']

          feedToken = obj.getfeedToken()

          print ("This is my feedtoken::",feedToken)

          #####get ltp#############

          profile = obj.getProfile(refreshToken)
          print (profile)

          ##########################

          orderbook = obj.orderBook()
          print (orderbook)

          ###########################

          orderparams = {
          "variety": "AMO",
          "tradingsymbol": "SBIN-EQ",
          "symboltoken": "3045",
          "transactiontype": "BUY",
          "exchange": "NSE",
          "ordertype": "LIMIT",
          "producttype": "INTRADAY",
          "duration": "DAY",
          "price": "425",
          "squareoff": "0",
          "stoploss": "0",
          "quantity": "1"
          }
          orderId=obj.placeOrder(orderparams)
          print (orderId)
          if i want to close position with only orderparam with generating new token how to do it
          and create other position as per my algo with def (orderparam) only with token in python

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

            @rishi6310 said in Token:

            if i have feedtoken and to place order multiple times how can i able to do it
            for eg; if a position is open and want to close and open new position with same token how to do it
            if my orderparams are in different python file

            hello your tokens are valid till 5am in morning so you dont need to regenerate it again and again.You can place order with same tokens in the day.

            R 2 Replies Last reply Reply Quote 0
            • R
              rishi6310 @admin last edited by

              @admin how to do it
              here i generate a feedtoken and want to place order but i am not able to do it please tell me market is running out of time
              here is piece of code

              from smartapi import SmartConnect
              from smartapi import SmartWebSocket
              import login as l

              feedToken=l.feed_token

              def place_order():
              try:
              orderparams = {
              "variety": "NORMAL",
              "tradingsymbol": "ITC",
              "symboltoken": "1660",
              "transactiontype": "buy",
              "exchange": "NSE-EQ",
              "ordertype": "MARKET",
              "producttype": "CARRYFORWARD",
              "duration": "DAY",
              "price": "0",
              "squareoff": "0",
              "stoploss": "0",
              "quantity": 1
              }
              orderId=obj.placeOrder(orderparams)
              print("The order id is: {}".format(orderId))
              except Exception as e:
              print("Order placement failed: {}".format(e.message))
              i have feedtoken generated please provide piece of code to place order

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

                @admin i am not able to take position try to resolve my query market is running out of time

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

                  Hi @rishi6310 send us your req and response.

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

                    @admin said in Token:

                    Hi @rishi6310 You can go through below piece of code
                    https://smartapi.angelbroking.com/topic/1194/basic-smartapi-integration-using-python

                    There are self explanatory codes available here.

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

                      @admin C:\Users\rishi\PycharmProjects\pythonProjectnew\venv\Scripts\python.exe C:/Users/rishi/PycharmProjects/pythonProjectnew/trading.py

                      Process finished with exit code 0

                      Unresolved reference 'obj' line 25 in this line (orderId=obj.placeOrder(orderparams)
                      this is my piece of code
                      from smartapi import SmartConnect
                      from smartapi import SmartWebSocket
                      import login as l

                      feedToken=l.feed_token

                      def place_order():
                      try:
                      orderparams = {
                      "variety": "NORMAL",
                      "tradingsymbol": "ITC",
                      "symboltoken": "1660",
                      "transactiontype": "buy",
                      "exchange": "NSE-EQ",
                      "ordertype": "MARKET",
                      "producttype": "CARRYFORWARD",
                      "duration": "DAY",
                      "price": "0",
                      "squareoff": "0",
                      "stoploss": "0",
                      "quantity": 1
                      }
                      orderId=obj.placeOrder(orderparams)
                      print("The order id is: {}".format(orderId))
                      except Exception as e:
                      print("Order placement failed: {}".format(e.message))

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

                        @admin i am trying to create gui in tkinter for buying and selling of stocks but not able to link with orderparam with def function but it generate new session everytime when code run and not able to place order with that

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

                          @rishi6310 said in Token:

                          admin i am trying to create gui in tkinter for buying and selling of stocks but not able to link with orderparam with def function but it generate new session everytime when code run and not able to place order with that

                          As this is a user specific requirement you need to connect with your own software team.

                          R A 3 Replies Last reply Reply Quote 0
                          • R
                            rishi6310 @admin last edited by

                            @admin take remote access and try to solve my problem and please tell me how to contact with your software team

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

                              @admin market is running out kindly try to solve my query or provide a way to solve it

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

                                @admin said in Token:

                                As this is a user specific requirement you need to connect with your own software team.

                                please note this you need to connect with you own software team.

                                R 2 Replies Last reply Reply Quote 0
                                • R
                                  rishi6310 @admin last edited by

                                  @admin i don't any software team i am an individual trader that's why i ask for help

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

                                    @admin plz respond to query

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