OHLC - Bids - 5secs - (EURUSD)
Candlestick chart summarizing price action using the best bid from the order book, aggregated into 5-second intervals. Each candlestick shows the open, high, low, and close bid price, along with traded volume. Ideal for visualizing price trends, volatility, and market regime changes over time. Data is queried from a live table and aggregated on the fly.
selecttimestamp,first(bids[1,1]) open,max(bids[1,1]) high,min(bids[1,1]) low,last(bids[1,1]) close,sum(bids[2,1]) total_volumefrom market_datawhere dateadd('m', -5, now()) < timestamp and symbol = 'EURUSD'sample by 5s;
Market Depth - EURUSD
Visualizes the order book snapshot for the selected currency pair, showing the price and cumulative volume at each bid and ask level. The area under the green (bids) and red (asks) lines represents market liquidity on both sides, with the mid-price and top volume “walls” highlighted for quick identification of major support and resistance.
WITH snapshot AS (SELECT timestamp, bids, asksFROM market_dataWHERE dateadd('m', -1, now()) < timestamp and symbol = 'EURUSD'ORDER BY timestamp DESCLIMIT 1)SELECT timestamp, bids[1] as bprices, bids[2] as bvolumes, array_cum_sum(bids[2]) as bcumvolumes,asks[1] as aprices, asks[2] as avolumes, array_cum_sum(asks[2]) as acumvolumes from snapshot;
VWAP - RSI 12h - Bollinger Bands (20,2) (EURUSD)
Multi-layered chart, overlaid on OHLC candles, combining three technical indicators for the selected symbol: • VWAP: Shows the Volume-Weighted Average Price, a key benchmark for execution quality. • RSI (12h): The Relative Strength Index, computed over 12-hour rolling windows, highlights overbought/oversold conditions and price momentum. • Bollinger Bands (20,2): Plots a 20-period moving average with ±2 standard deviations, indicating price volatility and potential breakout/reversal zones. Each period is 15 minutes, so the simple moving average (SMA) covers a 6-hour window.
WITH sampled AS (SELECTtimestamp, symbol,total_volume,((open+close)/2) * total_volume AS traded_valueFROM market_data_ohlc_1mWHERE date_trunc('day', now()) < timestampANDsymbol IN 'EURUSD'), cumulative AS (SELECT timestamp, symbol,SUM(traded_value)OVER (ORDER BY timestamp) AS cumulative_value,SUM(total_volume)OVER (ORDER BY timestamp) AS cumulative_volumeFROM sampled), vwap as (SELECT timestamp, cumulative_value/cumulative_volume AS vwap FROM cumulative)SELECT * FROM vwap;
select timestamp, open, high, low, close, total_volumefrom market_data_ohlc_15mwhere date_trunc('day', now()) < timestamp and symbol = 'EURUSD';
WITH price_changes AS (SELECTtimestamp,symbol,bid,bid - prev_bid price_changeFROM (SELECTtimestamp,symbol,bid,LAG(bid) OVER (PARTITION BY symbol ORDER BY timestamp) AS prev_bidFROM bbo_1hWHERE date_trunc('day', now()) < timestampAND symbol = 'EURUSD')),gains_losses AS (SELECTtimestamp,symbol,bid,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,bid,AVG(gain) OVER (PARTITION BY symbol ORDER BY timestamp ROWS BETWEEN 11 PRECEDING AND CURRENT ROW) AS avg_gain,AVG(loss) OVER (PARTITION BY symbol ORDER BY timestamp ROWS BETWEEN 11 PRECEDING AND CURRENT ROW) AS avg_lossFROM gains_losses)SELECTtimestamp,--Bid,CASEWHEN avg_loss = 0 THEN 100ELSE 100 - (100 / (1 + (avg_gain / NULLIF(avg_loss, 0))))END AS RSI_12hFROM avg_gains_lossesORDER BY timestamp;
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 market_data_ohlc_15m -- 20 periods of 15 minutes = SMA 6hWHERE date_trunc('day', now()) < timestampAND symbol IN 'EURUSD'), bollinger AS (SELECTtimestamp,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 )select * from bollinger;
Spread and Volume per second - EURUSD
Displays a rolling table of the most recent seconds for the selected currency pair, summarizing the current average spread (difference between best ask and best bid) along with the aggregated bid and ask volumes. Use this to monitor how liquidity and price tightness evolve in real time, and spot sudden widening or bursts in traded volume.
SELECTtimestamp AS Time,avg(asks [ 1, 1 ] - bids [ 1, 1 ]) AS Spread,sum(bids [ 1, 1 ] * bids [ 2, 1 ]) AS Bid_Volume,sum(asks [ 1, 1 ] * asks [ 2, 1 ]) AS Ask_VolumeFROM market_dataWHERE dateadd('m', -1, now()) < timestamp AND symbol = 'EURUSD'SAMPLE BY 1sORDER BY timestamp DESCLIMIT 9;
Bid vs Ask Volume (30s) - BBO (1s) - (EURUSD)
Time series chart comparing the aggregated bid and ask volumes over 30-second intervals, alongside the best bid and offer (BBO) price at 1-second granularity. Useful for monitoring shifts in market pressure, liquidity imbalances, and rapid changes in top-of-book pricing.
SELECTtimestamp time,symbol,sum(bids [ 1, 1 ] * bids [ 2, 1 ]) AS bid,-1 * sum(asks [ 1, 1 ] * asks [ 2, 1 ]) AS askFROMmarket_dataWHERE dateadd('m', -30, now()) < timestamp AND symbol IN 'EURUSD'SAMPLE BY 30s;
SELECT timestamp as Time, Symbol, Bid, Ask, (bid+ask)/2 as MidFROM "bbo_1s"WHERE dateadd('m', -30, now()) < timestampand symbol IN 'EURUSD';
Top-of-book Levels vs Core Price - EURUSD
Compares the best bid in the order book (from L2 market data) using an ASOF JOIN against the corresponding “core” quote price from upstream sources (e.g., ECNs). Then it finds at which level we could trade the core price bid volume. If no matching level is found, Level and Price will be empty. This table helps detect price alignment issues, latency, or anomalies between your live order book and reference prices provided by liquidity venues.
WITH p AS (SELECTtimestamp,bid_price,bid_volume,symbol,ecnFROM core_priceWHERE dateadd('m', -1, now()) < timestamp AND symbol = 'EURUSD'LIMIT -9), levels AS (SELECTmarket_data.timestamp AS md_timestamp,insertion_point(bids [ 2 ], bid_volume) AS level,bids [ 1 ] [ insertion_point(bids [ 2 ], bid_volume) ] AS price,bids [ 2 ] [ insertion_point(bids [ 2 ], bid_volume) ] AS volume,p.timestamp,p.bid_price,p.bid_volume AS bid_volume,p.ecnFROM p ASOF JOIN market_data ON symbol)SELECTmd_timestamp AS MarketData_Time,CASE WHEN price IS null THEN null ELSE level end AS Level,Price,Volume,timestamp AS CorePrice_Time,bid_price AS Bid_Price,bid_volume1 AS Bid_Volume,ecn AS ECNFROM levels;
Build your own on QuestDB
High performance ingest & slick visualizations.
Perfect for financial data and real-time analytics.