Topics
Replies
jan.schmid
04 Mar 2024, 14:15
( Updated at: 05 Mar 2024, 06:49 )
RE: Order ID Not found
PanagiotisCharalampous said:
So the message you get is correct. You are trying to cancel an order with ID. This is not a valid order id
so This is my order and i use the Order ID for the Cancel Request.
8=FIX.4.4|9=116|35=F|49=demo.ctrader.4136405|56=cServer|57=TRADE|50=TRADE|34=1|52=20240304-14:06:15|41=OID127198522|11=OID127199999|10=088|
8=FIX.4.4|9=110|35=F|49=demo.ctrader.4136405|56=cServer|57=TRADE|50=TRADE|34=1|52=20240305-06:45:59|41=127198522|11=127199999|10=167|
I tried these Fix messages with the OrderCancelRequest() function. And the following are my Responses.
8=FIX.4.4|9=179|35=j|34=2|49=cServer|50=TRADE|52=20240304-14:06:15.263|56=demo.ctrader.4136405|57=TRADE|58=ORDER_NOT_FOUND:Order with clientOrderId=OID127198522 not found.|379=OID127199999|380=0|10=186|
8=FIX.4.4|9=173|35=j|34=2|49=cServer|50=TRADE|52=20240305-06:45:59.088|56=demo.ctrader.4136405|57=TRADE|58=ORDER_NOT_FOUND:Order with clientOrderId=127198522 not found.|379=127199999|380=0|10=014|
It's a Order ID made by ctrader so why does it dont want to work?
@jan.schmid
jan.schmid
04 Mar 2024, 07:33
8=FIX.4.4|9=134|35=D|49=demo.ctrader.4136405|56=cServer|57=TRADE|50=TRADE|34=1|52=20240304-07:30:09|11=D|55=22312|54=1|60=20240304-07:30:09|38=1|40=1|10=178|
So this is my message to buy a position.
and this is my try so close the position
8=FIX.4.4|9=94|35=F|49=demo.ctrader.4136405|56=cServer|57=TRADE|50=TRADE|34=1|52=20240304-07:31:56|41=D|11=D|10=069|
@jan.schmid
jan.schmid
01 Mar 2024, 13:01
I use these python funktions with the classes from ctrader.
def closerfunktion(client):
closer = OrderCancelRequest(config)
closer.OrigClOrdID = "D"
closer.ClOrdID = "D"
client.send(closer)
def getStatus(client):
status = OrderStatusRequest(config)
status.ClOrdID = "D" #15678945
client.send(status)
def order(client):
order = NewOrderSingle(config)
order.ClOrdID = "D" # Eindeutige Bestell-ID
order.Symbol = con.symbolID # Symbol für Gold (XAUUSD,22312)
order.Side = var.orderSide # 1 für Kauf (buy), 2 für Verkauf (sell)
order.OrderQty = var.quantity # Handelsgröße (1 Unze Gold)
order.OrdType = "1" # 1 für Market-Order
client.send(order)
print("Order Send")
I tried to print the messages I send but i havent found the right code to print it properly :(
@jan.schmid
jan.schmid
01 Mar 2024, 09:33
( Updated at: 01 Mar 2024, 11:58 )
Fixed it
The problem was that i used the password from the account and not the password from the actual trading account. Where you can change there
@jan.schmid
jan.schmid
05 Mar 2024, 12:34
RE: RE: Order ID Not found
ctid1980098 said:
Appreciate it my code worked perfectly now :)
@jan.schmid