Navigation

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

    List of all Smartapi functions in Python

    Python SDK
    8
    11
    1163
    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
      rahul4019 last edited by

      Good thing.
      if possible list down the exceptions that one gets in different apis.
      and most common errors.

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

        @Mnagesh Thanks nagesh this deservers a ping so new people can also know this @admin suggest pinging this or add it to your github readme.md file

        Coming to this great work and there are couple of things i wanna ask

        1. I dont see function for live data has this function been stopped?
        2. Does any of the function returns list/number of buyers and sellers and also bid and ask values for equity?
        1 Reply Last reply Reply Quote 0
        • B
          bm0126782 @Mnagesh last edited by

          @Mnagesh Thank you very much.!!

          1 Reply Last reply Reply Quote 0
          • P
            projectSB @Mnagesh last edited by

            @Mnagesh Thanks!
            However, there is an API for getting individual order status. I don't see that mentioned here? Could you please provide that as well?
            OR
            Let's say I have placed an order. How to get the exact status of that individual order? What are my options in this case?
            I want to know whether my order is still pending or complete before placing orders of other legs.

            Mnagesh 1 Reply Last reply Reply Quote 0
            • Mnagesh
              Mnagesh @projectSB last edited by

              @projectSB After getting the order status , you need to search the particular record in JSON so that you will get the result what you need, It is a simple Json extraction .

              Now I am full time Algo Trader and successfully developed my own Apps for my personal use.

              1 Reply Last reply Reply Quote -1
              • R
                retipser last edited by

                why is feedtoken fetching some long length hexadecimal code...

                from SmartApi import SmartConnect,smartApiWebsocket
                import pandas as pa
                import xlwings as xl
                import pyotp as pyo

                obj=SmartConnect(api_key="*******")
                data=obj.generateSession("A92018","0409",pyo.TOTP("**************").now())
                refreshtoken= data['data']['refreshToken']

                feedtoken = obj.getfeedToken()
                print(feedtoken)

                Result : C:\Users\ajays> & C:/Users/ajays/AppData/Local/Microsoft/WindowsApps/python3.12.exe c:/Users/ajays/smartapiv1.py
                [I 240303 15:21:26 smartConnect:113] in pool
                eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IkE5MjAxOCIsImlhdCI6MTcwOTQ1OTQ4NywiZXhwIjoxNzA5NTQ1ODg3fQ.5mCpr0nNSi19BIwkJSuBEaHvgfYsflipwAGfO4-HupOWFSBGf3_0TSUxw7GX5AaH4uQw0J70Ycg04y_As17o2g

                1 Reply Last reply Reply Quote 0
                • Mnagesh
                  Mnagesh last edited by

                  Now around 44 functions are available in Smartapi-python 1.4.8

                  | allholding(self)
                  |
                  | cancelOrder(self, order_id, variety)
                  |
                  | convertPosition(self, positionParams)
                  |
                  | estimateCharges(self, params)
                  |
                  | gainersLosers(self, params)
                  |
                  | generateSession(self, clientCode, password, totp)
                  |
                  | generateTPIN(self, params)
                  |
                  | generateToken(self, refresh_token)
                  |
                  | getCandleData(self, historicDataParams)
                  |
                  | getMarginApi(self, params)
                  |
                  | getMarketData(self, mode, exchangeTokens)
                  |
                  | getProfile(self, refreshToken)
                  |
                  | getTranStatus(self, params)
                  |
                  | getUserId()
                  |
                  | getfeedToken(self)
                  |
                  | gttCancelRule(self, gttCancelParams)
                  |
                  | gttCreateRule(self, createRuleParams)
                  |
                  | gttDetails(self, id)
                  |
                  | gttLists(self, status, page, count)
                  |
                  | gttModifyRule(self, modifyRuleParams)
                  |
                  | holding(self)
                  |
                  | individual_order_details(self, qParam)
                  |
                  | login_url(self)
                  | Get the remote login url to which a user should be redirected to initiate the login flow.
                  |
                  | ltpData(self, exchange, tradingsymbol, symboltoken)
                  |
                  | make_authenticated_get_request(self, url, access_token)
                  |
                  | modifyOrder(self, orderparams)
                  |
                  | oIBuildup(self, params)
                  |
                  | optionGreek(self, params)
                  |
                  | orderBook(self)
                  |
                  | placeOrder(self, orderparams)
                  |
                  | placeOrderFullResponse(self, orderparams)
                  |
                  | position(self)
                  |
                  | putCallRatio(self)
                  |
                  | renewAccessToken(self)
                  |
                  | requestHeaders(self)
                  |
                  | rmsLimit(self)
                  |
                  | searchScrip(self, exchange, searchscrip)
                  |
                  | setAccessToken(self, access_token)
                  |
                  | setFeedToken(self, feedToken)
                  |
                  | setRefreshToken(self, refresh_token)
                  |
                  | setSessionExpiryHook(self, method)
                  |
                  | setUserId(self, id)
                  |
                  | terminateSession(self, clientCode)
                  |
                  | tradeBook(self)
                  |
                  | verifyDis(self, params)

                  Now I am full time Algo Trader and successfully developed my own Apps for my personal use.

                  tester12345 1 Reply Last reply Reply Quote 0
                  • M
                    mrig last edited by

                    how does one get the list of all outstanding gtts in the account. the following is retuning no data while there are actually gtts outstanding in the account

                    smart_api = SmartConnect(api_key=api_key)
                    
                    # Login
                    try:
                        data = smart_api.generateSession(client_code, pwd, totp)
                        print("Login response:", json.dumps(data, indent=2))
                        if data.get('status'):
                            print("Login successful")
                            auth_token = data['data']['jwtToken']
                            refresh_token = data['data']['refreshToken']
                            feed_token = smart_api.getfeedToken()
                            print("Feed token:", feed_token)
                        else:
                            print("Login failed:", data.get('message'))
                            return None
                    except Exception as e:
                        print(f"Login error: {str(e)}")
                        return None
                    
                    # Get the list of GTTs
                    try:
                        # Use the correct method: gttLists
                        gtt_list = smart_api.gttLists(status=['ACTIVE'], page=1, count=10)
                        print("Raw GTT response:", json.dumps(gtt_list, indent=2))
                        
                        if isinstance(gtt_list, dict):
                            if 'status' in gtt_list:
                                print(f"API Status: {gtt_list['status']}")
                            if 'message' in gtt_list:
                                print(f"API Message: {gtt_list['message']}")
                            if 'errorcode' in gtt_list:
                                print(f"API Error Code: {gtt_list['errorcode']}")
                        
                        return gtt_list
                    except Exception as e:
                        print(f"An error occurred while fetching GTT orders: {str(e)}")
                        return None
                    
                    1 Reply Last reply Reply Quote 0
                    • tester12345
                      tester12345 @Mnagesh last edited by

                      @mnagesh https://evil.com

                      tester12345 1 Reply Last reply Reply Quote 0
                      • tester12345
                        tester12345 @tester12345 last edited by

                        @tester12345 https://evil.com

                        P A 2 Replies Last reply Reply Quote 0
                        • First post
                          Last post