fix: lmdbx optiondb `getAggregateSync()` returned `tsStart = undefined`

main
avraham 9 months ago
parent 666ff16583
commit 5b3e9f85f6

@ -28,8 +28,8 @@ function makeOptionContractDatabase(): OptionContractDatabase {
start: [symbol, expirationDate, strike, type, startOfDayUnix], start: [symbol, expirationDate, strike, type, startOfDayUnix],
end: [symbol, expirationDate, strike, type, endOfDayUnix], end: [symbol, expirationDate, strike, type, endOfDayUnix],
}) })
.map(({ value }) => ({ .map(({ key, value }) => ({
tsStart: value.tsStart, tsStart: key[4],
open: value.open, open: value.open,
close: value.close, close: value.close,
high: value.high, high: value.high,
@ -73,7 +73,7 @@ function makeOptionContractDatabase(): OptionContractDatabase {
aggregate.key.strike, aggregate.key.strike,
aggregate.key.type, aggregate.key.type,
], ],
null, null
); );
} }
}); });
@ -92,7 +92,7 @@ function makeOptionContractDatabase(): OptionContractDatabase {
close: aggregate.close, close: aggregate.close,
high: aggregate.high, high: aggregate.high,
low: aggregate.low, low: aggregate.low,
}, }
); );
} }
}); });
@ -101,7 +101,7 @@ function makeOptionContractDatabase(): OptionContractDatabase {
key: { symbol, strike, type, expirationDate }, key: { symbol, strike, type, expirationDate },
}) => { }) => {
const startOfLastHourUnix = new Date( const startOfLastHourUnix = new Date(
`${expirationDate}T00:00:00Z`, `${expirationDate}T00:00:00Z`
).valueOf(); ).valueOf();
const endOfLastHourUnix = startOfLastHourUnix + 3600 * 1000; const endOfLastHourUnix = startOfLastHourUnix + 3600 * 1000;
let minPrice = 0; let minPrice = 0;

Loading…
Cancel
Save