Aggregated view average entry price (which includes commissions) is different to coded version (which doesn't include commissions)
Aggregated view average entry price (which includes commissions) is different to coded version (which doesn't include commissions)
12 Sep 2023, 01:30
Hello,
the Position window in "aggregated view" shows Average entry price for a symbol - and this seems to include the cost of commissions both ways.
However when I use the following code:
double AverageEntry = Positions.Where(x => x.SymbolName == Symbol.Name).Average(i => i.EntryPrice);
this price does not include the cost of commissions.
How do I get the Average entry price that displays in the aggregated view for a particular symbol?
Thanks, Leon
Replies
PanagiotisChar
13 Sep 2023, 05:51
( Updated at: 13 Sep 2023, 05:59 )
Hi there,
I do not have a ready code to share but you can use Symbol.Commission and Symbol.CommissionType alongside with some math to calculate this
@PanagiotisChar
PanagiotisChar
12 Sep 2023, 06:01
Hi there,
As far as I know it does not
@PanagiotisChar