| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3,13 +3,11 @@ import { open } from "lmdbx";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const calendarAggregatesDb = open({
 | 
					 | 
					 | 
					 | 
					const calendarAggregatesDb = open({
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						path: "./calendar-aggregates.db",
 | 
					 | 
					 | 
					 | 
						path: "./calendar-aggregates.db",
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						// any options go here, we can turn on compression like this:
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						compression: true,
 | 
					 | 
					 | 
					 | 
						compression: true,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					});
 | 
					 | 
					 | 
					 | 
					});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const calendarExistenceDb = open({
 | 
					 | 
					 | 
					 | 
					const calendarExistenceDb = open({
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						path: "./calendar-existence.db",
 | 
					 | 
					 | 
					 | 
						path: "./calendar-existence.db",
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						// any options go here, we can turn on compression like this:
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						compression: true,
 | 
					 | 
					 | 
					 | 
						compression: true,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					});
 | 
					 | 
					 | 
					 | 
					});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -65,6 +63,19 @@ function makeCalendarDatabase(): CalendarDatabase {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										low: value.low,
 | 
					 | 
					 | 
					 | 
										low: value.low,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									})).asArray;
 | 
					 | 
					 | 
					 | 
									})).asArray;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							},
 | 
					 | 
					 | 
					 | 
							},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    getAggregate: async ({
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      key: { symbol, frontExpirationDate, backExpirationDate, strike, type },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      tsStart,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }) => {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      return await calendarAggregatesDb.get([
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        symbol,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        frontExpirationDate,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        backExpirationDate,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        strike,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        type,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        tsStart,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      ]);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							insertAggregates: async (aggregates) => {
 | 
					 | 
					 | 
					 | 
							insertAggregates: async (aggregates) => {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								await calendarExistenceDb.batch(() => {
 | 
					 | 
					 | 
					 | 
								await calendarExistenceDb.batch(() => {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									for (const aggregate of aggregates) {
 | 
					 | 
					 | 
					 | 
									for (const aggregate of aggregates) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -77,7 +88,7 @@ function makeCalendarDatabase(): CalendarDatabase {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												aggregate.key.strike,
 | 
					 | 
					 | 
					 | 
												aggregate.key.strike,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												aggregate.key.type,
 | 
					 | 
					 | 
					 | 
												aggregate.key.type,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											],
 | 
					 | 
					 | 
					 | 
											],
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											null,
 | 
					 | 
					 | 
					 | 
					            null
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										);
 | 
					 | 
					 | 
					 | 
										);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									}
 | 
					 | 
					 | 
					 | 
									}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								});
 | 
					 | 
					 | 
					 | 
								});
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -97,7 +108,7 @@ function makeCalendarDatabase(): CalendarDatabase {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												close: aggregate.close,
 | 
					 | 
					 | 
					 | 
												close: aggregate.close,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												high: aggregate.high,
 | 
					 | 
					 | 
					 | 
												high: aggregate.high,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												low: aggregate.low,
 | 
					 | 
					 | 
					 | 
												low: aggregate.low,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											},
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										);
 | 
					 | 
					 | 
					 | 
										);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									}
 | 
					 | 
					 | 
					 | 
									}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								});
 | 
					 | 
					 | 
					 | 
								});
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |