logging.info("Order placed. ID is: {}".format(order_id)) except Exception as e: print (e) logging.info("Order placement failed: {}".format(e.status)) logging.info("Order placement failed: {}".format(e.message)) logging.info("Order placement failed: {}".format(e.error_type))
File "/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 326, in place_order File "/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 701, in _post File "/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 766, in _request kiteconnect.exceptions.InputException: Instrument is invalid.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/kite_order_place.py", line 65, in zerodhautility.kite_place_order(kite,option,'BUY') zerodhautility.py", line 30, in kite_place_order logging.info("Order placement failed: {}".format(e.status)) AttributeError: 'InputException' object has no attribute 'status'
One of the guesses is you seem to be sending a wrong product type. You need to send NRML, CNC product is only for the equity segment(delivery).
try:
order_id = kite.place_order(variety=kite.VARIETY_REGULAR,
tradingsymbol=tradesymbol,
exchange=kite.EXCHANGE_NSE,
transaction_type=transaction_type,
quantity=75,
order_type=kite.ORDER_TYPE_MARKET,
product=kite.PRODUCT_NRML,
validity=kite.VALIDITY_DAY)
logging.info("Order placed. ID is: {}".format(order_id))
except Exception as e:
print (e)
logging.info("Order placement failed: {}".format(e.status))
logging.info("Order placement failed: {}".format(e.message))
logging.info("Order placement failed: {}".format(e.error_type))
File "/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 326, in place_order
File "/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 701, in _post
File "/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 766, in _request
kiteconnect.exceptions.InputException: Instrument is invalid.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/kite_order_place.py", line 65, in
zerodhautility.kite_place_order(kite,option,'BUY')
zerodhautility.py", line 30, in kite_place_order
logging.info("Order placement failed: {}".format(e.status))
AttributeError: 'InputException' object has no attribute 'status'