Error Extracting Previous Trade Order ID

sahil_proximity
What Should be My Code, When I Want To Exit The Bought Position At ( AVG + 1Point )
Example: ICICI bought @302.30 (at market rate)
And I Want To Sell It At 1 Point Profit.

I.e Avg price + 1 should be the exit price. how should I write?
need to put a limit sell order, immediately after placing the first order, I need to extract previous orders avg price and add it with 1 for the exit price.

try:
order_id = kite.place_order(
variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NSE,
tradingsymbol="INFY",
transaction_type=kite.TRANSACTION_TYPE_BUY,
quantity=1,
product=kite.PRODUCT_NRML,
order_type=kite.ORDER_TYPE_MARKET
)

logging.info("Order placed. ID is: {}".format(order_id))
except Exception as e:
logging.info("Order placement failed: {}".format(e.message))

# Fetch all orders
kite.orders()
  • sujith
    Yes, you are right. You need to place an order with opposite transaction type and same product, quantity, and variety
Sign In or Register to comment.