Object of type int64 is not JSON serializable

I am getting following error while executing my python script to place an order.

Here's the order data structure:

{'symbol': 'NSE:CUB24SEP172.5CE',

'qty': 5000,

'type': 1,

'side': 1,

'productType': 'INTRADAY',

'limitPrice': 5.15,

'stopPrice': 0,

'validity': 'IOC',

'disclosedQty': 0,

'offlineOrder': False,

'orderTag': 'NSE:CUB24SEP172.5CE'

}

Here's the exception:

Traceback (most recent call last): File "/Users/Nitin.Nagoria/Library/Python/3.9/lib/python/site-packages/fyers_apiv3/fyersModel.py", line 75, in post_call data=json.dumps(data), File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 231, in dumps return _default_encoder.encode(obj) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type int64 is not JSON serializable

Can someone pls help?

2 replies