Live crypto price charts
Real-time Bitcoin, Ethereum & 20+ pairs on QuestDB
Latest trades
Real-time buy and sell orders from OKX, covering exchanges amongst assets.
SELECT timestamp,left(symbol,strpos(symbol,'-')-1) asset,right(symbol,length(symbol)-strpos(symbol,'-')) counter,case when side = 'buy' then amount else -amount end quantity,case when side = 'buy' then -amount*price else amount*price end consideration,case when (now()-timestamp)/1000000<0.3 then 'x' else '' end newfrom trades where dateadd('m', -1, now()) < timestampand (symbol like '%-USDT'or symbol like '%-ETH'or symbol like '%-BTC')order by timestamp desclimit 50;
Real-time trades
Filled exchange orders between crypto assets, with USD notional along the y-axis. Positive values are buy orders, negative are sell orders.
SELECT timestamp time, symbol,case when side ='buy' then amount*priceelse -1*amount*price end tradefrom trades where dateadd('m', -1, now()) < timestamp and (symbol like '%-USDT');
Trade Blotter · OHLC · VWAP · RSI · Bollinger Bands
Tick-by-tick OKX data ingested into QuestDB and rendered in Grafana dashboards
Volume heatmap
Trade volume (USD notional) distribution per asset for the past 5 minutes.
select timestamp time, left(symbol,strpos(symbol,'-')-1) asset, sum(abs(amount)) fromtrades where dateadd('m', -5, now()) < timestamp andsymbol like '%-USDT'sample by 5sorder by asset, time;
Candlestick Chart (OHLC) BTC-USDT
An OHLC (Open, High, Low, Close) chart for BTC-USDT, sampled every five seconds over the past 5 minutes.
SELECT timestamp as time, first(price) as open, last(price) as close, min(price) as lo, max(price) as hi, sum(amount) as volFROM tradesWHERE symbol = 'BTC-USDT' and dateadd('m', -5, now()) < timestampSAMPLE BY 5s ALIGN TO CALENDAR;
Purpose-built for Tick & Order-Book Data
Store depth snapshots with ARRAY columns and query them using capital-markets SQL functions
Moving averages BTC-USDT
Moving averages on the price of BTC-USDT in the past 5 minutes, over 10-, 30-, and 45-second windows.
SELECT timestamp time, symbol, price as priceBtc, avg(price) over (PARTITION BY symbol ORDER BY timestamp RANGE between 10 seconds PRECEDING AND CURRENT ROW) movingAvg10Sec, avg(price) over (PARTITION BY symbol ORDER BY timestamp RANGE between 30 seconds PRECEDING AND CURRENT ROW) movingAvg30Sec, avg(price) over (PARTITION BY symbol ORDER BY timestamp RANGE between 45 seconds PRECEDING AND CURRENT ROW) movingAvg45SecFROM trades WHERE dateadd('m', -5, now()) < timestamp AND symbol = 'BTC-USDT';
Rolling BTC-USDT vs ETH-USDT correlation coefficient
Calculation of the Pearson correlation coefficient (ρ) between the prices of BTC-USDT and ETH. Data is sampled every minute over the past 12 hours, and correlation is calculated over hour- and day-long windows.
WITH data as (WITHETHUSD as (select timestamp, last(price) as price from trades where dateadd('h', -12, now()) < timestamp and symbol = 'ETH-USDT' sample by 1s),asset as (select timestamp, last(price) as price from trades where dateadd('h', -12, now()) < timestamp and symbol = 'BTC-USDT' sample by 1s)SELECT ETHUSD.timestamp, corr(ETHUSD.price,asset.price) from ETHUSD asof join asset sample by 1m)SELECT timestamp, avg(corr) over(ORDER BY timestamp range between 1 hour preceding and current row) hourly_corr_rolling, avg(corr) over(ORDER BY timestamp range between 24 hour preceding and current row) daily_corr_rollingfrom data;
Extreme Performance
Low-latency, Millions of rows per second, instant analytics at terabyte scale
VWAP - Yesterday vs Today - BTC-USDT
Volume Weighted Average Price of BTC-USDT from yesterday compared to today. It uses the `trades_OHLC_15m` materialized view, so data is returned at 15 minute intervals
WITH sampled AS (SELECTtimestamp, symbol,volume AS volume,((open+close)/2) * volume AS traded_valueFROM trades_OHLC_15mWHERE dateadd('d', -1, now()) < timestampAND symbol = 'BTC-USDT'), cumulative AS (SELECT timestamp, symbol,SUM(traded_value)OVER (ORDER BY timestamp) AS cumulative_value,SUM(volume)OVER (ORDER BY timestamp) AS cumulative_volumeFROM sampled)SELECT timestamp as time, cumulative_value/cumulative_volume AS vwap_yesterday FROM cumulative;
Bollinger Bands BTC-USDT
Bollinger Bands. We are using the moving average over the past 20 closing prices of BTC-USDT at 15 minute intervals, plus/minus twice of the standard deviation. It can help identify volatility. This query uses the `trades_OHLC_15m` materialized view
WITH stats AS (SELECTtimestamp,close,AVG(close) OVER (ORDER BY timestampROWS BETWEEN 19 PRECEDING AND CURRENT ROW) AS sma20,AVG(close * close ) OVER (ORDER BY timestampROWS BETWEEN 19 PRECEDING AND CURRENT ROW) AS avg_close_sqFROM trades_OHLC_15mWHERE timestamp between dateadd('h', -24, now()) AND now()AND symbol = 'BTC-USDT')SELECTtimestamp as time,sma20,-- sqrt(avg_close_sq - (sma20 * sma20)) as stdev20,sma20 + 2 * sqrt(avg_close_sq - (sma20 * sma20)) as upper_band,sma20 - 2 * sqrt(avg_close_sq - (sma20 * sma20)) as lower_bandFROM statsORDER BY timestamp;
Interactive SQL
Click SHOW QUERY to inspect the live QuestDB statements behind every panel
Average True Range BTC-USDT
This chart shows the 14-period Average True Range (ATR) for BTC-USDT, using 15-minute OHLC bars from the `trades_OHLC_15m` materialized view, over the past 15 days. The ATR measures short-term volatility by averaging the True Range, defined as the greatest of: • High − Low • |High − Previous Close| • |Low − Previous Close| Higher ATR values indicate greater price movement and market volatility; lower values reflect more stable, range-bound behavior.
WITH prev_close AS (SELECTtimestamp, symbol, high, low,LAG(close) OVER (PARTITION BY symbol ORDER BY timestamp) as prev_closeFROM trades_OHLC_15mWHERE symbol = 'BTC-USDT'AND dateadd('d', -15, now()) < timestamp), true_range AS (SELECTtimestamp, symbol,GREATEST(high - low,ABS(high - prev_close),ABS(low - prev_close)) AS trFROM prev_close)SELECTtimestamp as time, symbol,AVG(tr) OVER (PARTITION BY symbol ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS atr_14FROM true_rangeORDER BY timestamp;
Relative Strength Index 14 days - BTC-USDT
14-day RSI (Relative Strength Index) for BTC-USDT using daily closes from the trades_latest_1d table over the selected 1-month range. RSI is calculated by averaging 14 days of gains and losses. Values near 70 suggest overbought conditions; values near 30 suggest oversold. A smoothing window of 14 periods is applied using window functions.
WITH price_changes AS (SELECTtimestamp,symbol,close,close - prev_close price_changeFROM (SELECTtimestamp,symbol,price as close,LAG(price) OVER (PARTITION BY symbol ORDER BY timestamp) AS prev_closeFROM trades_latest_1dWHERE dateadd('M', -1, now()) < timestampAND symbol = 'BTC-USDT')),gains_losses AS (SELECTtimestamp,symbol,close,CASE WHEN price_change > 0 THEN price_change ELSE 0 END AS gain,CASE WHEN price_change < 0 THEN ABS(price_change) ELSE 0 END AS lossFROM price_changes),avg_gains_losses AS (SELECTtimestamp,symbol,close,AVG(gain) OVER (PARTITION BY symbol ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS avg_gain,AVG(loss) OVER (PARTITION BY symbol ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS avg_lossFROM gains_losses)SELECTtimestamp as time,symbol,CASEWHEN avg_loss = 0 THEN 100ELSE 100 - (100 / (1 + (avg_gain / NULLIF(avg_loss, 0))))END AS rsi_14FROM avg_gains_lossesORDER BY timestamp;
Try it yourself
Ready to store market data? Follow our tutorial series on building Grafana dashboards
Relative Strength Index 14 days - All Symbols
14-day RSI (Relative Strength Index) computed for all symbols ending in -USDT, -ETH, or -BTC using daily closing prices from the `trades_latest_1d` materialized view. Uses a 14-period rolling window of average gains and losses per symbol. Highlights overbought (>70) or oversold (<30) conditions across assets.
WITH price_changes AS (SELECTtimestamp,symbol,close,close - prev_close price_changeFROM (SELECTtimestamp,symbol,price as close,LAG(price) OVER (PARTITION BY symbol ORDER BY timestamp) AS prev_closeFROM trades_latest_1dWHERE dateadd('M', -1, now()) < timestampAND (symbol like '%-USDT'or symbol like '%-ETH'or symbol like '%-BTC'))),gains_losses AS (SELECTtimestamp,symbol,close,CASE WHEN price_change > 0 THEN price_change ELSE 0 END AS gain,CASE WHEN price_change < 0 THEN ABS(price_change) ELSE 0 END AS lossFROM price_changes),avg_gains_losses AS (SELECTtimestamp,symbol,close,AVG(gain) OVER (PARTITION BY symbol ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS avg_gain,AVG(loss) OVER (PARTITION BY symbol ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS avg_lossFROM gains_losses)SELECTtimestamp as time,symbol,CASEWHEN avg_loss = 0 THEN 100ELSE 100 - (100 / (1 + (avg_gain / NULLIF(avg_loss, 0))))END AS rsi_14FROM avg_gains_losses;
Build your own on QuestDB
High performance ingest & slick visualizations.
Perfect for financial data and real-time analytics.