When I execute the following query in the QuestDB panel (localhost:9000), it returns the correct timestamp: 2024-01-01T00:00:00.000000Z
(UTC, as recorded).
SELECT
timestamp,
first(open) AS open,
max(high) AS high,
min(low) AS low,
last(close) AS close,
sum(volume) AS volume,
sum(quote_volume) AS quote_volume,
sum(taker_buy_volume) AS taker_buy_volume,
sum(taker_buy_quote_volume) AS taker_buy_quote_volume
FROM klines
WHERE symbol = 'BTCUSDT'
SAMPLE BY 1m
ORDER BY timestamp LIMIT 1;
However, when running the same query in Node.js using pg.query
, the timestamp returned is 2023-12-31T19:00:00.000Z
, meaning it incorrectly applies another UTC conversion.
How can I fix this?
as an option you can use:
cast(timestamp AS LONG) AS timestamp