How to detect that a PendingOrder has been filled?
How to detect that a PendingOrder has been filled?
07 Jun 2016, 19:23
There seems to be no simple way to detect if a given pending order has been filled. One indirect way seems to match positions and orders by labels. However, this seems cumbersome at best. Isn't there a better way??? What is the purpose of the seemingly undocumented Quantity property on the PendingOrder interface?
Replies
... Deleted by UFO ...
zelenij.krokodil
07 Jun 2016, 20:25
I figured that much - matching comments/labels will get the info, but this is more of a hack than a proper way of doing it, in my opinion.
@zelenij.krokodil
... Deleted by UFO ...
zelenij.krokodil
07 Jun 2016, 20:41
Thanks for pointing out History. However, you solution is O(1) and if an algo produces a lot of closed positions over time, this might be a performance issue. History.Find might be a better option, assuming it is not implemented as linear search as well. If it is, we are doomed and I might need to reevaluate cAlgo suitability for my purposes...
@zelenij.krokodil
zelenij.krokodil
07 Jun 2016, 20:42
Sorry, I meant to say your solution was O(n). My, there is no edit option, not to mention lots of spam at the top of each forum section...
@zelenij.krokodil
kricka
08 Jun 2016, 22:02
Latest filled and closed position
Do not worry about misspelling or writing the wrong words. An edit function though would be most welcome and also spam removal by the moderator to make the forum more readable.
When it comes to listing, the latest filled and closed position may be of interest for you to check into.
Information and download link: Bought and Sold cBot
@kricka
zelenij.krokodil
08 Jun 2016, 22:13
RE: Latest filled and closed position
kricka said:
Do not worry about misspelling or writing the wrong words. An edit function though would be most welcome and also spam removal by the moderator to make the forum more readable.
When it comes to listing, the latest filled and closed position may be of interest for you to check into.
Information and download link: Bought and Sold cBot
I am afraid this won't do for me, because I might have multiple orders being filled/closed at the same time. So I really need to know order/position's status at any given moment (I realize that a message could be in transit from the broker, but that's another story).
@zelenij.krokodil
zelenij.krokodil
07 Jun 2016, 19:56
And while we are at it, how do I know if a given position is closed or not? At what price?
@zelenij.krokodil