fno_symbol = "SBIN25MAR21405CE"
symboltoken = "52653"
qtp = "3000"
try:
orderparams = {
"variety": "NORMAL",
"tradingsymbol": fno_symbol,
"symboltoken": symboltoken,
"transactiontype": "BUY",
"exchange": "NFO",
"ordertype": "MARKET",
"producttype": "INTRADAY",
"duration": "DAY",
"price": "0",
"squareoff": "0",
"stoploss": "0",
"quantity": qtp
}
orderId=angle.placeOrder(orderparams)
print("The order id is: {}".format(orderId))
aleart(str(orderId))
#aleart("Order successfully placed" + fno_symbol)
except Exception as e:
print("Order placement failed: {}".format(e.message))
error :
Traceback (most recent call last):
File "./TestPlaceOrder.py", line 119, in buy
orderId=angle.placeOrder(orderparams)
File "/usr/local/lib/python3.6/site-packages/smartapi/smartConnect.py", line 309, in placeOrder
orderResponse= self._postRequest("api.order.place", params)['data']['orderid']
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./TestPlaceOrder.py", line 127, in <module>
buy("SBIN",405)
File "./TestPlaceOrder.py", line 124, in buy
print("Order placement failed: {}".format(e.message))
AttributeError: 'TypeError' object has no attribute 'message'