Browse Source
			
			
			Bugfix/improve get range query in market data service (#2659)
			
				* Attempt to fix "too many bind variables in prepared statement, expected maximum of 32767"
* Update changelog
			
			
				pull/2660/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 
18 additions and 
12 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
 
			
				- 
					
					
					 
					apps/api/src/services/market-data/market-data.service.ts
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## Unreleased | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					### Fixed | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Fixed the "too many bind variables in prepared statement" issue of the data range functionality (`getRange()`) in the market data service | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## 2.23.0 - 2023-11-15 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					### Added | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -64,7 +64,7 @@ export class MarketDataService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    dateQuery: DateQuery; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    uniqueAssets: UniqueAsset[]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  }): Promise<MarketData[]> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return await this.prismaService.marketData.findMany({ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return this.prismaService.marketData.findMany({ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      orderBy: [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          date: 'asc' | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -74,18 +74,18 @@ export class MarketDataService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      ], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      where: { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        OR: uniqueAssets.map(({ dataSource, symbol }) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          return { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AND: [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					              { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dataSource, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                symbol, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                date: dateQuery | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					              } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        dataSource: { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          in: uniqueAssets.map(({ dataSource }) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return dataSource; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          }) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        date: dateQuery, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        symbol: { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          in: uniqueAssets.map(({ symbol }) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return symbol; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          }) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |