Topics
15 Jun 2020, 16:02
 870
 2
06 Jun 2020, 17:10
 989
 3
04 Jun 2020, 17:08
 1414
 5
Replies

SEOCO
15 Jun 2020, 15:46

RE:

PanagiotisCharalampous said:

Hi Mario,

See below an example for buy orders

var lastBuy = History.Where(x => x.TradeType == TradeType.Buy && x.SymbolName == Symbol.Name).Last();

Best Regards,

Panagiotis 

Join us on Telegram

 

Thx mate,

So simple and still I was strugling with it.

/Mario


@SEOCO

SEOCO
05 Jun 2020, 21:30

RE:

PanagiotisCharalampous said:

Hi Mario,

See below an example

var lastBuy = History.Where(x => x.TradeType == TradeType.Buy).Last();

Best Regards,

Panagiotis 

Join us on Telegram

 

Hello thanks for this information.

It still don't work as it should be.

I need to get the last trade history for a specific symbol but my code is not 100% correct. Any idea?

It should be:

- get last buy information from from history where symbolname=symbol.name and tradetype = tradetype.buy"

and 

- get last sell information from from history where symbolname=symbol.name and tradetype = tradetype.sell"

This is my code for the buy part but I think it is not 100% correct:

if (History.Count(x => x.SymbolName == Symbol.Name) > 0 && History.Count(x => x.TradeType == TradeType.Buy) > 0)
            {
                var lastbuy = History.Last(x => x.TradeType == TradeType.Buy);
                ...

Any help would be appreciated.

Thx,

Mario

 


@SEOCO