Order Management - Place order giving 'NoneType' object is not subscriptable

sachinkumarg
I am trying to place order using:

order = kite.place_order(
variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NSE,
tradingsymbol='NIFTY2360818650CE',
transaction_type=kite.TRANSACTION_TYPE_SELL,
quantity=250,
product=kite.PRODUCT_NRML,
order_type=kite.ORDER_TYPE_LIMIT,
price=42.5,
validity=None,
disclosed_quantity=None,
trigger_price=None,
squareoff=None,
stoploss=None,
trailing_stoploss=None,
tag="TradeViaPython")

print(order)

I am getting error

Traceback (most recent call last):
File "D:\Application\automated_trader\bkp.py", line 82, in
order = kite.place_order(
^^^^^^^^^^^^^^^^^
File "D:\Application\automated_trader\kite_trade.py", line 134, in place_order
order_id = self.session.post(f"{self.root_url}/orders/{variety}",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
Tagged:
  • rakeshr
    TypeError: 'NoneType' object is not subscriptable
    order_id = self.session.post(f"{self.root_url}/orders/{variety}",
    You seem to be parsing fields from the empty/null response. You can use the Python client.
  • puneetscorpio
    Is this issue resolved. I am facing the same error
  • rakeshr
    Is this issue resolved. I am facing the same error
    This is not an issue, from the kite connect client, but the parsing of empty response.
  • delonbest
    This error message signifies that you have attempted to perform an indexing operation on an object that lacks the requisite functionality. It is noteworthy that certain methods, such as 'sort()', which solely modify a list, do not yield a printed return value; instead, they return the default 'None.' The error 'NoneType' object is not subscriptable is raised by Python in instances where the square bracket notation 'object[key]' is employed on an object that does not define the 'getitem' method. This underscores a fundamental design principle governing all mutable data structures within the Python programming language.

Sign In or Register to comment.