fix: lmdbx optiondb getAggregateSync() returned tsStart = undefined

This commit is contained in:
2024-08-11 17:35:00 -04:00
parent 666ff16583
commit 5b3e9f85f6
+5 -5
View File
@@ -28,8 +28,8 @@ function makeOptionContractDatabase(): OptionContractDatabase {
start: [symbol, expirationDate, strike, type, startOfDayUnix],
end: [symbol, expirationDate, strike, type, endOfDayUnix],
})
.map(({ value }) => ({
tsStart: value.tsStart,
.map(({ key, value }) => ({
tsStart: key[4],
open: value.open,
close: value.close,
high: value.high,
@@ -73,7 +73,7 @@ function makeOptionContractDatabase(): OptionContractDatabase {
aggregate.key.strike,
aggregate.key.type,
],
null,
null
);
}
});
@@ -92,7 +92,7 @@ function makeOptionContractDatabase(): OptionContractDatabase {
close: aggregate.close,
high: aggregate.high,
low: aggregate.low,
},
}
);
}
});
@@ -101,7 +101,7 @@ function makeOptionContractDatabase(): OptionContractDatabase {
key: { symbol, strike, type, expirationDate },
}) => {
const startOfLastHourUnix = new Date(
`${expirationDate}T00:00:00Z`,
`${expirationDate}T00:00:00Z`
).valueOf();
const endOfLastHourUnix = startOfLastHourUnix + 3600 * 1000;
let minPrice = 0;