place Order error Order placement failed: The truth value of a Series is ambiguous.

Garud
hi,
I am calling place order as below code in Python3 script
-------------------------------------------------------------------
try:
order_id = kite.place_order(variety="regular",tradingsymbol="INFY",
exchange=kite.EXCHANGE_NSE,
transaction_type=kite.TRANSACTION_TYPE_BUY,
quantity=1,
order_type=kite.ORDER_TYPE_MARKET,
product=kite.PRODUCT_NRML)
print("Order placed. ID is: ",order_id)
except Exception as e:
print("Order placement failed: ",e)
------------------------------------------------------------------------------------------------
getting an exception:
Order placement failed: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Same orders I can place from nodeJS
Please have a look on this as the code for placing order is from github documentation
Tagged:
  • Garud
    Simillar error when I use below code:

    ins=kite.instruments()

    Please help
  • sujith
    Can you run in debug mode and paste the complete stacktrace here?
    Make sure to remove app and user-specific tokens.
  • Garud
    for
    ins=kite.instruments()
    =======================================
    Traceback (most recent call last):
    File ".\daily.py", line 48, in
    ins=kite.instruments()
    File "C:\Python38\lib\site-packages\kiteconnect\connect.py", line 552, in instruments
    return self._parse_instruments(self._get("market.instruments.all"))
    File "C:\Python38\lib\site-packages\kiteconnect\connect.py", line 817, in _get
    return self._request(route, "GET", params)
    File "C:\Python38\lib\site-packages\kiteconnect\connect.py", line 845, in _request
    if self.api_key and self.access_token:
    File "C:\Python38\lib\site-packages\pandas\core\generic.py", line 1478, in __nonzero__
    raise ValueError(
    ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  • Garud
    for

    order_id = kite.place_order(
    variety="regular",
    tradingsymbol="INFY",
    exchange=kite.EXCHANGE_NSE,
    transaction_type=kite.TRANSACTION_TYPE_BUY,
    quantity=1,
    order_type=kite.ORDER_TYPE_MARKET,
    product=kite.PRODUCT_MIS)

    =========================================

    Traceback (most recent call last):
    File ".\daily.py", line 49, in
    order_id = kite.place_order(
    File "C:\Python38\lib\site-packages\kiteconnect\connect.py", line 346, in place_order
    return self._post("order.place", params)["order_id"]
    File "C:\Python38\lib\site-packages\kiteconnect\connect.py", line 821, in _post
    return self._request(route, "POST", params)
    File "C:\Python38\lib\site-packages\kiteconnect\connect.py", line 845, in _request
    if self.api_key and self.access_token:
    File "C:\Python38\lib\site-packages\pandas\core\generic.py", line 1478, in __nonzero__
    raise ValueError(
    ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  • Garud
    @sujith
    I know at this moment it will be EOD for you, but please acknowledge as an when you get this message. Phone call / email will be best, if possible.
  • sujith
    sujith edited June 2020
    This is not a response from the Kite Connect APIs, this message has nothing to do with the Kite Connect library as well.

    You need to understand this is not a support portal and we don't offer support for Kite Connect. We are all developers here like you. We just hang out here to help fellow Kite Connect community developers. We don't encourage passive-aggressive comments on the forum.
  • Garud
    @sujith
    I am extremely sorry if my words offended you.
    Though it was not my intention at all.

    I had just now migrated my script from nodeJs to python and was in hurry to test python script next day.
    Once again, please understand I really did not tend to be aggressive a bit also.

    For the resolution : I had found the issue in my code and as you stated it was nothing to do with API.
    When I am setting the access_token there were garbage chars and it was failing because of that.

    I hope you and team will be always there for us. I express my gratitude for your help.
This discussion has been closed.