Hacker News new | ask | show | jobs
by dkersten 2560 days ago
By the way, I've recently started using TimescaleDB (past month or two) for processing cryptocurrency trading information and I'm liking it a lot so far. I love that I can use Postgres as normal, but have efficient time-based queries.

My first ever test query was to generate minutely OHLC+volume from time,price,quantity trades. It was pleasantly easy to do:

    select time_bucket('1 minutes', time) as minutely, 
           max(price) as high,
           min(price) as low,
           first(price, time) as open,
           last(price, time) as close,
           sum(quantity) as volume
      from trades
    group by minutely
    order by minutely;
https://gist.github.com/danielytics/e9b69933586e00732646e016...