diff --git a/apps/client/src/app/pages/api/api-page.component.ts b/apps/client/src/app/pages/api/api-page.component.ts index 87fc164af..353605380 100644 --- a/apps/client/src/app/pages/api/api-page.component.ts +++ b/apps/client/src/app/pages/api/api-page.component.ts @@ -4,6 +4,7 @@ import { } from '@ghostfolio/common/config'; import { DATE_FORMAT } from '@ghostfolio/common/helper'; import { + DataProviderGhostfolioAssetProfileResponse, DataProviderGhostfolioStatusResponse, DividendsResponse, HistoricalResponse, @@ -25,6 +26,7 @@ import { map, Observable, Subject, takeUntil } from 'rxjs'; templateUrl: './api-page.html' }) export class GfApiPageComponent implements OnInit { + public assetProfile$: Observable; public dividends$: Observable; public historicalData$: Observable; public isinLookupItems$: Observable; @@ -40,6 +42,7 @@ export class GfApiPageComponent implements OnInit { public ngOnInit() { this.apiKey = prompt($localize`Please enter your Ghostfolio API key:`); + this.assetProfile$ = this.fetchAssetProfile({ symbol: 'AAPL' }); this.dividends$ = this.fetchDividends({ symbol: 'KO' }); this.historicalData$ = this.fetchHistoricalData({ symbol: 'AAPL' }); this.isinLookupItems$ = this.fetchLookupItems({ query: 'US0378331005' }); @@ -53,6 +56,15 @@ export class GfApiPageComponent implements OnInit { this.unsubscribeSubject.complete(); } + private fetchAssetProfile({ symbol }: { symbol: string }) { + return this.http + .get( + `/api/v1/data-providers/ghostfolio/asset-profile/${symbol}`, + { headers: this.getHeaders() } + ) + .pipe(takeUntil(this.unsubscribeSubject)); + } + private fetchDividends({ symbol }: { symbol: string }) { const params = new HttpParams() .set('from', format(startOfYear(new Date()), DATE_FORMAT)) diff --git a/apps/client/src/app/pages/api/api-page.html b/apps/client/src/app/pages/api/api-page.html index d8bfc75d7..3c43484e6 100644 --- a/apps/client/src/app/pages/api/api-page.html +++ b/apps/client/src/app/pages/api/api-page.html @@ -3,6 +3,10 @@

Status

{{ status$ | async | json }}
+
+

Asset Profile

+
{{ assetProfile$ | async | json }}
+

Lookup

@if (lookupItems$) { diff --git a/prisma/migrations/20250915163323_added_data_provider_ghostfolio_resolved_asset_profile/migration.sql b/prisma/migrations/20250915163323_added_data_provider_ghostfolio_resolved_asset_profile/migration.sql new file mode 100644 index 000000000..7afa9f728 --- /dev/null +++ b/prisma/migrations/20250915163323_added_data_provider_ghostfolio_resolved_asset_profile/migration.sql @@ -0,0 +1,15 @@ +-- CreateTable +CREATE TABLE "public"."DataProviderGhostfolioResolvedAssetProfile" ( + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "currency" TEXT NOT NULL, + "dataSource" "public"."DataSource" NOT NULL, + "id" TEXT NOT NULL, + "requestCount" INTEGER NOT NULL DEFAULT 1, + "symbol" TEXT NOT NULL, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "DataProviderGhostfolioResolvedAssetProfile_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "DataProviderGhostfolioResolvedAssetProfile_dataSource_symbo_key" ON "public"."DataProviderGhostfolioResolvedAssetProfile"("dataSource", "symbol"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 609bede5c..56fce42db 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -101,6 +101,18 @@ model AuthDevice { @@index([userId]) } +model DataProviderGhostfolioResolvedAssetProfile { + createdAt DateTime @default(now()) + currency String + dataSource DataSource + id String @id @default(uuid()) + requestCount Int @default(1) + symbol String + updatedAt DateTime @updatedAt + + @@unique([dataSource, symbol]) +} + model MarketData { createdAt DateTime @default(now()) dataSource DataSource