| 
						
						
						
					 | 
					@ -1,6 +1,7 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { | 
					 | 
					 | 
					import { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  GATHER_ASSET_PROFILE_PROCESS, | 
					 | 
					 | 
					  GATHER_ASSET_PROFILE_PROCESS, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					  GATHER_ASSET_PROFILE_PROCESS_OPTIONS | 
					 | 
					 | 
					  GATHER_ASSET_PROFILE_PROCESS_OPTIONS, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  PROPERTY_IS_DATA_GATHERING_ENABLED | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} from '@ghostfolio/common/config'; | 
					 | 
					 | 
					} from '@ghostfolio/common/config'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { getAssetProfileIdentifier } from '@ghostfolio/common/helper'; | 
					 | 
					 | 
					import { getAssetProfileIdentifier } from '@ghostfolio/common/helper'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { Injectable } from '@nestjs/common'; | 
					 | 
					 | 
					import { Injectable } from '@nestjs/common'; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -8,6 +9,7 @@ import { Cron, CronExpression } from '@nestjs/schedule'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { DataGatheringService } from './data-gathering/data-gathering.service'; | 
					 | 
					 | 
					import { DataGatheringService } from './data-gathering/data-gathering.service'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { ExchangeRateDataService } from './exchange-rate-data/exchange-rate-data.service'; | 
					 | 
					 | 
					import { ExchangeRateDataService } from './exchange-rate-data/exchange-rate-data.service'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import { PropertyService } from './property/property.service'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { TwitterBotService } from './twitter-bot/twitter-bot.service'; | 
					 | 
					 | 
					import { TwitterBotService } from './twitter-bot/twitter-bot.service'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@Injectable() | 
					 | 
					 | 
					@Injectable() | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -17,13 +19,16 @@ export class CronService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  public constructor( | 
					 | 
					 | 
					  public constructor( | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private readonly dataGatheringService: DataGatheringService, | 
					 | 
					 | 
					    private readonly dataGatheringService: DataGatheringService, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private readonly exchangeRateDataService: ExchangeRateDataService, | 
					 | 
					 | 
					    private readonly exchangeRateDataService: ExchangeRateDataService, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private readonly propertyService: PropertyService, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private readonly twitterBotService: TwitterBotService | 
					 | 
					 | 
					    private readonly twitterBotService: TwitterBotService | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  ) {} | 
					 | 
					 | 
					  ) {} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  @Cron(CronExpression.EVERY_HOUR) | 
					 | 
					 | 
					  @Cron(CronExpression.EVERY_HOUR) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  public async runEveryHour() { | 
					 | 
					 | 
					  public async runEveryHour() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    if (await this.isDataGatheringEnabled()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      await this.dataGatheringService.gather7Days(); | 
					 | 
					 | 
					      await this.dataGatheringService.gather7Days(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  @Cron(CronExpression.EVERY_12_HOURS) | 
					 | 
					 | 
					  @Cron(CronExpression.EVERY_12_HOURS) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  public async runEveryTwelveHours() { | 
					 | 
					 | 
					  public async runEveryTwelveHours() { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -37,6 +42,7 @@ export class CronService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  @Cron(CronService.EVERY_SUNDAY_AT_LUNCH_TIME) | 
					 | 
					 | 
					  @Cron(CronService.EVERY_SUNDAY_AT_LUNCH_TIME) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  public async runEverySundayAtTwelvePm() { | 
					 | 
					 | 
					  public async runEverySundayAtTwelvePm() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    if (await this.isDataGatheringEnabled()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      const uniqueAssets = await this.dataGatheringService.getUniqueAssets(); | 
					 | 
					 | 
					      const uniqueAssets = await this.dataGatheringService.getUniqueAssets(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      await this.dataGatheringService.addJobsToQueue( | 
					 | 
					 | 
					      await this.dataGatheringService.addJobsToQueue( | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -56,3 +62,12 @@ export class CronService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      ); | 
					 | 
					 | 
					      ); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  } | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  private async isDataGatheringEnabled() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    return (await this.propertyService.getByKey( | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      PROPERTY_IS_DATA_GATHERING_ENABLED | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    )) === false | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      ? false | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      : true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |