¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: A couple of questions regarding the C++ Tws api client


 

¿ªÔÆÌåÓý

This is a problem with nomenclature. Your order is not open, but you have an open position.

You were correct in your first email. To close the position just do the opposite in a new order.

Malcolm


On 28 Jul 2023, at 17:08, aSchwenk64@... wrote:

Hi,

i place an order and i get the following:

ExecDetails. ReqId: -1 - EUR, CASH, USD - 000132b0.64c2e326.01.01, 9, 20000, 20000, 2
OrderStatus. Id: 9, Status: Filled, Filled: 20000, Remaining: 0, AvgFillPrice: 1.10343, PermId: 1476143489, LastFillPrice: 1.10343, ClientId: 0, WhyHeld: , MktCapPrice: 0

This states (i'm not mistaken) that the sent order was executed. If i check the tws server there is a position with -20.000 (as it was a sell order).

Then i try to close it by executing ->? m_pClient->cancelOrder(m_orderId, "");
It states: Error. Id: 9, Code: 10147, Msg: OrderId 9 that needs to be cancelled is not found.

As i see it, the order is still open. If i send a buy order with +20.000 in quantity i can close it.

Cancel implies for me, that if the order isn't executed i can cancel it but not to close an opened order

regards,




Join [email protected] to automatically receive all group messages.