Find PendingOrder from label

Created at 12 Apr 2021, 11:56
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!
JE

JerryTrader

Joined 06.01.2021

Find PendingOrder from label
12 Apr 2021, 11:56


Hi all, 

I know there is Find/FindAll methods on Positions to find Position based on the label / Symbol / TradeType, and I was expecting to see the same methods on the PendingOrders.

There is not, so I will have to use LinQ (no problems with that), but:

- Is there a reason why these methods are just on Positions and not PendingOrders ?

- Is there any difference between doing Positions.First(p => p.label == "test") and Positions.Find("test") or Positions.Where(p => p.label == "test") and Positions.FindAll("test") ?

 

Thanks for your answers,
Cheers,
Jerry


@JerryTrader
Replies

amusleh
13 Apr 2021, 09:50

Hi,

You can use all Linq methods and there is no difference, if there is an API method I recommend you to use it instead of Linq, otherwise use Linq.

 


@amusleh

JerryTrader
13 Apr 2021, 11:30

RE:

amusleh said:

Hi,

You can use all Linq methods and there is no difference, if there is an API method I recommend you to use it instead of Linq, otherwise use Linq.

I prefer to use the API when available, but since it is not available on the PendingOrder, for the sake of consistency, I will use Linq.

Thanks for your answer.


@JerryTrader