Browse Source
			
			
			Feature/improve financial modeling prep service (#4528)
			
				* Improve service
* Set maximum number of symbols per request
* Migrate getQuotes to stable API version
* Update changelog
			
			
				pull/4530/head
			
			
		 
		
			
				
					
						
						Thomas Kaul
					
					7 months ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
15 additions and 
3 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
 
			
				- 
					
					
					 
					apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					### Changed | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Set the maximum number of symbols per request in the _Financial Modeling Prep_ service | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Migrated the get quotes functionality of the _Financial Modeling Prep_ service to its stable API version | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Improved the language localization for Enlish (`en`) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Upgraded `eslint` dependencies | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Upgraded `Nx` from version `20.6.4` to `20.7.1` | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -325,6 +325,10 @@ export class FinancialModelingPrepService implements DataProviderInterface { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  public getMaxNumberOfSymbolsPerRequest() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return 20; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  public getName(): DataSource { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return DataSource.FINANCIAL_MODELING_PREP; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -341,7 +345,7 @@ export class FinancialModelingPrepService implements DataProviderInterface { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      const quotes = await fetch( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        `${this.URL}/quote/${symbols.join(',')}?apikey=${this.apiKey}`, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        `${this.getUrl({ version: 'stable' })}/batch-quote-short?symbols=${symbols.join(',')}&apikey=${this.apiKey}`, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          signal: AbortSignal.timeout(requestTimeout) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -451,8 +455,14 @@ export class FinancialModelingPrepService implements DataProviderInterface { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return name; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  private getUrl({ version }: { version: number }) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return `https://financialmodelingprep.com/api/v${version}`; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  private getUrl({ version }: { version: number | 'stable' }) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const baseUrl = 'https://financialmodelingprep.com'; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    if (version === 'stable') { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      return `${baseUrl}/stable`; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return `${baseUrl}/api/v${version}`; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  private parseAssetClass(profile: any): { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |