R
Same error while testing place_order() functionality
#place order
try:
orderparams = {
# "variety": "NORMAL",
"tradingsymbol": "DIL",
"symboltoken": "8657",
"exchange": "NSE",
"transactiontype": "BUY",
"ordertype": "MARKET",
"producttype": "CNC",
"price": "7.8",
"duration": "DAY",
"triggerprice" : "7.8",
"squareoff": "9",
"stoploss" : "5",
"trailingStopLoss" : "0.1",
"disclosedquantity" : '1',
"quantity": "1",
"ordertag" : "testing",
}
# Method 1: Place an order and return the order ID
orderid = smartApi.placeOrder(orderparams)
logger.info(f"PlaceOrder : {orderid}")
# Method 2: Place an order and return the full response
response = smartApi.placeOrderFullResponse(orderparams)
logger.info(f"PlaceOrder : {response}")
except Exception as e:
logger.exception(f"Order placement failed: {e}")
raise ex.DataException("Couldn't parse the JSON response received from the server: {content}".format(
SmartApi.smartExceptions.DataException: Couldn't parse the JSON response received from the server: b''