Market Data
Market Data
Real-time and historical market data, price feeds, technical indicators, and alerts.
15 tables in this group.
market_data
| Column | Type | Nullable | Default |
|---|---|---|---|
id | int8 | No | nextval('market_data_id_seq'::regclass) |
symbol | text | No | |
timestamp | timestamptz | No | |
data | jsonb | Yes | |
created_at | timestamptz | Yes | now() |
RLS Policies:
market_data_read_policy— SELECT for {authenticated}market_data_service_policy— ALL for {service_role}
Indexes:
market_data_pkey
market_data_ticks
| Column | Type | Nullable | Default |
|---|---|---|---|
time | timestamptz | No | |
exchange | varchar(50) | No | |
symbol | varchar(20) | No | |
price | numeric | No | |
bid | numeric | Yes | |
ask | numeric | Yes | |
bid_size | numeric | Yes | |
ask_size | numeric | Yes | |
volume | numeric | Yes | |
sequence_number | int8 | Yes |
RLS Policies:
rls_market_data_ticks_insert— INSERT for {service_role}rls_market_data_ticks_select— SELECT for {authenticated}
Indexes:
market_data_ticks_pkey
market_data_ohlcv
| Column | Type | Nullable | Default |
|---|---|---|---|
time | timestamptz | No | |
exchange | varchar(50) | No | |
symbol | varchar(20) | No | |
interval | varchar(10) | No | |
open | numeric | No | |
high | numeric | No | |
low | numeric | No | |
close | numeric | No | |
volume | numeric | No | |
quote_volume | numeric | Yes | |
trade_count | int4 | Yes | |
vwap | numeric | Yes |
RLS Policies:
rls_market_data_ohlcv_insert— INSERT for {service_role}rls_market_data_ohlcv_select— SELECT for {authenticated}
Indexes:
market_data_ohlcv_pkey
market_data_orderbook
| Column | Type | Nullable | Default |
|---|---|---|---|
time | timestamptz | No | |
exchange | varchar(50) | No | |
symbol | varchar(20) | No | |
bids | jsonb | No | '[]'::jsonb |
asks | jsonb | No | '[]'::jsonb |
snapshot_id | int8 | Yes | |
sequence_number | int8 | Yes | |
best_bid | numeric | Yes | |
best_ask | numeric | Yes | |
spread | numeric | Yes | |
spread_percent | numeric | Yes |
RLS Policies:
rls_market_data_orderbook_insert— INSERT for {service_role}rls_market_data_orderbook_select— SELECT for {authenticated}
Indexes:
market_data_orderbook_pkey
market_data_trades
| Column | Type | Nullable | Default |
|---|---|---|---|
time | timestamptz | No | |
exchange | varchar(50) | No | |
symbol | varchar(20) | No | |
trade_id | varchar(100) | No | |
price | numeric | No | |
amount | numeric | No | |
side | varchar(10) | No | |
maker | bool | Yes | |
sequence_number | int8 | Yes |
RLS Policies:
rls_market_data_trades_insert— INSERT for {service_role}rls_market_data_trades_select— SELECT for {authenticated}
Indexes:
market_data_trades_pkey
candlestick_data
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
symbol | varchar(20) | No | |
exchange | varchar(50) | No | |
interval | varchar(10) | No | |
open_time | timestamp | No | |
close_time | timestamp | No | |
open_price | numeric | No | |
high_price | numeric | No | |
low_price | numeric | No | |
close_price | numeric | No | |
volume | numeric | No | |
quote_volume | numeric | Yes | |
number_of_trades | int4 | Yes | |
taker_buy_volume | numeric | Yes | |
taker_buy_quote_volume | numeric | Yes | |
sma_20 | numeric | Yes | |
ema_20 | numeric | Yes | |
rsi_14 | numeric | Yes | |
macd | numeric | Yes | |
macd_signal | numeric | Yes | |
macd_histogram | numeric | Yes | |
created_at | timestamp | Yes | now() |
RLS Policies:
candlestick_data_public_select— SELECT for {public}candlestick_data_service_delete— DELETE for {public}candlestick_data_service_insert— INSERT for {public}candlestick_data_service_update— UPDATE for {public}
Indexes:
candlestick_data_pkeycandlestick_data_unique_candleidx_symbol_exchange_interval_timeix_candlestick_data_open_timeix_candlestick_data_symbol
price_data
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | gen_random_uuid() |
asset_symbol | varchar(20) | No | |
exchange | varchar(50) | No | |
trading_pair | varchar(20) | No | |
price_usd | numeric | No | |
bid_price_usd | numeric | Yes | |
ask_price_usd | numeric | Yes | |
spread_percent | numeric | Yes | |
volume_24h_usd | numeric | Yes | |
volume_24h_base | numeric | Yes | |
orderbook_depth_usd | numeric | Yes | |
price_change_24h_percent | numeric | Yes | |
price_change_7d_percent | numeric | Yes | |
high_24h_usd | numeric | Yes | |
low_24h_usd | numeric | Yes | |
data_quality_score | numeric | Yes | |
is_stale | bool | Yes | |
last_trade_time | timestamp | Yes | |
timestamp | timestamp | No | |
created_at | timestamp | Yes | now() |
price_metadata | json | Yes |
RLS Policies:
price_data_public_select— SELECT for {public}price_data_service_delete— DELETE for {public}price_data_service_insert— INSERT for {public}price_data_service_update— UPDATE for {public}
Indexes:
ix_price_data_asset_symbolix_price_data_timestampprice_data_pkey
price_alerts
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | |
user_id | uuid | No | |
symbol | varchar(20) | No | |
condition | varchar(20) | No | |
target_price | numeric | No | |
current_price | numeric | Yes | |
is_active | varchar(10) | Yes | |
triggered_at | timestamp | Yes | |
notification_methods | json | Yes | |
expires_at | timestamp | Yes | |
created_at | timestamp | Yes | |
updated_at | timestamp | Yes | |
message | varchar(500) | Yes | |
market_metadata | json | Yes |
RLS Policies:
price_alerts_delete_own— DELETE for {public}price_alerts_insert_own— INSERT for {public}price_alerts_select_own— SELECT for {public}price_alerts_update_own— UPDATE for {public}
Indexes:
ix_price_alerts_symbolix_price_alerts_user_idprice_alerts_pkey
market_trends
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | |
symbol | varchar(20) | No | |
timeframe | varchar(10) | No | |
trend_direction | varchar(20) | No | |
trend_strength | numeric | Yes | |
trend_confidence | numeric | Yes | |
support_level | numeric | Yes | |
resistance_level | numeric | Yes | |
current_price | numeric | No | |
rsi | numeric | Yes | |
macd | numeric | Yes | |
macd_signal | numeric | Yes | |
bollinger_upper | numeric | Yes | |
bollinger_lower | numeric | Yes | |
volume_sma | numeric | Yes | |
sma_20 | numeric | Yes | |
sma_50 | numeric | Yes | |
sma_200 | numeric | Yes | |
ema_12 | numeric | Yes | |
ema_26 | numeric | Yes | |
volatility_24h | numeric | Yes | |
volatility_7d | numeric | Yes | |
volatility_30d | numeric | Yes | |
analysis_date | timestamp | No | |
data_start_date | timestamp | No | |
data_end_date | timestamp | No | |
sample_size | int4 | Yes | |
created_at | timestamp | No | |
updated_at | timestamp | Yes |
RLS Policies:
market_trends_public_select— SELECT for {public}market_trends_service_delete— DELETE for {public}market_trends_service_insert— INSERT for {public}market_trends_service_update— UPDATE for {public}
Indexes:
ix_market_trends_symbolmarket_trends_pkey
technical_indicators
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | |
symbol | varchar(20) | No | |
timeframe | varchar(10) | No | |
timestamp | timestamp | No | |
open_price | numeric | No | |
high_price | numeric | No | |
low_price | numeric | No | |
close_price | numeric | No | |
volume | numeric | Yes | |
rsi_14 | numeric | Yes | |
stochastic_k | numeric | Yes | |
stochastic_d | numeric | Yes | |
williams_r | numeric | Yes | |
momentum_10 | numeric | Yes | |
sma_20 | numeric | Yes | |
sma_50 | numeric | Yes | |
sma_200 | numeric | Yes | |
ema_12 | numeric | Yes | |
ema_26 | numeric | Yes | |
ema_50 | numeric | Yes | |
macd_line | numeric | Yes | |
macd_signal | numeric | Yes | |
macd_histogram | numeric | Yes | |
bb_upper | numeric | Yes | |
bb_middle | numeric | Yes | |
bb_lower | numeric | Yes | |
bb_width | numeric | Yes | |
bb_position | numeric | Yes | |
volume_sma_20 | numeric | Yes | |
volume_ratio | numeric | Yes | |
obv | numeric | Yes | |
atr_14 | numeric | Yes | |
volatility | numeric | Yes | |
pivot_point | numeric | Yes | |
support_1 | numeric | Yes | |
support_2 | numeric | Yes | |
resistance_1 | numeric | Yes | |
resistance_2 | numeric | Yes | |
created_at | timestamp | No |
RLS Policies:
technical_indicators_public_select— SELECT for {public}technical_indicators_service_delete— DELETE for {public}technical_indicators_service_insert— INSERT for {public}technical_indicators_service_update— UPDATE for {public}
Indexes:
ix_technical_indicators_symbolix_technical_indicators_timestamptechnical_indicators_pkey
market_correlations
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | |
symbol_1 | varchar(20) | No | |
symbol_2 | varchar(20) | No | |
timeframe | varchar(10) | No | |
pearson_correlation | numeric | No | |
spearman_correlation | numeric | Yes | |
kendall_correlation | numeric | Yes | |
rolling_correlation_30d | numeric | Yes | |
rolling_correlation_90d | numeric | Yes | |
p_value | numeric | Yes | |
confidence_interval_lower | numeric | Yes | |
confidence_interval_upper | numeric | Yes | |
sample_size | int4 | No | |
start_date | date | No | |
end_date | date | No | |
analysis_date | date | No | |
correlation_strength | varchar(20) | Yes | |
correlation_direction | varchar(20) | Yes | |
created_at | timestamp | No | |
updated_at | timestamp | Yes |
RLS Policies:
market_correlations_public_select— SELECT for {public}market_correlations_service_delete— DELETE for {public}market_correlations_service_insert— INSERT for {public}market_correlations_service_update— UPDATE for {public}
Indexes:
ix_market_correlations_symbol_1ix_market_correlations_symbol_2market_correlations_pkey
market_sentiment_scores
| Column | Type | Nullable | Default |
|---|---|---|---|
sentiment_id | uuid | No | |
symbol | varchar(20) | No | |
timestamp | timestamp | No | |
sentiment_score | numeric | No | |
confidence_level | numeric | No | |
sources | json | No | |
analysis_metadata | json | No | |
created_at | timestamp | No | |
updated_at | timestamp | Yes | |
asset_symbol | varchar(20) | No | |
sources_aggregated | json | No | |
market_fear_greed_index | int4 | No | |
social_volume_change_24h | numeric | No | |
news_sentiment_change_24h | numeric | No | |
whale_activity_score | numeric | No | |
expires_at | timestamp | Yes |
RLS Policies:
market_sentiment_scores_public_select— SELECT for {public}market_sentiment_scores_service_delete— DELETE for {public}market_sentiment_scores_service_insert— INSERT for {public}market_sentiment_scores_service_update— UPDATE for {public}
Indexes:
ix_market_sentiment_scores_asset_symbolix_market_sentiment_scores_symbolix_market_sentiment_scores_timestampmarket_sentiment_scores_pkey
alerts
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | |
alert_id | varchar(100) | No | |
user_id | uuid | No | |
name | varchar(200) | No | |
description | text | Yes | |
asset_symbol | varchar(20) | No | |
alert_type | varchar(30) | No | |
trigger_condition | jsonb | No | |
severity | varchar(20) | Yes | |
status | varchar(20) | Yes | |
frequency | varchar(20) | Yes | |
notification_channels | jsonb | Yes | |
trigger_count | int4 | Yes | |
last_triggered_at | timestamptz | Yes | |
next_check_at | timestamptz | Yes | |
expires_at | timestamptz | Yes | |
auto_disable_after_trigger | bool | Yes | |
max_triggers | int4 | Yes | |
alert_metadata | jsonb | Yes | |
created_at | timestamptz | No | |
updated_at | timestamptz | Yes |
RLS Policies:
alerts_delete_own— DELETE for {public}alerts_insert_own— INSERT for {public}alerts_select_own— SELECT for {public}alerts_update_own— UPDATE for {public}
Indexes:
alerts_pkeyidx_alerts_active_queriesidx_alerts_alert_ididx_alerts_asset_symbolidx_alerts_auto_disableidx_alerts_created_atidx_alerts_expired_cleanupidx_alerts_last_triggeredidx_alerts_next_checkidx_alerts_notification_channelsidx_alerts_symbol_typeidx_alerts_trigger_conditionidx_alerts_user_severityidx_alerts_user_statusidx_alerts_user_typeix_alerts_alert_idix_alerts_asset_symbolix_alerts_user_id
alert_history
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | |
history_id | varchar(100) | No | |
alert_id | uuid | No | |
user_id | uuid | No | |
event_type | varchar(30) | No | |
trigger_value | numeric | Yes | |
threshold_value | numeric | Yes | |
asset_price | numeric | Yes | |
sentiment_score | numeric | Yes | |
volume_24h | numeric | Yes | |
market_context | jsonb | Yes | |
message | text | Yes | |
history_metadata | jsonb | Yes | |
created_at | timestamp | No |
RLS Policies:
alert_history_delete_own— DELETE for {public}alert_history_insert_own— INSERT for {public}alert_history_select_own— SELECT for {public}alert_history_update_own— UPDATE for {public}
Indexes:
alert_history_pkeyidx_alert_history_alert_eventidx_alert_history_alert_ididx_alert_history_event_typeidx_alert_history_market_contextidx_alert_history_metadataidx_alert_history_recent_triggersidx_alert_history_trigger_analyticsidx_alert_history_user_idix_alert_history_alert_idix_alert_history_history_idix_alert_history_user_id
alert_notifications
| Column | Type | Nullable | Default |
|---|---|---|---|
id | uuid | No | |
notification_id | varchar(100) | No | |
alert_id | uuid | No | |
user_id | uuid | No | |
channel | varchar(20) | No | |
recipient | varchar(255) | No | |
subject | varchar(500) | Yes | |
message | text | No | |
status | varchar(20) | Yes | |
sent_at | timestamp | Yes | |
delivered_at | timestamp | Yes | |
error_message | text | Yes | |
retry_count | int4 | Yes | |
trigger_value | numeric | Yes | |
market_context | jsonb | Yes | |
created_at | timestamp | No | |
updated_at | timestamp | Yes |
RLS Policies:
alert_notifications_delete_own— DELETE for {public}alert_notifications_insert_own— INSERT for {public}alert_notifications_select_own— SELECT for {public}alert_notifications_update_own— UPDATE for {public}
Indexes:
alert_notifications_pkeyidx_alert_notifications_alert_ididx_alert_notifications_channel_recentidx_alert_notifications_delivery_timeidx_alert_notifications_market_contextidx_alert_notifications_retryidx_alert_notifications_statusidx_alert_notifications_user_idix_alert_notifications_alert_idix_alert_notifications_notification_idix_alert_notifications_user_id