sdoosa-algo-trade-python
sdoosa-algo-trade-python copied to clipboard
Fetching open positions
Hi Srini, Could you help with a function to fetch the open position (qty) by passing the 'tradingsymbol'? Similar to below. Many Thanks!
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)