Hi @Tradehull_Imran ,
Despite trying eveything getting the above error: is there anyting i am missing?
First tried format:
‘’’
def create_order_payload(transaction_type, securityId, quantity=QUANTITY):
try:
# Convert securityId to native int if possible
securityId = int(securityId)
except Exception as e:
print(f"[{datetime.now()}] Warning: Could not convert securityId {securityId} to int: {e}")
return {
“dhanClientId”: client_code,
“correlationId”: str(uuid.uuid4()),
“transactionType”: transaction_type, # “BUY” or “SELL”
“exchangeSegment”: exchangeSegment,
“productType”: productType,
“orderType”: “MARKET”,
“validity”: “DAY”,
“securityId”: securityId,
“quantity”: quantity,
“disclosedQuantity”: “”,
“price”: 0,
“triggerPrice”: 0,
“afterMarketOrder”: False,
“amoTime”: “”,
“boProfitValue”: “”,
“boStopLossValue”: “”
}
‘’’
2nd Format Tried:
‘’’
def create_order_payload(security_id, exchange_segment, transaction_type, quantity, order_type, product_type, price=0):
payload = {
“security_id”: int(security_id),
“exchange_segment”: exchange_segment,
“transaction_type”: transaction_type,
“quantity”: quantity,
“order_type”: order_type,
“product_type”: product_type,
“price”: price, # 0 for market order
“correlation_id”: str(uuid.uuid4()), # generate a unique correlation id
“validity”: “DAY” # you can adjust if needed
}
return payload
‘’’
If anyone can help, would be really great.
@Tradehull_Imran
@Tradehull
@Hardik


