error when i send newsingleOrder (Invalid message: Field tag is invalid: 38)

Created at 23 Dec 2024, 18:49
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
DA

dawinos

Joined 23.12.2024

error when i send newsingleOrder (Invalid message: Field tag is invalid: 38)
23 Dec 2024, 18:49


hi there 

i try to send an order via fix but i recieve this message 
8=FIX.4.49=17335=D34=249=demo.icmarkets.927813250=TRADE52=20241223-18:45:38.83756=cServer11=e7b21c6c-b798-445e-9241-8ce2920e5df721=38=140=154=155=EUR/USD60=20241223-18:45:3810=041 

 (Invalid message: Field tag is invalid: 38)


def onLogon(self, sessionID):

print(f"Logon successful for session: {sessionID}")


 

self.send_buy_order(sessionID, "EUR/USD", 100, float(1.0450))
 

the code:
def send_buy_order(self, sessionID, symbol, quantity, price):

try:

# Crear el mensaje NewOrderSingle

new_order = fix.Message()

# new_order.getHeader().setField(fix.BeginString(fix.BeginString_FIX44))

new_order.getHeader().setField(fix.MsgType(fix.MsgType_NewOrderSingle))

new_order.getHeader().setField(fix.SenderSubID("TRADE"))

new_order.getHeader().setField(fix.MsgSeqNum(2))

# new_order.getHeader().setField(fix.SendingTime())

# Configurar los campos obligatorios

# new_order.setField(fix.ClOrdID("FIRSTBUY24")) # Identificador único de la orden

cl_ord_id = str(uuid4()) # Generar un ID único para la orden

new_order.setField(fix.ClOrdID(cl_ord_id))

new_order.setField(fix.Symbol(symbol))

new_order.setField(fix.HandlInst(1)) # Cómo manejar la orden (manual)

new_order.setField(fix.Side(fix.Side_BUY)) # Lado de la orden (compra)

new_order.setField(fix.OrderQty(int(quantity))) # Cantidad de la orden

new_order.setField(fix.OrdType(fix.OrdType_MARKET)) # Orden de tipo MARKET (1)

new_order.setField(fix.TransactTime())

# new_order.setField(fix.Price(price)) # Precio (incluso si es 0 para orden de mercado)

# new_order.setField(fix.Account("9278132")) # Cuenta del cliente

# new_order.setField(fix.Currency("USD"))

# new_order.setField(fix.TimeInForce(0)) # Tiempo en fuerza (0 = Day)

print(":::::::msg:::::::",new_order.toString())

print(f"Buy order sent: Symbol={symbol}, Quantity={quantity}, Price={price}, fix.OrdType_MARKET={fix.OrdType_MARKET}")

fix.Session.sendToTarget(new_order, sessionID)

except Exception as e:

print(f"Error sending buy order: {e}")

 

 

please can help me? 


@dawinos