kite.convert_position - kiteconnect.exceptions.InputException: Missing or empty field `exchange`"

prashantq
Hi,
Using python client, when I try to convert the MIS position to CNC, I get "*** kiteconnect.exceptions.InputException: Missing or empty field `exchange`" error.
I have verified all values are present and I also updated the client to the latest version.

```
if "MIS" == position['product'] and position['quantity'] > 0:
pdb.set_trace()
kite.convert_position(
exchange=kite.EXCHANGE_NSE,
tradingsymbol=position['tradingsymbol'],
transaction_type=kite.TRANSACTION_TYPE_BUY,
position_type=kite.VALIDITY_DAY,
quantity=position['quantity'],
old_product=kite.PRODUCT_MIS,
new_product=kite.PRODUCT_CNC
)
```

Version details:
```
Name: kiteconnect
Version: 3.9.0
Summary: The official Python client for the Kite Connect trading API
Home-page: https://kite.trade
Author: Zerodha Technology Pvt ltd. (India)
Author-email: [email protected]
License: MIT
Location: d:\work\bash_config\.conda\envs\algo\lib\site-packages
Requires: pyOpenSSL, six, python-dateutil, requests, pywin32, autobahn, service-identity, enum34
Required-by:

```
  • prashantq
    prashantq edited January 2021
    Hi Rakesh,
    I am already using the latest version of the kiteconnect.

    Below is the result:

    (algo) C:\Users\prash>pip install --upgrade kiteconnect
    Requirement already up-to-date: kiteconnect in d:\work\bash_config\.conda\envs\algo\lib\site-packages (3.9.0)

    But the convert_position still fails

    !kite.convert_position(
    tradingsymbol='aplltd', #position['tradingsymbol'],
    exchange='nse',
    transaction_type='buy',
    position_type='day',
    quantity=1, #position['quantity'],
    old_product=kite.PRODUCT_MIS,
    new_product=kite.PRODUCT_CNC
    )
    *** kiteconnect.exceptions.InputException: Missing or empty field `exchange`
  • rakeshr
    @prashantq
    We are checking this.
  • npchoubey
    same issue.
  • prashantq
    @rakeshr any update on this issue?
  • rakeshr
    @prashantq
    There are few issues coming up while releasing this version. We are checking on this.
  • rakeshr
    @prashantq
    This is fixed. You can upgrade to the latest version using pip install --upgrade kiteconnect and try the position_convertion method call.
  • prashantq
    It seems like it worked ..
    but there was one issue..
    I had to hard code the 'day' value instead of a constant.

    position_type='day', #kite.VALIDITY_DAY,

  • rakeshr
    @prashantq
    You don't need to. You can use POSITION_TYPE_DAY constant. Check this assignment.
Sign In or Register to comment.