Feature/add benchmarks preset to admin control panel (#3513)
* Add benchmarks preset * Update changelog
This commit is contained in:
parent
58d1abbd38
commit
ee086638f3
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added a benchmarks preset to the historical market data table of the admin control panel
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Changed the mechanism of the `INTRADAY` data gathering to persist data only if the market state is `OPEN`
|
- Changed the mechanism of the `INTRADAY` data gathering to persist data only if the market state is `OPEN`
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { BenchmarkModule } from '@ghostfolio/api/app/benchmark/benchmark.module';
|
||||||
import { OrderModule } from '@ghostfolio/api/app/order/order.module';
|
import { OrderModule } from '@ghostfolio/api/app/order/order.module';
|
||||||
import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module';
|
import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module';
|
||||||
import { TransformDataSourceInRequestModule } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.module';
|
import { TransformDataSourceInRequestModule } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.module';
|
||||||
@ -20,6 +21,7 @@ import { QueueModule } from './queue/queue.module';
|
|||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
ApiModule,
|
ApiModule,
|
||||||
|
BenchmarkModule,
|
||||||
ConfigurationModule,
|
ConfigurationModule,
|
||||||
DataGatheringModule,
|
DataGatheringModule,
|
||||||
DataProviderModule,
|
DataProviderModule,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { BenchmarkService } from '@ghostfolio/api/app/benchmark/benchmark.service';
|
||||||
import { OrderService } from '@ghostfolio/api/app/order/order.service';
|
import { OrderService } from '@ghostfolio/api/app/order/order.service';
|
||||||
import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service';
|
import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service';
|
||||||
import { environment } from '@ghostfolio/api/environments/environment';
|
import { environment } from '@ghostfolio/api/environments/environment';
|
||||||
@ -41,6 +42,7 @@ import { groupBy } from 'lodash';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class AdminService {
|
export class AdminService {
|
||||||
public constructor(
|
public constructor(
|
||||||
|
private readonly benchmarkService: BenchmarkService,
|
||||||
private readonly configurationService: ConfigurationService,
|
private readonly configurationService: ConfigurationService,
|
||||||
private readonly dataProviderService: DataProviderService,
|
private readonly dataProviderService: DataProviderService,
|
||||||
private readonly exchangeRateDataService: ExchangeRateDataService,
|
private readonly exchangeRateDataService: ExchangeRateDataService,
|
||||||
@ -151,7 +153,16 @@ export class AdminService {
|
|||||||
[{ symbol: 'asc' }];
|
[{ symbol: 'asc' }];
|
||||||
const where: Prisma.SymbolProfileWhereInput = {};
|
const where: Prisma.SymbolProfileWhereInput = {};
|
||||||
|
|
||||||
if (presetId === 'CURRENCIES') {
|
if (presetId === 'BENCHMARKS') {
|
||||||
|
const benchmarkAssetProfiles =
|
||||||
|
await this.benchmarkService.getBenchmarkAssetProfiles();
|
||||||
|
|
||||||
|
where.id = {
|
||||||
|
in: benchmarkAssetProfiles.map(({ id }) => {
|
||||||
|
return id;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
} else if (presetId === 'CURRENCIES') {
|
||||||
return this.getMarketDataForCurrencies();
|
return this.getMarketDataForCurrencies();
|
||||||
} else if (
|
} else if (
|
||||||
presetId === 'ETF_WITHOUT_COUNTRIES' ||
|
presetId === 'ETF_WITHOUT_COUNTRIES' ||
|
||||||
|
@ -68,6 +68,11 @@ export class AdminMarketDataComponent
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
.concat([
|
.concat([
|
||||||
|
{
|
||||||
|
id: 'BENCHMARKS',
|
||||||
|
label: $localize`Benchmarks`,
|
||||||
|
type: <Filter['type']>'PRESET_ID'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'CURRENCIES',
|
id: 'CURRENCIES',
|
||||||
label: $localize`Currencies`,
|
label: $localize`Currencies`,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export type MarketDataPreset =
|
export type MarketDataPreset =
|
||||||
|
| 'BENCHMARKS'
|
||||||
| 'CURRENCIES'
|
| 'CURRENCIES'
|
||||||
| 'ETF_WITHOUT_COUNTRIES'
|
| 'ETF_WITHOUT_COUNTRIES'
|
||||||
| 'ETF_WITHOUT_SECTORS';
|
| 'ETF_WITHOUT_SECTORS';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user