Update closing trade date on SL or TP
This commit is contained in:
@@ -438,13 +438,13 @@ public class PostgreSqlTradingRepository : ITradingRepository
|
||||
|
||||
/// <summary>
|
||||
/// Updates a trade entity with data from a domain trade object
|
||||
/// Only updates the date if the trade status is changing from Requested to Filled
|
||||
/// Always updates the date when it changes to ensure accurate execution dates
|
||||
/// </summary>
|
||||
private void UpdateTradeEntity(TradeEntity entity, Trade trade)
|
||||
{
|
||||
// Only update the date if the trade status is changing from Requested to Filled
|
||||
// This prevents overwriting dates for trades that are already filled
|
||||
if (entity.Status != TradeStatus.Filled && trade.Status == TradeStatus.Filled)
|
||||
if (entity.Status != trade.Status)
|
||||
{
|
||||
entity.Date = trade.Date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user