Capital Markets Recipes
This section contains SQL recipes for financial market analysis. Each recipe uses the demo dataset available in the QuestDB web console.
Price-Based Indicators
Foundation recipes for price analysis and trend identification.
| Recipe | Description |
|---|---|
| OHLC Aggregation | Aggregate tick data into candlestick bars |
| VWAP | Volume-Weighted Average Price |
| Bollinger Bands | Price channels based on standard deviation |
| Bollinger BandWidth | Measure band expansion and contraction |
Momentum Indicators
Measure the speed and strength of price movements.
| Recipe | Description |
|---|---|
| RSI | Relative Strength Index for overbought/oversold conditions |
| MACD | Moving Average Convergence Divergence |
| Stochastic Oscillator | Compare closing price to price range |
| Rate of Change | Percentage price change over N periods |
Volatility Indicators
Quantify market uncertainty and price variability.
| Recipe | Description |
|---|---|
| ATR | Average True Range |
| Rolling Std Dev | Moving standard deviation of returns |
| Donchian Channels | High/low price channels |
| Keltner Channels | EMA-based volatility channels |
| Realized Volatility | Historical volatility from returns |
Volume & Order Flow
Analyze trading activity and order flow dynamics.
| Recipe | Description |
|---|---|
| OBV | On-Balance Volume |
| Volume Profile | Volume distribution by price level |
| Volume Spike | Detect abnormal volume |
| Aggressor Imbalance | Buy vs sell pressure |
Risk Metrics
Portfolio risk measurement and drawdown analysis.
| Recipe | Description |
|---|---|
| Maximum Drawdown | Peak-to-trough decline |
Market Microstructure
Analyze market quality and trading costs.
| Recipe | Description |
|---|---|
| Bid-Ask Spread | Spread metrics and analysis |
| Liquidity Comparison | Compare liquidity across instruments |
Market Breadth
Measure overall market participation and sentiment.
| Recipe | Description |
|---|---|
| TICK & TRIN | Market breadth indicators |
Math Utilities
General-purpose financial calculations.
| Recipe | Description |
|---|---|
| Compound Interest | Interest and growth calculations |
| Cumulative Product | Running product for returns |