diff --git a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts index a96511246..28fe7a0cf 100644 --- a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts +++ b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts @@ -163,10 +163,6 @@ export class CoinGeckoService implements DataProviderInterface { public async search(aQuery: string): Promise<{ items: LookupItem[] }> { let items: LookupItem[] = []; - if (aQuery.length <= 2) { - return { items }; - } - try { const get = bent( `${this.URL}/search?query=${aQuery}`, diff --git a/apps/api/src/services/data-provider/data-provider.service.ts b/apps/api/src/services/data-provider/data-provider.service.ts index 980b1a620..9edeedc1c 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -264,6 +264,10 @@ export class DataProviderService { const promises: Promise<{ items: LookupItem[] }>[] = []; let lookupItems: LookupItem[] = []; + if (aQuery?.length < 2) { + return { items: lookupItems }; + } + for (const dataSource of this.configurationService.get('DATA_SOURCES')) { promises.push( this.getDataProvider(DataSource[dataSource]).search(aQuery) diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index 447268ad0..a39100d1f 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -158,10 +158,6 @@ export class EodHistoricalDataService implements DataProviderInterface { public async search(aQuery: string): Promise<{ items: LookupItem[] }> { let items: LookupItem[] = []; - if (aQuery.length <= 2) { - return { items }; - } - try { const get = bent( `${this.URL}/search/${aQuery}?api_token=${this.apiKey}`, diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts index 6bbf5cd65..df612ed67 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts @@ -243,11 +243,10 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { this.filteredLookupItemsObservable = this.activityForm.controls[ 'searchSymbol' ].valueChanges.pipe( - startWith(''), debounceTime(400), distinctUntilChanged(), switchMap((query: string) => { - if (isString(query)) { + if (isString(query) && query.length > 1) { const filteredLookupItemsObservable = this.dataService.fetchSymbols(query);