|
@ -12,6 +12,7 @@ import { |
|
|
IDataProviderResponse |
|
|
IDataProviderResponse |
|
|
} from '@ghostfolio/api/services/interfaces/interfaces'; |
|
|
} from '@ghostfolio/api/services/interfaces/interfaces'; |
|
|
import { DATE_FORMAT } from '@ghostfolio/common/helper'; |
|
|
import { DATE_FORMAT } from '@ghostfolio/common/helper'; |
|
|
|
|
|
import { DataProviderInfo } from '@ghostfolio/common/interfaces'; |
|
|
import { Injectable } from '@nestjs/common'; |
|
|
import { Injectable } from '@nestjs/common'; |
|
|
import { DataSource, SymbolProfile } from '@prisma/client'; |
|
|
import { DataSource, SymbolProfile } from '@prisma/client'; |
|
|
import * as Alphavantage from 'alphavantage'; |
|
|
import * as Alphavantage from 'alphavantage'; |
|
@ -35,6 +36,12 @@ export class AlphaVantageService implements DataProviderInterface { |
|
|
return !!this.configurationService.get('ALPHA_VANTAGE_API_KEY'); |
|
|
return !!this.configurationService.get('ALPHA_VANTAGE_API_KEY'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public getDataProviderInfo(): DataProviderInfo { |
|
|
|
|
|
return { |
|
|
|
|
|
isPremium: false |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public async getAssetProfile( |
|
|
public async getAssetProfile( |
|
|
aSymbol: string |
|
|
aSymbol: string |
|
|
): Promise<Partial<SymbolProfile>> { |
|
|
): Promise<Partial<SymbolProfile>> { |
|
@ -114,10 +121,11 @@ export class AlphaVantageService implements DataProviderInterface { |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
items: result?.bestMatches?.map((bestMatch) => { |
|
|
items: result?.bestMatches?.map((bestMatch) => { |
|
|
return { |
|
|
return <LookupItem>{ |
|
|
assetClass: undefined, |
|
|
assetClass: undefined, |
|
|
assetSubClass: undefined, |
|
|
assetSubClass: undefined, |
|
|
currency: bestMatch['8. currency'], |
|
|
currency: bestMatch['8. currency'], |
|
|
|
|
|
dataProviderInfo: this.getDataProviderInfo(), |
|
|
dataSource: this.getName(), |
|
|
dataSource: this.getName(), |
|
|
name: bestMatch['2. name'], |
|
|
name: bestMatch['2. name'], |
|
|
symbol: bestMatch['1. symbol'] |
|
|
symbol: bestMatch['1. symbol'] |
|
|