Browse Source

Code review changes

pull/4524/head
csehatt741 3 days ago
parent
commit
0ea845100b
  1. 2
      CHANGELOG.md
  2. 2
      apps/api/src/services/data-provider/errors/asset-profile-delisted.error.ts
  3. 3
      apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
  4. 12
      apps/api/src/services/queues/data-gathering/data-gathering.processor.ts

2
CHANGELOG.md

@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added the data gathering status column to the historical market data table of the admin control
- Deactivated asset profile on delisting (Yahoo Finance)
- Deactivated asset profiles automatically on delisting in the _Yahoo Finance_ service
### Changed

2
apps/api/src/services/data-provider/yahoo-finance/asset-profile-delisted.error.ts → apps/api/src/services/data-provider/errors/asset-profile-delisted.error.ts

@ -1,5 +1,5 @@
export class AssetProfileDelistedError extends Error {
constructor(message: string) {
public constructor(message: string) {
super(message);
this.name = 'AssetProfileDelistedError';
}

3
apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts

@ -1,5 +1,6 @@
import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';
import { YahooFinanceDataEnhancerService } from '@ghostfolio/api/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service';
import { AssetProfileDelistedError } from '@ghostfolio/api/services/data-provider/errors/asset-profile-delisted.error';
import {
DataProviderInterface,
GetAssetProfileParams,
@ -31,8 +32,6 @@ import {
} from 'yahoo-finance2/dist/esm/src/modules/historical';
import { Quote } from 'yahoo-finance2/dist/esm/src/modules/quote';
import { AssetProfileDelistedError } from './asset-profile-delisted.error';
@Injectable()
export class YahooFinanceService implements DataProviderInterface {
public constructor(

12
apps/api/src/services/queues/data-gathering/data-gathering.processor.ts

@ -1,5 +1,5 @@
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';
import { AssetProfileDelistedError } from '@ghostfolio/api/services/data-provider/yahoo-finance/asset-profile-delisted.error';
import { AssetProfileDelistedError } from '@ghostfolio/api/services/data-provider/errors/asset-profile-delisted.error';
import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces';
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service';
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
@ -147,17 +147,17 @@ export class DataGatheringProcessor {
);
} catch (error) {
if (error instanceof AssetProfileDelistedError) {
const updatedSymbolProfile: Prisma.SymbolProfileUpdateInput = {
isActive: false
};
await this.symbolProfileService.updateSymbolProfile(
{
dataSource,
symbol
},
updatedSymbolProfile
{
isActive: false
}
);
await job.discard();
}
Logger.error(

Loading…
Cancel
Save