List of all Smartapi functions in Python
-
Good thing.
if possible list down the exceptions that one gets in different apis.
and most common errors. -
@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
- I dont see function for live data has this function been stopped?
- Does any of the function returns list/number of buyers and sellers and also bid and ask values for equity?
-
@Mnagesh Thank you very much.!!
-
@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. -
@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 .
-
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 pyoobj=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 -
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) -
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
-
-