'TypeError' object has no attribute 'message' Error while placing order
-
Hello sir, I am unable to place order using your sample code. I am able to generate tokens but while placing order it gives error "'TypeError' object has no attribute 'message'" . I am using below code</br>
</br>obj=SmartConnect(api_key="XXXX") #"XXXX replaced with api key"</br>
data = obj.generateSession("P51757","XXXX") #"XXXX replaced with pass"</br>
refreshToken= data['data']['refreshToken']</br>
feedToken=obj.getfeedToken()</br>
userProfile= obj.Profile(refreshToken)</br>try:</br>
orderparams = {</br>
"variety": "NORMAL",</br>
"tradingsymbol": "SBIN-EQ",</br>
"symboltoken": "3045",</br>
"transactiontype": "BUY",</br>
"exchange": "NSE",</br>
"ordertype": "LIMIT",</br>
"producttype": "MARGIN",</br>
"duration": "DAY",</br>
"price": "477",</br>
"squareoff": "0",</br>
"stoploss": "0",</br>
"quantity": "1"</br>
}</br>
orderId=object.placeOrder(orderparams)</br>
print("The order id is: {}".format(orderId))</br>
return orderId</br>
except Exception as e:</br>
print("Order placement failed: {}".format(e.message))</br>
return "Not Placed"</br>
</br>
Can you please let me know what causing the issue.
Thanks -
By any chance is this resolved for you?
- topic:timeago_earlier,3 months
-
Hi @neeluru
We have replied to your query here - https://smartapi.angelbroking.com/topic/1538/order-placement-failed-nonetype-object-is-not-subscriptable
-
@pankaj8932
I am also facing same issue. Is it resolved ? - topic:timeago_earlier,10 months
-
@admin Can you please check what is the issue with my user. Is there any settings need to enable for my user?