Qn: How to fetch the qty held for any Instrument

rejeesh31
Hi, I'm looking for some guidance to write a function to fetch the current quantity of any position held. Say I have 100 units of SBIN, i want to program to return 100 when I pass 'SBIN' as the parameter.

Here is how I fetch the price (avg price) of the scrip using order ID.

def fetchPrice(orderId):
logging.info('Fetching order price %s', orderId)
kite = getKite()
try:
price = kite.order_history(order_id=orderId)[(len(kite.order_history(order_id=orderId)))-1]['average_price']
logging.info('Order status fetched for orderId = %s price = %s', orderId, price)
return price
except Exception as e:
logging.info('Order status fetch failed: %s', e.message)


I am trying to write something similar but using the scrip name in place of the order_id. What dict and parameters should I be looking for?

Thanks a lot!
Sign In or Register to comment.