Upstox SDK: Getting " no attribute 'swagger_types'" when placing square-off sell order


I am hitting an error while squaring off an existing holding. I have the same script and same quantity holding in my upstox account but not able to sell.

What am I missing?


*** AttributeError: 'numpy.int64' object has no attribute 'swagger_types'


ipdb> body = upstox_client.PlaceOrderRequest(quantity=quantity,  product=product, validity=validity,price=price,instrument_token=instrument_token,order_type=order_type,transaction_type=transaction_type,disclosed_quantity=disclosed_quantity,trigger_price= 
trigger_price,is_amo=is_amo )^M

ipdb> api_version = self.api_version
ipdb> api_response =  self.api_instance_OrderApi.place_order(body, api_version)
*** AttributeError: 'numpy.int64' object has no attribute 'swagger_types'

ipdb> body
{'disclosed_quantity': 0,
 'instrument_token': 'NSE_EQ|INE665J01013',
 'is_amo': 'false',
 'order_type': 'MARKET',
 'price': 0,
 'product': 'D',
 'quantity': 3,
 'tag': None,
 'transaction_type': 'SELL',
 'trigger_price': 0,
 'validity': 'DAY'}


Please refer to this reply.


1 Like