开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

What is manualOrderCancelTime param of Eclient::cancelOrder( int id, String manualOrderCancelTime)


 

Yes, this should work.
--
Best,
DS


 

Just to wrap this up (since we are moving from an TWS API issue that applies to all 6000++ members to basic Python programming skills).

Shouldn't it be self.cancelOrder(orderId, OrderCancel()) instead of self.cancelOrder([orderId], OrderCancel()) ?

cancelOrder() defines orderId as an integer value and doesn't [orderId] make it a list of one integer value?

闯ü谤驳别苍

?

?
On Wed, Sep 11, 2024 at 10:44 AM, ds-avatar wrote:

Yes, this should work.
--
Best,
DS


 

In client API 10.19 the method's signature suggests an object of type OrderId for the first operand, which appears to be equivalent to a single int, i.e. a primitive integer type. Since square brackets indicate a list of objects in Python, it goes against the signature, and although typing annotations in Python are purely suggestive, in fact the source of the method itself indicates this shouldn't really work.
?
I frankly didn't pay much attention to this artefact assuming it could be some type of symbolic notation but if it's a direct quote then it definitely doesn't look right to me unless newer API versions introduce changes to the method allowing to pass it a list of order ids.
?
--
Best,
DS


 

For the benefit of those members that do use Python with the TWS API (and 闯ü谤驳别苍 surely with over 6,000 members I cannot be the only one, and therefore this has relevance to those members), I used the following method which works nicely.
?
# create the OrderCancel object
order_cancel = OrderCancel()
?
# add an empty string for manualOrderCancelTime to the object
order_cancel.manualOrderCancelTime = ""

# pass the object as the second parameter
self.cancelOrder(orderId, order_cancel)
?
Also DS, to clarify, I did indeed use square brackets as a symbolic notation of passing a single integer value as the OrderID, rather than this being the syntax of the code that would represent a list in Python.
?
As this was the last issue in my 6000+ line program that I so naively developed using a copy-and-paste approach, I am most pleased that the program now works perfectly and is rendering excellent daily results.?
?
Thank you all for your input.