sdoosa-algo-trade-python icon indicating copy to clipboard operation
sdoosa-algo-trade-python copied to clipboard

Fetching open positions

Open rejeesh31 opened this issue 3 years ago • 0 comments

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)

rejeesh31 avatar Jun 02 '21 18:06 rejeesh31