Last History Buy & Sell
Last History Buy & Sell
04 Jun 2020, 17:08
Hello,
New to all of this.
How can I get the last history buy trade and last history sell trade?
I use var trade = History.Last() but then I got a buy or sell trade.
I need the following
var lastBuyTrade = History.Last().BUY or something
var lastSellTrade = History.Last().SELL or something
Any idea?
Thx,
Mario
Replies
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
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
PanagiotisCharalampous
09 Jun 2020, 09:19
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
@PanagiotisCharalampous
PanagiotisCharalampous
05 Jun 2020, 08:16
Hi Mario,
See below an example
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous