Browse Source
			
			
			Bugfix/improve handling of derived currencies (#2604)
			
				* Improve handling of derived currencies
* Update changelog
			
			
				pull/2615/head
			
			
		 
		
			
				
					
						
						Thomas Kaul
					
					2 years ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
28 additions and 
0 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
 
			
				- 
					
					
					 
					apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					- Improved the language localization for the _Fear & Greed Index_ (market mood) | 
					 | 
					 | 
					- Improved the language localization for the _Fear & Greed Index_ (market mood) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					- Improved the language localization for German (`de`) | 
					 | 
					 | 
					- Improved the language localization for German (`de`) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					### Fixed | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					- Improved the handling of derived currencies (`GBp`, `ILA`, `ZAc`) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					## 2.18.0 - 2023-11-05 | 
					 | 
					 | 
					## 2.18.0 - 2023-11-05 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					### Added | 
					 | 
					 | 
					### Added | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -95,6 +95,30 @@ export class ExchangeRateDataService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      const [currency1, currency2] = symbol.match(/.{1,3}/g); | 
					 | 
					 | 
					      const [currency1, currency2] = symbol.match(/.{1,3}/g); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      const [date] = Object.keys(result[symbol]); | 
					 | 
					 | 
					      const [date] = Object.keys(result[symbol]); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      // Add derived currencies
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      if (currency2 === 'GBP') { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        resultExtended[`${currency1}GBp`] = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          [date]: { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            marketPrice: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					              result[`${currency1}${currency2}`][date].marketPrice * 100 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      } else if (currency2 === 'ILS') { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        resultExtended[`${currency1}ILA`] = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          [date]: { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            marketPrice: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					              result[`${currency1}${currency2}`][date].marketPrice * 100 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      } else if (currency2 === 'ZAR') { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        resultExtended[`${currency1}ZAc`] = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          [date]: { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            marketPrice: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					              result[`${currency1}${currency2}`][date].marketPrice * 100 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      // Calculate the opposite direction
 | 
					 | 
					 | 
					      // Calculate the opposite direction
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      resultExtended[`${currency2}${currency1}`] = { | 
					 | 
					 | 
					      resultExtended[`${currency2}${currency1}`] = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        [date]: { | 
					 | 
					 | 
					        [date]: { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |