|
@ -15,6 +15,7 @@ import { |
|
|
import { |
|
|
import { |
|
|
DATE_FORMAT, |
|
|
DATE_FORMAT, |
|
|
getAssetProfileIdentifier, |
|
|
getAssetProfileIdentifier, |
|
|
|
|
|
getYesterday, |
|
|
resetHours |
|
|
resetHours |
|
|
} from '@ghostfolio/common/helper'; |
|
|
} from '@ghostfolio/common/helper'; |
|
|
import { BenchmarkProperty, UniqueAsset } from '@ghostfolio/common/interfaces'; |
|
|
import { BenchmarkProperty, UniqueAsset } from '@ghostfolio/common/interfaces'; |
|
@ -96,8 +97,9 @@ export class DataGatheringService { |
|
|
date |
|
|
date |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const marketPrice = |
|
|
var marketPrice = |
|
|
historicalData[symbol][format(date, DATE_FORMAT)].marketPrice; |
|
|
historicalData[symbol]?.[format(getYesterday(), DATE_FORMAT)] |
|
|
|
|
|
.marketPrice; |
|
|
|
|
|
|
|
|
if (marketPrice) { |
|
|
if (marketPrice) { |
|
|
return await this.prismaService.marketData.upsert({ |
|
|
return await this.prismaService.marketData.upsert({ |
|
@ -114,7 +116,9 @@ export class DataGatheringService { |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
Logger.error(error, 'DataGatheringService'); |
|
|
Logger.error(error, 'DataGatheringService'); |
|
|
} finally { |
|
|
} finally { |
|
|
return undefined; |
|
|
if (dataSource === 'MANUAL' && marketPrice !== undefined) |
|
|
|
|
|
return marketPrice; |
|
|
|
|
|
else return undefined; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|