| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -145,6 +145,40 @@ function makeCalendarDatabase(): CalendarDatabase {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      return minPrice;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    },
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    getAggregate: async ({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      key: { symbol, frontExpirationDate, backExpirationDate, strike, type },
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      tsStart,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }) => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      const [frontOptionContractAggregate, backOptionContractAggregate] =
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        await Promise.all([
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          optionContractDatabase.getAggregate({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            key: { symbol, expirationDate: frontExpirationDate, strike, type },
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            tsStart,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          }),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          optionContractDatabase.getAggregate({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            key: { symbol, expirationDate: backExpirationDate, strike, type },
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            tsStart,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          }),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ]);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      // only return the calendar aggregate if its constituent front and back option contract aggregates exist:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      if (frontOptionContractAggregate && backOptionContractAggregate) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          tsStart,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          open:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            backOptionContractAggregate.open -
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            frontOptionContractAggregate.open,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          close:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            backOptionContractAggregate.close -
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            frontOptionContractAggregate.close,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          high:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            backOptionContractAggregate.high -
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            frontOptionContractAggregate.high,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          low:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            backOptionContractAggregate.low - frontOptionContractAggregate.low,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        };
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      return undefined;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    },
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    getTargetPriceByProbability: async ({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      symbol,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      calendarSpan,
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |