|
|
@ -816,15 +816,18 @@ export abstract class PortfolioCalculator { |
|
|
let firstAccountBalanceDate: Date; |
|
|
let firstAccountBalanceDate: Date; |
|
|
let firstActivityDate: Date; |
|
|
let firstActivityDate: Date; |
|
|
|
|
|
|
|
|
|
|
|
if (this.accountBalanceItems?.length > 0) { |
|
|
try { |
|
|
try { |
|
|
const firstAccountBalanceDateString = this.accountBalanceItems[0]?.date; |
|
|
const firstAccountBalanceDateString = this.accountBalanceItems[0].date; |
|
|
firstAccountBalanceDate = firstAccountBalanceDateString |
|
|
firstAccountBalanceDate = firstAccountBalanceDateString |
|
|
? parseDate(firstAccountBalanceDateString) |
|
|
? parseDate(firstAccountBalanceDateString) |
|
|
: new Date(); |
|
|
: new Date(); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
firstAccountBalanceDate = new Date(); |
|
|
firstAccountBalanceDate = new Date(); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.transactionPoints?.length > 0) { |
|
|
try { |
|
|
try { |
|
|
const firstActivityDateString = this.transactionPoints[0].date; |
|
|
const firstActivityDateString = this.transactionPoints[0].date; |
|
|
firstActivityDate = firstActivityDateString |
|
|
firstActivityDate = firstActivityDateString |
|
|
@ -833,8 +836,19 @@ export abstract class PortfolioCalculator { |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
firstActivityDate = new Date(); |
|
|
firstActivityDate = new Date(); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const dates = [firstAccountBalanceDate, firstActivityDate].filter( |
|
|
|
|
|
(date) => { |
|
|
|
|
|
return !!date; |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (dates.length === 0) { |
|
|
|
|
|
return undefined; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return min([firstAccountBalanceDate, firstActivityDate]); |
|
|
return min(dates); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected abstract getSymbolMetrics({ |
|
|
protected abstract getSymbolMetrics({ |
|
|
|