High performance time series database
OVER TIME
QQL issues: https://github.com/finos/TimeBase-CE/discussions/255
QQL Having
Condition
HAVING can be used to filter results after GROUP BY
or OVER TIME/COUNT
. It can be useful for cases, if you need to filter a result but WHERE
expression can affect this result.
Example:
WITH entries[this is TradeEntry] as 'entries'
SELECT first{}(entries[0].price) as 'open'
FROM "bitfinex"
OVER TIME(1m)
WHERE symbol == 'BTCUSD' AND notEmpty(entries) AND open is not null
In this case open
expression is calculated during 'WHERE' expression (not after it!), so open
will be calculated even if symbol is not 'BTCUSD' or entries are empty. This will lead to incorrect result.
WITH entries[this is TradeEntry] as 'entries'
SELECT first{}(entries[0].price) as 'open'
FROM "bitfinex"
OVER TIME(1m)
WHERE symbol == 'BTCUSD' AND notEmpty(entries)
HAVING open is not null
Another example:
SELECT count{}() as c
FROM "bars"
GROUP BY symbol
HAVING close > 100