Database Schema Documentation
This page documents the SPMC database schema, including all tables, columns, relationships, and constraints.
Entity Relationship Diagram
This diagram shows the relationships between database tables. Click and drag to pan, use mouse wheel to zoom.
Database Tables
unified.archived_markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
UUID primary key |
platform
|
TEXT |
No | — | Trading platform: kalshi, polymarket, or limitless |
platform_market_id
|
TEXT |
No | — | Platform-specific unique identifier |
title
|
TEXT |
No | — | Market question/title as displayed |
description
|
TEXT |
Yes | — | Detailed market description |
category
|
TEXT |
Yes | — | Market category |
subcategory
|
TEXT |
Yes | — | Market subcategory |
status
|
TEXT |
No | — | Market status: open, closed, resolved |
is_active
|
BOOLEAN |
Yes |
true
|
Whether market is currently tradeable |
created_at
|
TIMESTAMP |
Yes |
now()
|
When we first saw this market |
updated_at
|
TIMESTAMP |
Yes |
now()
|
Last update timestamp |
last_checked
|
TIMESTAMP |
Yes |
now()
|
Last API check timestamp |
market_open_time
|
TIMESTAMP |
Yes | — | |
market_close_time
|
TIMESTAMP |
Yes | — | When market closes for trading |
resolution_time
|
TIMESTAMP |
Yes | — | When market resolves |
last_trade_time
|
TIMESTAMP |
Yes | — | |
volume_24h
|
NUMERIC(20, 8) |
Yes |
0
|
Trading volume in last 24 hours |
total_volume
|
NUMERIC(20, 8) |
Yes |
0
|
Total historical volume |
contract_volume
|
NUMERIC(20, 8) |
Yes |
0
|
|
liquidity
|
NUMERIC(20, 8) |
Yes |
0
|
Available liquidity |
open_interest
|
NUMERIC(20, 8) |
Yes |
0
|
Open interest value |
total_trades
|
INTEGER |
Yes |
0
|
|
unique_traders
|
INTEGER |
Yes |
0
|
|
best_bid_price
|
NUMERIC(20, 8) |
Yes | — | |
best_bid_size
|
NUMERIC(20, 8) |
Yes | — | |
best_ask_price
|
NUMERIC(20, 8) |
Yes | — | |
best_ask_size
|
NUMERIC(20, 8) |
Yes | — | |
last_trade_price
|
NUMERIC(20, 8) |
Yes | — | Last traded price |
midpoint_price
|
NUMERIC(20, 8) |
Yes | — | Midpoint between bid and ask |
spread
|
NUMERIC(20, 8) |
Yes | — | Bid-ask spread |
adjusted_midpoint
|
NUMERIC(20, 8) |
Yes | — | |
yes_token_id
|
TEXT |
Yes | — | |
yes_best_buy_price
|
NUMERIC(20, 8) |
Yes | — | Best bid for YES token |
yes_best_buy_size
|
NUMERIC(20, 8) |
Yes | — | |
yes_best_sell_price
|
NUMERIC(20, 8) |
Yes | — | Best ask for YES token |
yes_best_sell_size
|
NUMERIC(20, 8) |
Yes | — | |
yes_midpoint
|
NUMERIC(20, 8) |
Yes | — | |
yes_spread
|
NUMERIC(20, 8) |
Yes | — | |
no_token_id
|
TEXT |
Yes | — | |
no_best_buy_price
|
NUMERIC(20, 8) |
Yes | — | Best bid for NO token |
no_best_buy_size
|
NUMERIC(20, 8) |
Yes | — | |
no_best_sell_price
|
NUMERIC(20, 8) |
Yes | — | Best ask for NO token |
no_best_sell_size
|
NUMERIC(20, 8) |
Yes | — | |
no_midpoint
|
NUMERIC(20, 8) |
Yes | — | |
no_spread
|
NUMERIC(20, 8) |
Yes | — | |
event_ticker
|
TEXT |
Yes | — | |
market_slug
|
TEXT |
Yes | — | |
limitless_id
|
INTEGER |
Yes | — | |
max_spread
|
NUMERIC(20, 8) |
Yes | — | |
min_size
|
NUMERIC(20, 8) |
Yes | — | |
collateral_token_symbol
|
TEXT |
Yes | — | |
collateral_token_address
|
TEXT |
Yes | — | |
collateral_token_decimals
|
INTEGER |
Yes | — | |
categories
|
ARRAY |
Yes | — | |
group_id
|
UUID |
Yes | — | |
group_similarity
|
NUMERIC(20, 8) |
Yes | — | |
platform_metadata
|
JSONB |
Yes | — | |
last_realtime_update
|
TIMESTAMP |
Yes | — | Timestamp of last real-time WebSocket update |
last_api_update
|
TIMESTAMP |
Yes | — | Timestamp of last API polling update |
data_confidence_score
|
NUMERIC(3, 2) |
Yes | — | |
data_freshness_score
|
NUMERIC(3, 2) |
Yes | — | |
data_completeness_score
|
NUMERIC(3, 2) |
Yes | — | |
platform_reliability_score
|
NUMERIC(3, 2) |
Yes | — | |
overall_quality_score
|
NUMERIC(3, 2) |
Yes | — | |
last_quality_check
|
TIMESTAMP |
Yes |
now()
|
|
quality_check_count
|
INTEGER |
Yes |
0
|
|
normalized_title
|
TEXT |
Yes | — | |
similarity_hash
|
TEXT |
Yes | — | |
cross_platform_group_id
|
UUID |
Yes | — | |
fee_percentage
|
NUMERIC(5, 4) |
Yes | — | |
fee_function_type
|
VARCHAR(50) |
Yes | — | |
yes_price
|
NUMERIC(10, 6) |
Yes | — | |
no_price
|
NUMERIC(10, 6) |
Yes | — | |
price_confidence
|
NUMERIC(3, 2) |
Yes | — | |
derived_event_id
|
TEXT |
Yes | — | |
title_embedding
|
NULL |
Yes | — | |
description_embedding
|
NULL |
Yes | — |
Indexes
| Name | Columns | Type |
|---|---|---|
archived_markets_category_idx |
category |
Index |
archived_markets_coalesce_idx |
None |
Index |
archived_markets_cross_platform_group_id_idx |
cross_platform_group_id |
Index |
archived_markets_cross_platform_group_id_is_active_market_c_idx |
cross_platform_group_id, is_active, market_close_time |
Index |
archived_markets_cross_platform_group_id_yes_price_no_price_idx |
cross_platform_group_id, yes_price, no_price |
Index |
archived_markets_data_confidence_score_idx |
data_confidence_score |
Index |
archived_markets_event_ticker_idx |
event_ticker |
Index |
archived_markets_group_id_idx |
group_id |
Index |
archived_markets_group_id_is_active_idx |
group_id, is_active |
Index |
archived_markets_is_active_idx |
is_active |
Index |
archived_markets_is_active_platform_id_idx |
is_active, platform, id |
Index |
archived_markets_last_api_update_idx |
last_api_update |
Index |
archived_markets_last_checked_idx |
last_checked |
Index |
archived_markets_last_quality_check_idx |
last_quality_check |
Index |
archived_markets_last_realtime_update_idx |
last_realtime_update |
Index |
archived_markets_market_close_time_idx |
market_close_time |
Index |
archived_markets_market_close_time_idx1 |
market_close_time |
Index |
archived_markets_market_slug_idx |
market_slug |
Index |
archived_markets_no_token_id_idx |
no_token_id |
Index |
archived_markets_normalized_title_idx |
normalized_title |
Index |
archived_markets_overall_quality_score_idx |
overall_quality_score |
Index |
archived_markets_overall_quality_score_updated_at_idx |
overall_quality_score, updated_at |
Index |
archived_markets_platform_fee_percentage_idx |
platform, fee_percentage |
Index |
archived_markets_platform_idx |
platform |
Index |
archived_markets_platform_idx1 |
platform |
Index |
archived_markets_platform_is_active_idx |
platform, is_active |
Index |
archived_markets_platform_is_active_status_idx |
platform, is_active, status |
Index |
archived_markets_platform_last_realtime_update_idx |
platform, last_realtime_update |
Index |
archived_markets_platform_last_realtime_update_last_api_up_idx1 |
platform, last_realtime_update, last_api_update |
Index |
archived_markets_platform_last_realtime_update_last_api_upd_idx |
platform, last_realtime_update, last_api_update |
Index |
archived_markets_platform_market_id_idx |
platform_market_id |
Index |
archived_markets_platform_metadata_idx |
platform_metadata |
Index |
archived_markets_platform_overall_quality_score_is_active_idx |
platform, overall_quality_score, is_active |
Index |
archived_markets_platform_platform_market_id_key |
platform, platform_market_id |
Unique |
archived_markets_similarity_hash_idx |
similarity_hash |
Index |
archived_markets_status_idx |
status |
Index |
archived_markets_to_tsvector_idx |
None |
Index |
archived_markets_to_tsvector_idx1 |
None |
Index |
archived_markets_to_tsvector_idx2 |
None |
Index |
archived_markets_total_volume_idx |
total_volume |
Index |
archived_markets_updated_at_idx |
updated_at |
Index |
archived_markets_yes_token_id_idx |
yes_token_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
archived_markets_pkey |
primary_key |
id |
— |
archived_markets_platform_platform_market_id_key |
unique |
platform, platform_market_id |
— |
markets_adjusted_midpoint_check |
check | — | |
markets_best_ask_price_check |
check | — | |
markets_best_ask_size_check |
check | — | |
markets_best_bid_price_check |
check | — | |
markets_best_bid_size_check |
check | — | |
markets_check |
check | — | |
markets_check1 |
check | — | |
markets_check2 |
check | — | |
markets_contract_volume_check |
check | — | |
markets_data_completeness_score_check |
check | — | |
markets_data_confidence_score_check |
check | — | |
markets_data_freshness_score_check |
check | — | |
markets_group_similarity_check |
check | — | |
markets_last_trade_price_check |
check | — | |
markets_liquidity_check |
check | — | |
markets_max_spread_check |
check | — | |
markets_midpoint_price_check |
check | — | |
markets_min_size_check |
check | — | |
markets_no_best_buy_price_check |
check | — | |
markets_no_best_buy_size_check |
check | — | |
markets_no_best_sell_price_check |
check | — | |
markets_no_best_sell_size_check |
check | — | |
markets_no_midpoint_check |
check | — | |
markets_no_spread_check |
check | — | |
markets_open_interest_check |
check | — | |
markets_overall_quality_score_check |
check | — | |
markets_platform_check |
check | — | |
markets_platform_reliability_score_check |
check | — | |
markets_quality_check_count_check |
check | — | |
markets_spread_check |
check | — | |
markets_total_trades_check |
check | — | |
markets_total_volume_check |
check | — | |
markets_unique_traders_check |
check | — | |
markets_volume_24h_check |
check | — | |
markets_yes_best_buy_price_check |
check | — | |
markets_yes_best_buy_size_check |
check | — | |
markets_yes_best_sell_price_check |
check | — | |
markets_yes_best_sell_size_check |
check | — | |
markets_yes_midpoint_check |
check | — | |
markets_yes_spread_check |
check | — |
unified.batch_operations
Tracking for bulk data operations
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
platform
|
TEXT |
No | — | |
operation_type
|
TEXT |
No | — | |
started_at
|
TIMESTAMP |
Yes |
now()
|
|
completed_at
|
TIMESTAMP |
Yes | — | |
duration_seconds
|
INTEGER |
Yes | — | Automatically calculated duration in seconds |
total_items
|
INTEGER |
Yes |
0
|
|
successful_items
|
INTEGER |
Yes |
0
|
|
failed_items
|
INTEGER |
Yes |
0
|
|
retried_items
|
INTEGER |
Yes |
0
|
|
success_rate
|
NUMERIC(5, 4) |
Yes | — | Automatically calculated success rate (0-1) |
batch_metadata
|
JSONB |
Yes | — | |
performance_stats
|
JSONB |
Yes | — | |
error_summary
|
JSONB |
Yes | — | |
parent_batch_id
FK
|
UUID |
Yes | — |
References: unified.batch_operations(id)
|
status
|
TEXT |
Yes |
'running'::text
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_batch_operations_duration |
duration_seconds |
Index |
idx_batch_operations_operation_type |
operation_type |
Index |
idx_batch_operations_parent_batch |
parent_batch_id |
Index |
idx_batch_operations_platform |
platform |
Index |
idx_batch_operations_platform_status |
platform, status |
Index |
idx_batch_operations_started_at |
started_at |
Index |
idx_batch_operations_status |
status |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
batch_operations_pkey |
primary_key |
id |
— |
batch_operations_parent_batch_id_fkey |
foreign_key |
parent_batch_id |
— |
batch_operations_check |
check | — | |
batch_operations_check1 |
check | — | |
batch_operations_check2 |
check | — | |
batch_operations_failed_items_check |
check | — | |
batch_operations_operation_type_check |
check | — | |
batch_operations_platform_check |
check | — | |
batch_operations_retried_items_check |
check | — | |
batch_operations_status_check |
check | — | |
batch_operations_successful_items_check |
check | — | |
batch_operations_total_items_check |
check | — |
Relationships
-
many-to-one to
batch_operationsvia -
many-to-one to
batch_operationsvia -
many-to-one from
raw_eventsvia
unified.builder_orders
Records order metadata from builder signing server for analytics and tracking
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
Unique identifier for the order record |
token_id
|
TEXT |
No | — | Polymarket token ID for the market outcome |
side
|
TEXT |
No | — | Order side: BUY or SELL |
order_volume
|
NUMERIC(20, 8) |
No | — | Order volume in USDC (up to 8 decimal places) |
price
|
NUMERIC(20, 8) |
Yes | — | Limit order price between 0.01 and 0.99 (optional, null for market orders) |
group_id
FK
|
UUID |
Yes | — |
Reference to market group (optional, preserved even if group is deleted)
References: unified.market_groups(id)
|
writer_id
FK
|
UUID |
Yes | — |
Reference to author/writer (optional, preserved even if author is deleted)
References: pmf.authors(id)
|
request_path
|
TEXT |
No | — | HTTP request path from the original order request |
request_method
|
TEXT |
No | — | HTTP request method from the original order request (typically POST) |
created_at
|
TIMESTAMP |
No |
now()
|
Timestamp when the order was signed and recorded |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_builder_orders_created_at |
created_at |
Index |
idx_builder_orders_group_created |
group_id, created_at |
Index |
idx_builder_orders_group_id |
group_id |
Index |
idx_builder_orders_token_id |
token_id |
Index |
idx_builder_orders_writer_id |
writer_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
builder_orders_pkey |
primary_key |
id |
— |
builder_orders_group_id_fkey |
foreign_key |
group_id |
— |
builder_orders_writer_id_fkey |
foreign_key |
writer_id |
— |
builder_orders_order_volume_check |
check | — | |
builder_orders_price_check |
check | — | |
builder_orders_request_path_check |
check | — | |
builder_orders_side_check |
check | — | |
builder_orders_token_id_check |
check | — |
Relationships
-
many-to-one to
market_groupsvia -
many-to-one to
authorsvia
unified.dead_letter_queue
Failed events for retry and debugging
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
message_type
|
TEXT |
No | — | Type of message (market_update, websocket_event, api_call) |
payload
|
JSONB |
No | — | Original message payload as JSON |
platform
|
TEXT |
No | — | Platform that generated the message |
market_id
|
TEXT |
Yes | — | Market ID if applicable |
original_timestamp
|
TIMESTAMP |
No | — | |
failure_reason
|
TEXT |
No | — | Reason for message failure |
retry_count
|
INTEGER |
No |
0
|
Number of retry attempts made |
max_retries
|
INTEGER |
No |
3
|
Maximum retry attempts allowed |
status
|
TEXT |
No |
'pending'::text
|
Current message status |
created_at
|
TIMESTAMP |
No |
now()
|
|
updated_at
|
TIMESTAMP |
No |
now()
|
|
next_retry_at
|
TIMESTAMP |
Yes | — | When to retry the message next |
resolved_at
|
TIMESTAMP |
Yes | — | When the message was successfully resolved |
metadata
|
JSONB |
Yes |
'{}'::jsonb
|
Additional metadata as JSON |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_dead_letter_queue_created_at |
created_at |
Index |
idx_dead_letter_queue_market_id |
market_id |
Index |
idx_dead_letter_queue_message_type |
message_type |
Index |
idx_dead_letter_queue_next_retry |
next_retry_at |
Index |
idx_dead_letter_queue_platform |
platform |
Index |
idx_dead_letter_queue_status |
status |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
dead_letter_queue_pkey |
primary_key |
id |
— |
chk_dead_letter_queue_platform |
check | — | |
chk_dead_letter_queue_retry_count |
check | — | |
chk_dead_letter_queue_status |
check | — |
unified.embedding_queue
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
entity_type
|
TEXT |
No | — | |
entity_id
|
UUID |
No | — | |
text_content
|
TEXT |
No | — | |
embedding_type
|
TEXT |
No | — | |
status
|
TEXT |
Yes |
'pending'::text
|
|
created_at
|
TIMESTAMP |
Yes |
now()
|
|
processed_at
|
TIMESTAMP |
Yes | — | |
error_message
|
TEXT |
Yes | — | |
retry_count
|
INTEGER |
Yes |
0
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_embedding_queue_entity |
entity_type, entity_id |
Index |
idx_embedding_queue_status |
status |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
embedding_queue_pkey |
primary_key |
id |
— |
embedding_queue_embedding_type_check |
check | — | |
embedding_queue_entity_type_check |
check | — | |
embedding_queue_status_check |
check | — |
unified.event_series
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
event_id
PK
FK
|
UUID |
No | — |
References: unified.events(id)
|
series_id
PK
FK
|
UUID |
No | — |
References: unified.series(id)
|
position
|
INTEGER |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_event_series_event |
event_id |
Index |
idx_event_series_position |
series_id, position |
Index |
idx_event_series_series |
series_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
event_series_pkey |
primary_key |
event_id, series_id |
— |
event_series_event_id_fkey |
foreign_key |
event_id |
— |
event_series_series_id_fkey |
foreign_key |
series_id |
— |
unified.events
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
title
|
TEXT |
No | — | |
normalized_title
|
TEXT |
Yes | — | |
description
|
TEXT |
Yes | — | |
category
|
TEXT |
Yes | — | |
subcategory
|
TEXT |
Yes | — | |
start_date
|
TIMESTAMP |
Yes | — | |
end_date
|
TIMESTAMP |
Yes | — | |
resolution_date
|
TIMESTAMP |
Yes | — | |
status
|
TEXT |
No |
'active'::text
|
|
is_active
|
BOOLEAN |
Yes |
true
|
|
total_markets
|
INTEGER |
Yes |
0
|
|
active_markets
|
INTEGER |
Yes |
0
|
|
resolved_markets
|
INTEGER |
Yes |
0
|
|
total_volume
|
NUMERIC(20, 8) |
Yes |
0
|
|
platforms
|
ARRAY |
Yes |
'{}'::text[]
|
|
platform_count
|
INTEGER |
Yes |
0
|
|
kalshi_event_id
|
TEXT |
Yes | — | |
kalshi_event_ticker
|
TEXT |
Yes | — | |
polymarket_event_id
|
TEXT |
Yes | — | |
polymarket_event_slug
|
TEXT |
Yes | — | |
limitless_event_id
|
TEXT |
Yes | — | |
similarity_hash
|
TEXT |
Yes | — | |
title_embedding
|
NULL |
Yes | — | |
tags
|
ARRAY |
Yes | — | |
platform_metadata
|
JSONB |
Yes |
'{}'::jsonb
|
|
created_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
last_synced
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
events_unique_hash |
similarity_hash |
Unique |
events_unique_kalshi_id |
kalshi_event_id |
Unique |
events_unique_polymarket_id |
polymarket_event_id |
Unique |
idx_events_active |
is_active |
Index |
idx_events_category |
category, subcategory |
Index |
idx_events_dates |
start_date, end_date |
Index |
idx_events_embedding |
title_embedding |
Index |
idx_events_kalshi_id |
kalshi_event_id |
Index |
idx_events_normalized_title |
normalized_title |
Index |
idx_events_platforms |
platforms |
Index |
idx_events_polymarket_id |
polymarket_event_id |
Index |
idx_events_similarity_hash |
similarity_hash |
Index |
idx_events_status |
status |
Index |
idx_events_tags |
tags |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
events_pkey |
primary_key |
id |
— |
events_unique_hash |
unique |
similarity_hash |
— |
events_unique_kalshi_id |
unique |
kalshi_event_id |
— |
events_unique_polymarket_id |
unique |
polymarket_event_id |
— |
events_dates_check |
check | — | |
events_market_counts_check |
check | — | |
events_status_check |
check | — |
Relationships
-
one-to-one from
event_seriesvia
limitlessctfexchange.fee_charged
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
receiver
|
TEXT |
No | — | |
token_id
|
NUMERIC |
No | — | |
amount
|
NUMERIC |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
fee_charged_pkey |
primary_key |
id |
— |
unified.fund_prices_daily
Precomputed daily fund prices for fast time series queries and paper trading simulations
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
group_id
FK
|
UUID |
No | — |
Reference to the market group (fund) this price belongs to
References: unified.market_groups(id)
|
price_date
|
DATE |
No | — | Date for this price snapshot (date only, no time component) |
price
|
NUMERIC(10, 6) |
No | — | Weighted average price of all markets in the fund (0.0 to 1.0), accounting for position types |
market_count
|
INTEGER |
No | — | Total number of markets included in the computation |
polymarket_count
|
INTEGER |
No | — | Number of Polymarket markets included (subset of market_count) |
total_weight
|
NUMERIC(12, 4) |
No | — | Sum of all market weights used in the computation |
data_completeness
|
NUMERIC(5, 2) |
Yes | — | Percentage of markets that had price data available (0-100) |
avg_price_age_hours
|
INTEGER |
Yes | — | Average age in hours of the constituent market prices used |
computation_method
|
VARCHAR(50) |
No |
'batch'::character varying
|
How this price was computed: batch (scheduled job) or on_demand (API request) |
computed_at
|
TIMESTAMP |
No |
now()
|
Timestamp when this price was computed |
computation_duration_ms
|
INTEGER |
Yes | — | Time taken to compute this price in milliseconds |
metadata
|
JSONB |
No |
'{}'::jsonb
|
Additional context as JSON (e.g., markets skipped, errors encountered, data sources) |
created_at
|
TIMESTAMP |
No |
now()
|
Timestamp when this record was first created |
updated_at
|
TIMESTAMP |
No |
now()
|
Timestamp when this record was last updated |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_fund_prices_computed_at |
computed_at |
Index |
idx_fund_prices_date |
price_date |
Index |
idx_fund_prices_group_date |
group_id, price_date |
Index |
idx_fund_prices_method |
computation_method |
Index |
unique_group_date |
group_id, price_date |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
fund_prices_daily_pkey |
primary_key |
id |
— |
fund_prices_daily_group_id_fkey |
foreign_key |
group_id |
— |
unique_group_date |
unique |
group_id, price_date |
— |
fund_prices_daily_avg_price_age_hours_check |
check | — | |
fund_prices_daily_computation_duration_ms_check |
check | — | |
fund_prices_daily_data_completeness_check |
check | — | |
fund_prices_daily_market_count_check |
check | — | |
fund_prices_daily_polymarket_count_check |
check | — | |
fund_prices_daily_price_check |
check | — | |
fund_prices_daily_total_weight_check |
check | — | |
valid_polymarket_count |
check | — |
Relationships
-
one-to-one to
market_groupsvia
unified.group_market_relationships
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
group_id
FK
|
UUID |
No | — |
References: unified.market_groups(id)
|
market_id
|
UUID |
No | — | |
weight
|
NUMERIC(10, 4) |
Yes |
1.0
|
|
position_type
|
VARCHAR(20) |
Yes | — | |
metadata
|
JSONB |
Yes |
'{}'::jsonb
|
|
added_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_gmr_group_id |
group_id |
Index |
idx_gmr_group_market |
group_id, market_id |
Index |
idx_gmr_market_id |
market_id |
Index |
unique_group_market |
group_id, market_id |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
group_market_relationships_pkey |
primary_key |
id |
— |
group_market_relationships_group_id_fkey |
foreign_key |
group_id |
— |
unique_group_market |
unique |
group_id, market_id |
— |
group_market_relationships_position_type_check |
check | — | |
group_market_relationships_weight_check |
check | — | |
valid_weight |
check | — |
Relationships
-
one-to-one to
market_groupsvia
unified.group_membership_history
Audit log of all changes to group membership (add/remove markets, weight changes)
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
group_id
FK
|
UUID |
No | — |
References: unified.market_groups(id)
|
market_id
|
UUID |
No | — | Market UUID - no FK constraint to preserve history even if market is deleted |
action
|
VARCHAR(20) |
No | — | Type of change: added (new market), removed (deleted market), weight_changed (existing market weight updated) |
timestamp
|
TIMESTAMP |
No |
now()
|
When the change occurred (defaults to NOW but can be backdated for imports) |
weight
|
NUMERIC(10, 4) |
Yes | — | Weight after the change (NULL for removed markets) |
position_type
|
VARCHAR(20) |
Yes | — | |
changed_by
|
VARCHAR(100) |
Yes | — | |
metadata
|
JSONB |
No |
'{}'::jsonb
|
Additional context as JSON. For resolution events, includes: { "settlement_value": 100.50, -- Total value received (shares × price) "settlement_price": 1.0, -- Resolution price (0.0, 0.5, or 1.0) "resolution_outcome": "YES", -- YES, NO, or INVALID "resolution_time": "2024-12-09T15:00:00Z", "position_details": { "shares": 100.0, -- Number of shares held "entry_price": 0.75, -- Average entry price "exit_price": 1.0, -- Resolution price (adjusted for position_type) "position_type": "long", -- long or short "cost_basis": 75.0 -- Total cost (shares × entry_price) }, "profit_loss": 25.0, -- settlement_value - cost_basis "profit_loss_percent": 33.33, -- (profit_loss / cost_basis) × 100 "holding_period_days": 14, -- Days from first entry to resolution "platform_market_id": "0xabc123", -- Platform-specific ID "market_title": "Will MongoDB beat earnings?", "platform": "polymarket", -- polymarket or kalshi "source": "automatic_cleanup", -- Always automatic for resolutions "cleanup_job_id": "uuid", -- ID of cleanup job that processed this "processed_at": "2024-12-10T03:00:00Z" } |
created_at
|
TIMESTAMP |
No |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_gmh_action |
action |
Index |
idx_gmh_action_timestamp |
action, timestamp |
Index |
idx_gmh_group_timestamp |
group_id, timestamp |
Index |
idx_gmh_market_resolved |
market_id, timestamp |
Index |
idx_gmh_market_timestamp |
market_id, timestamp |
Index |
idx_gmh_resolved_actions |
group_id, timestamp |
Index |
idx_gmh_timestamp |
timestamp |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
group_membership_history_pkey |
primary_key |
id |
— |
group_membership_history_group_id_fkey |
foreign_key |
group_id |
— |
group_membership_history_action_check |
check | — | |
group_membership_history_position_type_check |
check | — |
Relationships
-
many-to-one to
market_groupsvia
unified.group_templates
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
name
|
VARCHAR(100) |
No | — | |
description
|
TEXT |
Yes | — | |
group_type
|
VARCHAR(10) |
No | — | |
template_config
|
JSONB |
No | — | |
is_active
|
BOOLEAN |
Yes |
true
|
|
created_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
version
|
INTEGER |
Yes |
1
|
|
author
|
VARCHAR(100) |
Yes | — | |
tags
|
ARRAY |
Yes | — | |
usage_count
|
INTEGER |
Yes |
0
|
|
last_used_at
|
TIMESTAMP |
Yes | — | |
validation_rules
|
JSONB |
Yes |
'{}'::jsonb
|
|
required_permissions
|
ARRAY |
Yes | — | |
validation_status
|
VARCHAR(20) |
Yes |
'pending'::character varying
|
Indexes
| Name | Columns | Type |
|---|---|---|
group_templates_name_key |
name |
Unique |
idx_group_templates_active |
is_active |
Index |
idx_group_templates_type |
group_type |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
group_templates_pkey |
primary_key |
id |
— |
group_templates_name_key |
unique |
name |
— |
Relationships
-
many-to-one from
market_groupsvia -
one-to-one from
template_instantiationsvia
public.grouped_markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR(255) |
No | — | |
title
|
TEXT |
No | — | |
final_end_date
|
TIMESTAMP |
No | — | |
created_at
|
TIMESTAMP |
No |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
updated_at
|
TIMESTAMP |
No |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
market_ids
|
JSONB |
No |
'{}'::jsonb
|
|
platforms
|
JSONB |
No |
'{}'::jsonb
|
|
metrics
|
JSONB |
No |
'{}'::jsonb
|
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
grouped_markets_pkey |
primary_key |
id |
— |
Relationships
-
many-to-one from
kalshi_marketsvia -
many-to-one from
polymarket_marketsvia
unified.grouping_log
Audit log for all grouping actions (creation, verification, rejection)
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
INTEGER |
No |
nextval('unified.grouping_log_id_seq'::regclass)
|
|
group_id
|
UUID |
Yes | — | |
action
|
VARCHAR(20) |
Yes | — | Type of action: created, verified, rejected, expired |
actor
|
VARCHAR(50) |
Yes | — | System or username who performed the action |
details
|
TEXT |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_grouping_log_action |
action |
Index |
idx_grouping_log_created_at |
created_at |
Index |
idx_grouping_log_group_id |
group_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
grouping_log_pkey |
primary_key |
id |
— |
limitlessctfexchange.hot_block
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
height
PK
|
INTEGER |
No |
nextval('limitlessctfexchange.hot_block_height_seq'::regclass)
|
|
hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
hot_block_pkey |
primary_key |
height |
— |
limitlessctfexchange.hot_change_log
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
block_height
PK
|
INTEGER |
No | — | |
index
PK
|
INTEGER |
No | — | |
change
|
JSONB |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
hot_change_log_pkey |
primary_key |
block_height, index |
— |
public.kalshi_markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
market_id
PK
|
VARCHAR(255) |
No | — | |
event_ticker
|
VARCHAR(255) |
No | — | |
title
|
TEXT |
No | — | |
description
|
TEXT |
Yes | — | |
status
|
VARCHAR(50) |
No | — | |
expiration_date
|
TIMESTAMP |
Yes | — | |
category
|
VARCHAR(255) |
Yes | — | |
subcategory
|
VARCHAR(255) |
Yes | — | |
volume
|
NUMERIC |
Yes | — | |
open_interest
|
NUMERIC |
Yes | — | |
volume_24h
|
NUMERIC |
Yes | — | |
total_trades
|
INTEGER |
Yes | — | |
last_trade_time
|
TIMESTAMP |
Yes | — | |
best_bid_price
|
NUMERIC(20, 8) |
Yes | — | |
best_bid_size
|
NUMERIC(20, 8) |
Yes | — | |
best_ask_price
|
NUMERIC(20, 8) |
Yes | — | |
best_ask_size
|
NUMERIC(20, 8) |
Yes | — | |
last_trade_price
|
NUMERIC(20, 8) |
Yes | — | |
adjusted_midpoint
|
NUMERIC(20, 8) |
Yes | — | |
created_at
|
TIMESTAMP |
No |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
updated_at
|
TIMESTAMP |
No |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
last_checked
|
TIMESTAMP |
No |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
group_id
FK
|
VARCHAR(255) |
Yes | — |
References: public.grouped_markets(id)
|
group_similarity
|
NUMERIC(20, 8) |
Yes | — |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_kalshi_markets_event_ticker |
event_ticker |
Index |
idx_kalshi_markets_expiration |
expiration_date |
Index |
idx_kalshi_markets_group_id |
group_id |
Index |
idx_kalshi_markets_last_checked |
last_checked |
Index |
idx_kalshi_markets_status |
status |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
kalshi_markets_pkey |
primary_key |
market_id |
— |
kalshi_markets_group_id_fkey |
foreign_key |
group_id |
— |
Relationships
-
many-to-one to
grouped_marketsvia
unified.market_events_recent
HOT TABLE: Recent trades and lifecycle events. Circular buffer keeping last 100 events per market. Auto-cleaned after 1 hour. Use for recent activity feeds and trade history.
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
BIGINT |
No |
nextval('unified.market_events_recent_id_seq'::regclass)
|
|
platform
|
TEXT |
No | — | |
platform_market_id
|
TEXT |
No | — | |
event_type
|
TEXT |
No | — | |
trade_price
|
NUMERIC(10, 6) |
Yes | — | |
trade_size
|
NUMERIC(20, 8) |
Yes | — | |
trade_side
|
TEXT |
Yes | — | |
old_status
|
TEXT |
Yes | — | |
new_status
|
TEXT |
Yes | — | |
status_reason
|
TEXT |
Yes | — | |
event_data
|
JSONB |
Yes | — | |
occurred_at
|
TIMESTAMP |
Yes |
now()
|
|
websocket_session_id
|
TEXT |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_events_recent_created |
created_at |
Index |
idx_events_recent_market |
platform, platform_market_id, occurred_at |
Index |
idx_events_recent_trades |
platform_market_id, trade_price, occurred_at |
Index |
idx_events_recent_type |
event_type, occurred_at |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_events_recent_pkey |
primary_key |
id |
— |
public.market_group_items
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No | — | |
group_id
|
UUID |
No | — | |
market_id
|
VARCHAR |
No | — | |
market_type
|
VARCHAR |
No | — | |
created_at
|
TIMESTAMP |
Yes | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_group_items_pkey |
primary_key |
id |
— |
unified.market_group_members
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
group_id
FK
|
UUID |
No | — |
References: unified.market_groups(id)
|
market_id
|
UUID |
No | — | |
similarity_score
|
NUMERIC(5, 4) |
Yes |
1.0
|
|
is_representative
|
BOOLEAN |
Yes |
false
|
|
added_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_market_group_members_group_id |
group_id |
Index |
idx_market_group_members_group_market |
group_id, market_id |
Index |
idx_market_group_members_market_id |
market_id |
Index |
market_group_members_group_id_market_id_key |
group_id, market_id |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_group_members_pkey |
primary_key |
id |
— |
market_group_members_group_id_fkey |
foreign_key |
group_id |
— |
market_group_members_group_id_market_id_key |
unique |
group_id, market_id |
— |
Relationships
-
one-to-one to
market_groupsvia
unified.market_group_verification_log
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
group_id
FK
|
UUID |
No | — |
References: unified.market_groups(id)
|
action
|
TEXT |
No | — | |
previous_state
|
JSONB |
Yes | — | |
new_state
|
JSONB |
Yes | — | |
verified_by
|
TEXT |
No | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_verification_log_group_id |
group_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_group_verification_log_pkey |
primary_key |
id |
— |
market_group_verification_log_group_id_fkey |
foreign_key |
group_id |
— |
Relationships
-
many-to-one to
market_groupsvia
unified.market_groups
Cross-platform market correlations for arbitrage detection
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
title
|
TEXT |
No | — | |
description
|
TEXT |
Yes | — | |
status
|
TEXT |
Yes |
'active'::text
|
|
similarity_threshold
|
NUMERIC(3, 2) |
Yes |
0.4
|
|
created_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
title_embedding
|
NULL |
Yes | — | |
description_embedding
|
NULL |
Yes | — | |
platform_count
|
INTEGER |
Yes |
0
|
|
market_count
|
INTEGER |
Yes |
0
|
|
total_volume
|
NUMERIC(15, 2) |
Yes |
0
|
|
total_liquidity
|
NUMERIC(15, 2) |
Yes |
0
|
|
consensus_price
|
NUMERIC(10, 6) |
Yes | — | |
price_variance
|
NUMERIC(10, 6) |
Yes | — | |
human_verified
|
BOOLEAN |
Yes |
false
|
When true, this group is tradeable. human_verified = tradeable in our simplified system. |
verified_at
|
TIMESTAMP |
Yes | — | |
verified_by
|
TEXT |
Yes | — | Username/ID of admin who verified this group |
verification_notes
|
TEXT |
Yes | — | Admin notes about the verification decision |
is_valid_group
|
BOOLEAN |
Yes | — | Admin determination: NULL=not reviewed, TRUE=correctly grouped, FALSE=incorrectly grouped |
confidence
|
NUMERIC(3, 2) |
Yes |
0.00
|
Automated confidence score (0.00-1.00) for group quality |
grouping_method
|
VARCHAR(50) |
Yes |
'manual'::character varying
|
Algorithm used to create group (e.g., multi_stage_v2) |
rejection_count
|
INTEGER |
Yes |
0
|
Number of times this group has been rejected in verification |
is_system_generated
|
BOOLEAN |
Yes |
false
|
|
is_template
|
BOOLEAN |
Yes |
false
|
|
template_name
|
VARCHAR(100) |
Yes | — | |
metadata
|
JSONB |
Yes |
'{}'::jsonb
|
Type-specific configuration including agent_deployment: { "agent_deployment": { "agent_id": "uuid", "wallet_address": "0x...", "telegram_bot_id": "123456789:ABC...", "telegram_chat_id": "987654321", "deployment_status": "pending|deploying|deployed|waiting_wallet|ready|failed", "tee_endpoint": "https://...", "deployed_at": "2025-01-15T10:30:00Z", "wallet_retrieved_at": "2025-01-15T10:31:00Z", "whitelisted_at": "2025-01-15T10:32:00Z", "trading_config": { "max_position_size": 100, "min_confidence_threshold": 0.7, "unsupervised_mode": false }, "error_message": "optional error details if deployment fails" } } |
display_settings
|
JSONB |
Yes |
'{}'::jsonb
|
|
group_type
|
VARCHAR(10) |
Yes |
'same_event'::unified.group_type
|
|
source_template_id
FK
|
UUID |
Yes | — |
References: unified.group_templates(id)
|
template_version
|
INTEGER |
Yes | — | |
auto_update_from_template
|
BOOLEAN |
Yes |
false
|
|
max_spread
|
NUMERIC(5, 4) |
Yes | — | |
has_arbitrage_opportunity
|
BOOLEAN |
Yes |
false
|
|
max_arbitrage_profit
|
NUMERIC(10, 4) |
Yes | — | |
last_arbitrage_check
|
TIMESTAMP |
Yes | — | |
final_resolution_time
|
TIMESTAMP |
Yes | — | |
manager
|
VARCHAR(255) |
Yes | — | Name or identifier of the group manager/creator |
logo_url
|
TEXT |
Yes | — | URL to the group logo or branding image |
is_paper_trading
|
BOOLEAN |
No |
false
|
Flag indicating if this is a simulated (paper trading) portfolio vs real money portfolio |
initial_capital
|
NUMERIC(12, 2) |
Yes |
100.00
|
Starting capital for paper trading portfolios (default $100) |
current_cash
|
NUMERIC(12, 2) |
Yes |
100.00
|
Current unallocated cash in the portfolio |
paper_trading_config
|
JSONB |
Yes |
'{}'::jsonb
|
Configuration for paper trading simulations (fee settings, etc.) |
track_nav
|
BOOLEAN |
No |
false
|
Enable hourly NAV computation for this group |
base_currency
|
TEXT |
No |
'USDC'::text
|
Currency for NAV calculations (USDC, USD, etc.) |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_market_groups_active_id_title |
id, title, status, updated_at |
Index |
idx_market_groups_admin_verified |
human_verified, is_valid_group |
Index |
idx_market_groups_agent_deployment |
None |
Index |
idx_market_groups_agent_wallet |
None |
Index |
idx_market_groups_confidence |
confidence |
Index |
idx_market_groups_human_verified |
human_verified |
Index |
idx_market_groups_manager |
manager |
Index |
idx_market_groups_status |
status |
Index |
idx_market_groups_status_updated_at |
status, updated_at |
Index |
idx_market_groups_system_generated |
is_system_generated |
Index |
idx_market_groups_template |
is_template |
Index |
idx_market_groups_type |
group_type |
Index |
idx_market_groups_updated_at |
updated_at |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_groups_pkey |
primary_key |
id |
— |
market_groups_source_template_id_fkey |
foreign_key |
source_template_id |
— |
market_groups_rejection_count_check |
check | — | |
market_groups_status_check |
check | — |
Relationships
-
many-to-one to
group_templatesvia -
many-to-one from
portfolio_rebalancesvia -
one-to-one from
group_nav_hourlyvia -
many-to-one from
orderbook_snapshotsvia -
many-to-one from
positionsvia -
many-to-one from
opportunitiesvia -
one-to-one from
market_group_membersvia -
one-to-one from
fund_prices_dailyvia -
many-to-one from
market_group_verification_logvia -
many-to-one from
builder_ordersvia -
one-to-one from
template_instantiationsvia -
many-to-one from
group_membership_historyvia -
one-to-one from
group_market_relationshipsvia
unified.market_history
Partitioned table for historical market price data
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
timestamp
PK
|
TIMESTAMP |
No | — | |
market_id
PK
|
UUID |
No | — | |
platform
|
TEXT |
No | — | |
yes_price
|
NUMERIC(5, 4) |
Yes | — | |
no_price
|
NUMERIC(5, 4) |
Yes | — | |
volume
|
NUMERIC(15, 2) |
Yes | — | |
liquidity
|
NUMERIC(15, 2) |
Yes | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_history_pkey |
primary_key |
market_id, timestamp |
— |
unified.market_history_2025_09
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
timestamp
PK
|
TIMESTAMP |
No | — | |
market_id
PK
|
UUID |
No | — | |
platform
|
TEXT |
No | — | |
yes_price
|
NUMERIC(5, 4) |
Yes | — | |
no_price
|
NUMERIC(5, 4) |
Yes | — | |
volume
|
NUMERIC(15, 2) |
Yes | — | |
liquidity
|
NUMERIC(15, 2) |
Yes | — |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_market_history_2025_09_market_id |
market_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_history_2025_09_pkey |
primary_key |
market_id, timestamp |
— |
unified.market_history_2025_10
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
timestamp
PK
|
TIMESTAMP |
No | — | |
market_id
PK
|
UUID |
No | — | |
platform
|
TEXT |
No | — | |
yes_price
|
NUMERIC(5, 4) |
Yes | — | |
no_price
|
NUMERIC(5, 4) |
Yes | — | |
volume
|
NUMERIC(15, 2) |
Yes | — | |
liquidity
|
NUMERIC(15, 2) |
Yes | — |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_market_history_2025_10_market_id |
market_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_history_2025_10_pkey |
primary_key |
market_id, timestamp |
— |
unified.market_history_2025_11
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
timestamp
PK
|
TIMESTAMP |
No | — | |
market_id
PK
|
UUID |
No | — | |
platform
|
TEXT |
No | — | |
yes_price
|
NUMERIC(5, 4) |
Yes | — | |
no_price
|
NUMERIC(5, 4) |
Yes | — | |
volume
|
NUMERIC(15, 2) |
Yes | — | |
liquidity
|
NUMERIC(15, 2) |
Yes | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_history_2025_11_pkey |
primary_key |
market_id, timestamp |
— |
unified.market_prices_current
HOT TABLE: Latest price and volume data for each market. Updated on every ticker/price WebSocket event. One row per market, constantly UPSERTed. Use for real-time price queries and monitoring.
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
platform
PK
|
TEXT |
No | — | |
platform_market_id
PK
|
TEXT |
No | — | |
best_bid_price
|
NUMERIC(10, 6) |
Yes | — | |
best_ask_price
|
NUMERIC(10, 6) |
Yes | — | |
last_trade_price
|
NUMERIC(10, 6) |
Yes | — | |
volume_24h
|
NUMERIC(20, 8) |
Yes | — | |
volume_total
|
NUMERIC(20, 8) |
Yes | — | |
liquidity_depth
|
NUMERIC(20, 8) |
Yes | — | |
spread
|
NUMERIC(10, 6) |
Yes | — | |
mid_price
|
NUMERIC(10, 6) |
Yes | — | |
price_change_24h
|
NUMERIC(10, 6) |
Yes | — | |
price_change_pct_24h
|
NUMERIC(10, 4) |
Yes | — | |
high_24h
|
NUMERIC(10, 6) |
Yes | — | |
low_24h
|
NUMERIC(10, 6) |
Yes | — | |
market_status
|
TEXT |
Yes | — | |
resolution_value
|
NUMERIC(10, 6) |
Yes | — | |
resolved_at
|
TIMESTAMP |
Yes | — | |
last_ticker_update
|
TIMESTAMP |
Yes | — | |
last_trade_update
|
TIMESTAMP |
Yes | — | |
last_orderbook_update
|
TIMESTAMP |
Yes | — | |
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
update_count
|
BIGINT |
Yes |
0
|
|
websocket_session_id
|
TEXT |
Yes | — |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_market_prices_current_updated |
updated_at |
Index |
idx_prices_current_status |
market_status |
Index |
idx_prices_current_updated |
updated_at |
Index |
idx_prices_current_volume |
volume_24h |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_prices_current_pkey |
primary_key |
platform, platform_market_id |
— |
unified.market_similarity_cache
Cached similarity calculations for performance
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
market_a_id
|
UUID |
No | — | |
market_b_id
|
UUID |
No | — | |
similarity_score
|
NUMERIC(5, 4) |
No | — | |
similarity_method
|
VARCHAR(50) |
No | — | |
calculated_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_similarity_cache_method |
similarity_method |
Index |
idx_similarity_cache_score |
similarity_score |
Index |
market_similarity_cache_market_a_id_market_b_id_similarity__key |
market_a_id, market_b_id, similarity_method |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
market_similarity_cache_pkey |
primary_key |
id |
— |
market_similarity_cache_market_a_id_market_b_id_similarity__key |
unique |
market_a_id, market_b_id, similarity_method |
— |
unified.markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No | — | |
platform
|
TEXT |
No | — | |
platform_market_id
|
TEXT |
No | — | |
title
|
TEXT |
Yes | — | |
description
|
TEXT |
Yes | — | |
status
|
TEXT |
Yes | — | |
category
|
TEXT |
Yes | — | |
market_type
|
TEXT |
Yes | — | |
market_open_time
|
TIMESTAMP |
Yes | — | |
market_close_time
|
TIMESTAMP |
Yes | — | |
settlement_time
|
TIMESTAMP |
Yes | — | |
settlement_value
|
NUMERIC |
Yes | — | |
yes_price
|
NUMERIC |
Yes | — | |
no_price
|
NUMERIC |
Yes | — | |
yes_bid
|
NUMERIC |
Yes | — | |
yes_ask
|
NUMERIC |
Yes | — | |
no_bid
|
NUMERIC |
Yes | — | |
no_ask
|
NUMERIC |
Yes | — | |
best_bid_price
|
NUMERIC |
Yes | — | |
best_ask_price
|
NUMERIC |
Yes | — | |
best_bid_size
|
NUMERIC |
Yes | — | |
best_ask_size
|
NUMERIC |
Yes | — | |
last_trade_price
|
NUMERIC |
Yes | — | |
last_trade_time
|
TIMESTAMP |
Yes | — | |
total_volume
|
NUMERIC |
Yes | — | |
volume_24h
|
NUMERIC |
Yes | — | |
open_interest
|
NUMERIC |
Yes | — | |
liquidity
|
NUMERIC |
Yes | — | |
implied_probability
|
NUMERIC |
Yes | — | |
url
|
TEXT |
Yes | — | |
rules
|
TEXT |
Yes | — | |
metadata
|
JSONB |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
is_active
PK
|
BOOLEAN |
No |
true
|
|
event_ticker
|
TEXT |
Yes | — | |
subcategory
|
TEXT |
Yes | — | |
rules_primary
|
TEXT |
Yes | — | |
rules_secondary
|
TEXT |
Yes | — | |
expected_settlement_time
|
TIMESTAMP |
Yes | — | |
settlement_source
|
TEXT |
Yes | — | |
settlement_description
|
TEXT |
Yes | — | |
tags
|
ARRAY |
Yes | — | |
image_url
|
TEXT |
Yes | — | |
platform_created_at
|
TIMESTAMP |
Yes | — | |
platform_updated_at
|
TIMESTAMP |
Yes | — | |
market_slug
|
TEXT |
Yes | — | |
yes_token_id
|
TEXT |
Yes | — | |
no_token_id
|
TEXT |
Yes | — | |
midpoint_price
|
NUMERIC |
Yes | — | |
spread
|
NUMERIC |
Yes | — | |
volume_yes
|
NUMERIC |
Yes | — | |
volume_no
|
NUMERIC |
Yes | — | |
liquidity_yes
|
NUMERIC |
Yes | — | |
liquidity_no
|
NUMERIC |
Yes | — | |
trade_count
|
INTEGER |
Yes | — | |
trader_count
|
INTEGER |
Yes | — | |
minimum_order_size
|
NUMERIC |
Yes | — | |
minimum_tick_size
|
NUMERIC |
Yes | — | |
data_source
|
TEXT |
Yes | — | |
is_test_market
|
BOOLEAN |
Yes |
false
|
|
raw_data
|
JSONB |
Yes | — | |
market_group_id
|
UUID |
Yes | — | |
group_confidence_score
|
NUMERIC |
Yes | — | |
group_method
|
TEXT |
Yes | — | |
title_embedding
|
NULL |
Yes | — | |
description_embedding
|
NULL |
Yes | — | |
combined_embedding
|
NULL |
Yes | — | |
data_quality_score
|
NUMERIC |
Yes | — | |
has_sufficient_volume
|
BOOLEAN |
Yes | — | |
has_recent_activity
|
BOOLEAN |
Yes | — | |
has_stable_prices
|
BOOLEAN |
Yes | — | |
has_trading_bonus
|
BOOLEAN |
Yes | — | |
bonus_amount
|
NUMERIC |
Yes | — | |
bonus_currency
|
TEXT |
Yes | — | |
expiry_date
|
TIMESTAMP |
Yes | — | |
event_id
|
UUID |
Yes | — | |
contract_volume
|
NUMERIC |
Yes |
0
|
|
yes_best_buy_size
|
NUMERIC |
Yes |
0
|
|
no_best_buy_size
|
NUMERIC |
Yes |
0
|
|
yes_best_sell_size
|
NUMERIC |
Yes |
0
|
|
no_best_sell_size
|
NUMERIC |
Yes |
0
|
|
total_trades
|
INTEGER |
Yes |
0
|
|
unique_traders
|
INTEGER |
Yes |
0
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_markets_is_active |
is_active |
Index |
idx_markets_platform |
platform |
Index |
idx_markets_platform_market_id |
platform, platform_market_id, is_active |
Unique |
idx_markets_updated_at |
updated_at |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
markets_pkey |
primary_key |
id, is_active |
— |
unified.markets_active
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No | — | |
platform
|
TEXT |
No | — | |
platform_market_id
|
TEXT |
No | — | |
title
|
TEXT |
Yes | — | |
description
|
TEXT |
Yes | — | |
status
|
TEXT |
Yes | — | |
category
|
TEXT |
Yes | — | |
market_type
|
TEXT |
Yes | — | |
market_open_time
|
TIMESTAMP |
Yes | — | |
market_close_time
|
TIMESTAMP |
Yes | — | |
settlement_time
|
TIMESTAMP |
Yes | — | |
settlement_value
|
NUMERIC |
Yes | — | |
yes_price
|
NUMERIC |
Yes | — | |
no_price
|
NUMERIC |
Yes | — | |
yes_bid
|
NUMERIC |
Yes | — | |
yes_ask
|
NUMERIC |
Yes | — | |
no_bid
|
NUMERIC |
Yes | — | |
no_ask
|
NUMERIC |
Yes | — | |
best_bid_price
|
NUMERIC |
Yes | — | |
best_ask_price
|
NUMERIC |
Yes | — | |
best_bid_size
|
NUMERIC |
Yes | — | |
best_ask_size
|
NUMERIC |
Yes | — | |
last_trade_price
|
NUMERIC |
Yes | — | |
last_trade_time
|
TIMESTAMP |
Yes | — | |
total_volume
|
NUMERIC |
Yes | — | |
volume_24h
|
NUMERIC |
Yes | — | |
open_interest
|
NUMERIC |
Yes | — | |
liquidity
|
NUMERIC |
Yes | — | |
implied_probability
|
NUMERIC |
Yes | — | |
url
|
TEXT |
Yes | — | |
rules
|
TEXT |
Yes | — | |
metadata
|
JSONB |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
is_active
PK
|
BOOLEAN |
No |
true
|
|
event_ticker
|
TEXT |
Yes | — | |
subcategory
|
TEXT |
Yes | — | |
rules_primary
|
TEXT |
Yes | — | |
rules_secondary
|
TEXT |
Yes | — | |
expected_settlement_time
|
TIMESTAMP |
Yes | — | |
settlement_source
|
TEXT |
Yes | — | |
settlement_description
|
TEXT |
Yes | — | |
tags
|
ARRAY |
Yes | — | |
image_url
|
TEXT |
Yes | — | |
platform_created_at
|
TIMESTAMP |
Yes | — | |
platform_updated_at
|
TIMESTAMP |
Yes | — | |
market_slug
|
TEXT |
Yes | — | |
yes_token_id
|
TEXT |
Yes | — | |
no_token_id
|
TEXT |
Yes | — | |
midpoint_price
|
NUMERIC |
Yes | — | |
spread
|
NUMERIC |
Yes | — | |
volume_yes
|
NUMERIC |
Yes | — | |
volume_no
|
NUMERIC |
Yes | — | |
liquidity_yes
|
NUMERIC |
Yes | — | |
liquidity_no
|
NUMERIC |
Yes | — | |
trade_count
|
INTEGER |
Yes | — | |
trader_count
|
INTEGER |
Yes | — | |
minimum_order_size
|
NUMERIC |
Yes | — | |
minimum_tick_size
|
NUMERIC |
Yes | — | |
data_source
|
TEXT |
Yes | — | |
is_test_market
|
BOOLEAN |
Yes |
false
|
|
raw_data
|
JSONB |
Yes | — | |
market_group_id
|
UUID |
Yes | — | |
group_confidence_score
|
NUMERIC |
Yes | — | |
group_method
|
TEXT |
Yes | — | |
title_embedding
|
NULL |
Yes | — | |
description_embedding
|
NULL |
Yes | — | |
combined_embedding
|
NULL |
Yes | — | |
data_quality_score
|
NUMERIC |
Yes | — | |
has_sufficient_volume
|
BOOLEAN |
Yes | — | |
has_recent_activity
|
BOOLEAN |
Yes | — | |
has_stable_prices
|
BOOLEAN |
Yes | — | |
has_trading_bonus
|
BOOLEAN |
Yes | — | |
bonus_amount
|
NUMERIC |
Yes | — | |
bonus_currency
|
TEXT |
Yes | — | |
expiry_date
|
TIMESTAMP |
Yes | — | |
event_id
|
UUID |
Yes | — | |
contract_volume
|
NUMERIC |
Yes |
0
|
|
yes_best_buy_size
|
NUMERIC |
Yes |
0
|
|
no_best_buy_size
|
NUMERIC |
Yes |
0
|
|
yes_best_sell_size
|
NUMERIC |
Yes |
0
|
|
no_best_sell_size
|
NUMERIC |
Yes |
0
|
|
total_trades
|
INTEGER |
Yes |
0
|
|
unique_traders
|
INTEGER |
Yes |
0
|
Indexes
| Name | Columns | Type |
|---|---|---|
markets_active_is_active_idx |
is_active |
Index |
markets_active_platform_idx |
platform |
Index |
markets_active_platform_platform_market_id_is_active_idx |
platform, platform_market_id, is_active |
Unique |
markets_active_updated_at_idx |
updated_at |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
markets_active_pkey |
primary_key |
id, is_active |
— |
unified.markets_inactive
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No | — | |
platform
|
TEXT |
No | — | |
platform_market_id
|
TEXT |
No | — | |
title
|
TEXT |
Yes | — | |
description
|
TEXT |
Yes | — | |
status
|
TEXT |
Yes | — | |
category
|
TEXT |
Yes | — | |
market_type
|
TEXT |
Yes | — | |
market_open_time
|
TIMESTAMP |
Yes | — | |
market_close_time
|
TIMESTAMP |
Yes | — | |
settlement_time
|
TIMESTAMP |
Yes | — | |
settlement_value
|
NUMERIC |
Yes | — | |
yes_price
|
NUMERIC |
Yes | — | |
no_price
|
NUMERIC |
Yes | — | |
yes_bid
|
NUMERIC |
Yes | — | |
yes_ask
|
NUMERIC |
Yes | — | |
no_bid
|
NUMERIC |
Yes | — | |
no_ask
|
NUMERIC |
Yes | — | |
best_bid_price
|
NUMERIC |
Yes | — | |
best_ask_price
|
NUMERIC |
Yes | — | |
best_bid_size
|
NUMERIC |
Yes | — | |
best_ask_size
|
NUMERIC |
Yes | — | |
last_trade_price
|
NUMERIC |
Yes | — | |
last_trade_time
|
TIMESTAMP |
Yes | — | |
total_volume
|
NUMERIC |
Yes | — | |
volume_24h
|
NUMERIC |
Yes | — | |
open_interest
|
NUMERIC |
Yes | — | |
liquidity
|
NUMERIC |
Yes | — | |
implied_probability
|
NUMERIC |
Yes | — | |
url
|
TEXT |
Yes | — | |
rules
|
TEXT |
Yes | — | |
metadata
|
JSONB |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
is_active
PK
|
BOOLEAN |
No |
true
|
|
event_ticker
|
TEXT |
Yes | — | |
subcategory
|
TEXT |
Yes | — | |
rules_primary
|
TEXT |
Yes | — | |
rules_secondary
|
TEXT |
Yes | — | |
expected_settlement_time
|
TIMESTAMP |
Yes | — | |
settlement_source
|
TEXT |
Yes | — | |
settlement_description
|
TEXT |
Yes | — | |
tags
|
ARRAY |
Yes | — | |
image_url
|
TEXT |
Yes | — | |
platform_created_at
|
TIMESTAMP |
Yes | — | |
platform_updated_at
|
TIMESTAMP |
Yes | — | |
market_slug
|
TEXT |
Yes | — | |
yes_token_id
|
TEXT |
Yes | — | |
no_token_id
|
TEXT |
Yes | — | |
midpoint_price
|
NUMERIC |
Yes | — | |
spread
|
NUMERIC |
Yes | — | |
volume_yes
|
NUMERIC |
Yes | — | |
volume_no
|
NUMERIC |
Yes | — | |
liquidity_yes
|
NUMERIC |
Yes | — | |
liquidity_no
|
NUMERIC |
Yes | — | |
trade_count
|
INTEGER |
Yes | — | |
trader_count
|
INTEGER |
Yes | — | |
minimum_order_size
|
NUMERIC |
Yes | — | |
minimum_tick_size
|
NUMERIC |
Yes | — | |
data_source
|
TEXT |
Yes | — | |
is_test_market
|
BOOLEAN |
Yes |
false
|
|
raw_data
|
JSONB |
Yes | — | |
market_group_id
|
UUID |
Yes | — | |
group_confidence_score
|
NUMERIC |
Yes | — | |
group_method
|
TEXT |
Yes | — | |
title_embedding
|
NULL |
Yes | — | |
description_embedding
|
NULL |
Yes | — | |
combined_embedding
|
NULL |
Yes | — | |
data_quality_score
|
NUMERIC |
Yes | — | |
has_sufficient_volume
|
BOOLEAN |
Yes | — | |
has_recent_activity
|
BOOLEAN |
Yes | — | |
has_stable_prices
|
BOOLEAN |
Yes | — | |
has_trading_bonus
|
BOOLEAN |
Yes | — | |
bonus_amount
|
NUMERIC |
Yes | — | |
bonus_currency
|
TEXT |
Yes | — | |
expiry_date
|
TIMESTAMP |
Yes | — | |
event_id
|
UUID |
Yes | — | |
contract_volume
|
NUMERIC |
Yes |
0
|
|
yes_best_buy_size
|
NUMERIC |
Yes |
0
|
|
no_best_buy_size
|
NUMERIC |
Yes |
0
|
|
yes_best_sell_size
|
NUMERIC |
Yes |
0
|
|
no_best_sell_size
|
NUMERIC |
Yes |
0
|
|
total_trades
|
INTEGER |
Yes |
0
|
|
unique_traders
|
INTEGER |
Yes |
0
|
Indexes
| Name | Columns | Type |
|---|---|---|
markets_inactive_is_active_idx |
is_active |
Index |
markets_inactive_platform_idx |
platform |
Index |
markets_inactive_platform_platform_market_id_is_active_idx |
platform, platform_market_id, is_active |
Unique |
markets_inactive_updated_at_idx |
updated_at |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
markets_inactive_pkey |
primary_key |
id, is_active |
— |
migration_system.migration_history
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
INTEGER |
No |
nextval('migration_system.migration_history_id_seq'::regclass)
|
|
version
|
VARCHAR(50) |
No | — | |
description
|
TEXT |
Yes | — | |
sql_hash
|
VARCHAR(64) |
No | — | |
deployed_at
|
TIMESTAMP |
Yes |
now()
|
|
deployed_by
|
VARCHAR(100) |
Yes | — | |
status
|
VARCHAR(20) |
Yes |
'success'::character varying
|
|
rollback_sql
|
TEXT |
Yes | — |
Indexes
| Name | Columns | Type |
|---|---|---|
migration_history_version_key |
version |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
migration_history_pkey |
primary_key |
id |
— |
migration_history_version_key |
unique |
version |
— |
limitlessctfexchange.migrations
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
INTEGER |
No |
nextval('limitlessctfexchange.migrations_id_seq'::regclass)
|
|
timestamp
|
INTEGER |
No | — | |
name
|
VARCHAR |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
migrations_pkey |
primary_key |
id |
— |
limitlessctfexchange.new_admin
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
new_admin_address
|
TEXT |
No | — | |
admin
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
new_admin_pkey |
primary_key |
id |
— |
limitlessctfexchange.new_operator
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
new_operator_address
|
TEXT |
No | — | |
admin
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
new_operator_pkey |
primary_key |
id |
— |
trading.opportunities
Log of all detected arbitrage opportunities and APY calculations
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
group_id
FK
|
UUID |
No | — |
References: unified.market_groups(id)
|
timestamp
|
TIMESTAMP |
No |
now()
|
|
apy
|
NUMERIC(10, 2) |
No | — | Annualized percentage yield = (spread / days_to_close) * 365 |
spread
|
NUMERIC(10, 4) |
No | — | Profit margin after all fees (1 - total_cost) |
days_to_close
|
INTEGER |
No | — | |
kalshi_yes_price
|
NUMERIC(10, 4) |
Yes | — | |
kalshi_no_price
|
NUMERIC(10, 4) |
Yes | — | |
poly_yes_price
|
NUMERIC(10, 4) |
Yes | — | |
poly_no_price
|
NUMERIC(10, 4) |
Yes | — | |
limitless_yes_price
|
NUMERIC(10, 4) |
Yes | — | |
limitless_no_price
|
NUMERIC(10, 4) |
Yes | — | |
yes_platform
|
TEXT |
Yes | — | Platform to buy YES on for this opportunity |
no_platform
|
TEXT |
Yes | — | Platform to buy NO on for this opportunity |
total_cost
|
NUMERIC(10, 4) |
Yes | — | Total cost including all fees and gas |
traded
|
BOOLEAN |
Yes |
false
|
Whether a position was opened for this opportunity |
trade_reason
|
TEXT |
Yes | — | |
position_id
FK
|
UUID |
Yes | — |
References: trading.positions(id)
|
market_title
|
TEXT |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
|
yes_orderbook_liquidity
|
NUMERIC(20, 2) |
Yes | — | Total YES liquidity available in orderbook ($) |
no_orderbook_liquidity
|
NUMERIC(20, 2) |
Yes | — | Total NO liquidity available in orderbook ($) |
executable_size
|
NUMERIC(20, 2) |
Yes | — | Maximum size that can be executed given orderbook depth |
yes_best_ask
|
NUMERIC(10, 6) |
Yes | — | Best ask price for YES at opportunity detection |
no_best_ask
|
NUMERIC(10, 6) |
Yes | — | Best ask price for NO at opportunity detection |
yes_ask_depth
|
INTEGER |
Yes | — | Number of ask levels in YES orderbook |
no_ask_depth
|
INTEGER |
Yes | — | Number of ask levels in NO orderbook |
orderbook_freshness_seconds
|
INTEGER |
Yes | — | Age of orderbook data in seconds |
execution_method
|
TEXT |
Yes |
'market_price'::text
|
Whether opportunity was calculated from market prices or orderbook |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_opportunities_apy |
apy |
Index |
idx_opportunities_group_id |
group_id |
Index |
idx_opportunities_timestamp |
timestamp |
Index |
idx_opportunities_traded |
traded |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
opportunities_pkey |
primary_key |
id |
— |
opportunities_group_id_fkey |
foreign_key |
group_id |
— |
opportunities_position_id_fkey |
foreign_key |
position_id |
— |
opportunities_execution_method_check |
check | — |
Relationships
-
many-to-one to
market_groupsvia -
many-to-one to
positionsvia
limitlessctfexchange.order
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
salt
|
NUMERIC |
No | — | |
maker
|
TEXT |
No | — | |
signer
|
TEXT |
No | — | |
taker
|
TEXT |
No | — | |
token_id
|
NUMERIC |
No | — | |
maker_amount
|
NUMERIC |
No | — | |
taker_amount
|
NUMERIC |
No | — | |
expiration
|
NUMERIC |
No | — | |
nonce
|
NUMERIC |
No | — | |
fee_rate_bps
|
NUMERIC |
No | — | |
side
|
INTEGER |
No | — | |
signature_type
|
INTEGER |
No | — | |
signature
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — | |
status_id
|
VARCHAR |
Yes | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
order_pkey |
primary_key |
id |
— |
unified.order_book_current
Real-time orderbook snapshot for each market/token. Stores full depth (bids/asks arrays) from WebSocket feeds. One row per market/token combination, updated on each orderbook event.
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
INTEGER |
No |
nextval('unified.order_book_current_id_seq'::regclass)
|
Auto-incrementing primary key |
platform
|
TEXT |
No | — | Trading platform: polymarket, kalshi, or limitless |
market_id
|
TEXT |
No | — | Platform-specific market identifier (e.g., Polymarket condition_id) |
token_type
|
TEXT |
No | — | Binary outcome token: YES (buy outcome) or NO (sell outcome) |
bids
|
JSONB |
No |
'[]'::jsonb
|
Array of bid levels [{price, size},...] sorted by price DESC. Price in [0,1], size in base units. |
asks
|
JSONB |
No |
'[]'::jsonb
|
Array of ask levels [{price, size},...] sorted by price ASC. Price in [0,1], size in base units. |
best_bid_price
|
NUMERIC(10, 6) |
Yes | — | Highest bid price (top of book). Null if no bids. |
best_bid_size
|
NUMERIC(20, 8) |
Yes | — | Size available at best bid price |
best_ask_price
|
NUMERIC(10, 6) |
Yes | — | Lowest ask price (top of book). Null if no asks. |
best_ask_size
|
NUMERIC(20, 8) |
Yes | — | Size available at best ask price |
spread
|
NUMERIC(10, 6) |
Yes | — | Computed: ask - bid. Indicates market liquidity (smaller = more liquid) |
mid_price
|
NUMERIC(10, 6) |
Yes | — | Computed: (bid + ask) / 2. Fair value estimate. |
sequence_number
|
BIGINT |
Yes | — | Platform sequence number for detecting gaps/replays |
exchange_timestamp
|
TIMESTAMP |
Yes | — | When the exchange generated this orderbook state |
received_at
|
TIMESTAMP |
Yes |
now()
|
When our system first received this update |
updated_at
|
TIMESTAMP |
Yes |
now()
|
Last modification time (auto-updated by trigger) |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_orderbook_current_best_prices |
best_bid_price, best_ask_price |
Index |
idx_orderbook_current_platform_market |
platform, market_id |
Index |
idx_orderbook_current_updated |
updated_at |
Index |
uq_orderbook_current |
platform, market_id, token_type |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
order_book_current_pkey |
primary_key |
id |
— |
uq_orderbook_current |
unique |
platform, market_id, token_type |
— |
order_book_current_token_type_check |
check | — |
limitlessctfexchange.order_cancelled
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
order_hash
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
order_cancelled_pkey |
primary_key |
id |
— |
limitlessctfexchange.order_filled
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
order_hash
|
TEXT |
No | — | |
maker
|
TEXT |
No | — | |
taker
|
TEXT |
No | — | |
maker_asset_id
|
NUMERIC |
No | — | |
taker_asset_id
|
NUMERIC |
No | — | |
maker_amount_filled
|
NUMERIC |
No | — | |
taker_amount_filled
|
NUMERIC |
No | — | |
fee
|
NUMERIC |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
order_filled_pkey |
primary_key |
id |
— |
limitlessctfexchange.order_status
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
is_filled_or_cancelled
|
BOOLEAN |
No | — | |
remaining
|
NUMERIC |
No | — | |
last_updated
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
order_status_pkey |
primary_key |
id |
— |
trading.orderbook_snapshots
Historical snapshots of orderbook liquidity and arbitrage opportunities
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
group_id
FK
|
UUID |
No | — |
References: unified.market_groups(id)
|
timestamp
|
TIMESTAMP |
No |
now()
|
|
kalshi_yes_liquidity
|
NUMERIC(20, 2) |
Yes | — | |
kalshi_no_liquidity
|
NUMERIC(20, 2) |
Yes | — | |
kalshi_spread
|
NUMERIC(10, 6) |
Yes | — | |
kalshi_mid_price
|
NUMERIC(10, 6) |
Yes | — | |
kalshi_bid_levels
|
INTEGER |
Yes | — | |
kalshi_ask_levels
|
INTEGER |
Yes | — | |
polymarket_yes_liquidity
|
NUMERIC(20, 2) |
Yes | — | |
polymarket_no_liquidity
|
NUMERIC(20, 2) |
Yes | — | |
polymarket_spread
|
NUMERIC(10, 6) |
Yes | — | |
polymarket_mid_price
|
NUMERIC(10, 6) |
Yes | — | |
polymarket_bid_levels
|
INTEGER |
Yes | — | |
polymarket_ask_levels
|
INTEGER |
Yes | — | |
limitless_yes_liquidity
|
NUMERIC(20, 2) |
Yes | — | |
limitless_no_liquidity
|
NUMERIC(20, 2) |
Yes | — | |
limitless_spread
|
NUMERIC(10, 6) |
Yes | — | |
limitless_mid_price
|
NUMERIC(10, 6) |
Yes | — | |
limitless_bid_levels
|
INTEGER |
Yes | — | |
limitless_ask_levels
|
INTEGER |
Yes | — | |
max_executable_arbitrage
|
NUMERIC(20, 2) |
Yes | — | Maximum arbitrage size given orderbook constraints |
best_yes_platform
|
TEXT |
Yes | — | |
best_no_platform
|
TEXT |
Yes | — | |
arbitrage_spread
|
NUMERIC(10, 4) |
Yes | — | |
arbitrage_apy
|
NUMERIC(10, 2) |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_orderbook_snapshots_arbitrage |
arbitrage_apy |
Index |
idx_orderbook_snapshots_group_id |
group_id |
Index |
idx_orderbook_snapshots_timestamp |
timestamp |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
orderbook_snapshots_pkey |
primary_key |
id |
— |
orderbook_snapshots_group_id_fkey |
foreign_key |
group_id |
— |
Relationships
-
many-to-one to
market_groupsvia
limitlessctfexchange.orders_matched
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
taker_order_hash
|
TEXT |
No | — | |
taker_order_maker
|
TEXT |
No | — | |
maker_asset_id
|
NUMERIC |
No | — | |
taker_asset_id
|
NUMERIC |
No | — | |
maker_amount_filled
|
NUMERIC |
No | — | |
taker_amount_filled
|
NUMERIC |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
orders_matched_pkey |
primary_key |
id |
— |
public.polymarket_markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
market_id
PK
|
VARCHAR(255) |
No | — | |
question
|
TEXT |
No | — | |
description
|
TEXT |
Yes | — | |
category
|
VARCHAR(255) |
Yes | — | |
end_date
|
TIMESTAMP |
Yes | — | |
status
|
VARCHAR(50) |
Yes | — | |
volume
|
NUMERIC(20, 8) |
Yes | — | |
liquidity
|
NUMERIC(20, 8) |
Yes | — | |
is_active
|
BOOLEAN |
Yes | — | |
group_id
FK
|
VARCHAR(255) |
Yes | — |
References: public.grouped_markets(id)
|
group_similarity
|
NUMERIC(20, 8) |
Yes | — | |
yes_token_id
|
VARCHAR(255) |
Yes | — | |
yes_best_buy_price
|
NUMERIC(20, 8) |
Yes | — | |
yes_best_buy_size
|
NUMERIC(20, 8) |
Yes | — | |
yes_best_sell_price
|
NUMERIC(20, 8) |
Yes | — | |
yes_best_sell_size
|
NUMERIC(20, 8) |
Yes | — | |
yes_midpoint
|
NUMERIC(20, 8) |
Yes | — | |
yes_spread
|
NUMERIC(20, 8) |
Yes | — | |
no_token_id
|
VARCHAR(255) |
Yes | — | |
no_best_buy_price
|
NUMERIC(20, 8) |
Yes | — | |
no_best_buy_size
|
NUMERIC(20, 8) |
Yes | — | |
no_best_sell_price
|
NUMERIC(20, 8) |
Yes | — | |
no_best_sell_size
|
NUMERIC(20, 8) |
Yes | — | |
no_midpoint
|
NUMERIC(20, 8) |
Yes | — | |
no_spread
|
NUMERIC(20, 8) |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
updated_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
last_checked
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
polymarket_markets_pkey |
primary_key |
market_id |
— |
polymarket_markets_group_id_fkey |
foreign_key |
group_id |
— |
Relationships
-
many-to-one to
grouped_marketsvia
pmf.portfolio_rebalances
Tracks portfolio rebalancing events with detailed allocation snapshots
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
Unique identifier for the rebalance event |
group_id
FK
|
UUID |
No | — |
Foreign key to market_groups (portfolio)
References: unified.market_groups(id)
|
rebalance_timestamp
|
TIMESTAMP |
No |
now()
|
When the rebalance occurred |
portfolio_value_before
|
NUMERIC(12, 2) |
No | — | Total portfolio value before rebalancing |
portfolio_value_after
|
NUMERIC(12, 2) |
No | — | Total portfolio value after rebalancing (should be same) |
allocations
|
JSONB |
No | — | JSON array of allocations with percentages, amounts, and shares calculated |
rebalance_type
|
VARCHAR(50) |
Yes |
'manual'::character varying
|
Type of rebalance: manual (user), automatic (scheduled), initial (first allocation) |
triggered_by
|
VARCHAR(255) |
Yes | — | User ID or system identifier that triggered the rebalance |
notes
|
TEXT |
Yes | — | Optional notes about the rebalance |
created_at
|
TIMESTAMP |
No |
now()
|
|
updated_at
|
TIMESTAMP |
No |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_rebalances_group_id |
group_id |
Index |
idx_rebalances_group_timestamp |
group_id, rebalance_timestamp |
Index |
idx_rebalances_timestamp |
rebalance_timestamp |
Index |
idx_rebalances_type |
rebalance_type |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
portfolio_rebalances_pkey |
primary_key |
id |
— |
portfolio_rebalances_group_id_fkey |
foreign_key |
group_id |
— |
Relationships
-
many-to-one to
market_groupsvia
trading.positions
Tracks individual arbitrage positions from entry to exit
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
session_id
FK
|
UUID |
Yes | — |
References: trading.sessions(id)
|
opportunity_id
|
UUID |
Yes | — | |
strategy_name
|
TEXT |
No | — | |
is_simulation
|
BOOLEAN |
No |
true
|
|
created_at
|
TIMESTAMP |
No |
now()
|
|
yes_market_id
|
UUID |
Yes | — | |
yes_platform
|
TEXT |
No | — | |
yes_target_price
|
NUMERIC(20, 8) |
Yes | — | |
yes_executed_price
|
NUMERIC(20, 8) |
Yes | — | |
yes_execution_time
|
TIMESTAMP |
Yes | — | |
yes_size
|
NUMERIC(20, 8) |
Yes |
1.0
|
|
yes_fees
|
NUMERIC(20, 8) |
Yes |
0
|
|
yes_slippage
|
NUMERIC(20, 8) |
Yes | — | |
no_market_id
|
UUID |
Yes | — | |
no_platform
|
TEXT |
No | — | |
no_target_price
|
NUMERIC(20, 8) |
Yes | — | |
no_executed_price
|
NUMERIC(20, 8) |
Yes | — | |
no_execution_time
|
TIMESTAMP |
Yes | — | |
no_size
|
NUMERIC(20, 8) |
Yes |
1.0
|
|
no_fees
|
NUMERIC(20, 8) |
Yes |
0
|
|
no_slippage
|
NUMERIC(20, 8) |
Yes | — | |
status
|
TEXT |
No |
'pending'::text
|
|
total_invested
|
NUMERIC(20, 8) |
Yes | — | |
max_risk
|
NUMERIC(20, 8) |
Yes | — | |
exit_time
|
TIMESTAMP |
Yes | — | |
exit_reason
|
TEXT |
Yes | — | |
market_resolution
|
TEXT |
Yes | — | |
gross_pnl
|
NUMERIC(20, 8) |
Yes | — | |
total_fees_paid
|
NUMERIC(20, 8) |
Yes | — | |
net_pnl
|
NUMERIC(20, 8) |
Yes | — | |
execution_latency_ms
|
INTEGER |
Yes | — | |
failure_reason
|
TEXT |
Yes | — | |
metadata
|
JSONB |
Yes |
'{}'::jsonb
|
|
group_id
FK
|
UUID |
Yes | — |
Link to the verified market group being traded
References: unified.market_groups(id)
|
entry_apy
|
NUMERIC(10, 2) |
Yes | — | APY at time of trade entry (%) |
entry_spread
|
NUMERIC(10, 4) |
Yes | — | Price spread at entry (decimal) |
days_to_resolution
|
INTEGER |
Yes | — | Days until market resolution at entry |
yes_levels_consumed
|
INTEGER |
Yes | — | Number of orderbook levels consumed for YES execution |
no_levels_consumed
|
INTEGER |
Yes | — | Number of orderbook levels consumed for NO execution |
yes_avg_execution_price
|
NUMERIC(10, 6) |
Yes | — | Volume-weighted average price for YES execution from orderbook |
no_avg_execution_price
|
NUMERIC(10, 6) |
Yes | — | Volume-weighted average price for NO execution from orderbook |
max_available_liquidity
|
NUMERIC(20, 2) |
Yes | — | Maximum executable size based on orderbook liquidity at entry |
liquidity_constrained_by
|
TEXT |
Yes | — | Which side limited the trade size (yes/no/both/none) |
price_impact_pct
|
NUMERIC(10, 4) |
Yes | — | Price impact from walking the orderbook (%) |
orderbook_timestamp
|
TIMESTAMP |
Yes | — | Timestamp of orderbook data used for execution |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_positions_created_at |
created_at |
Index |
idx_positions_open |
status |
Index |
idx_positions_opportunity_id |
opportunity_id |
Index |
idx_positions_session_id |
session_id |
Index |
idx_positions_status |
status |
Index |
idx_positions_strategy |
strategy_name |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
positions_pkey |
primary_key |
id |
— |
positions_group_id_fkey |
foreign_key |
group_id |
— |
positions_session_id_fkey |
foreign_key |
session_id |
— |
positions_exit_reason_check |
check | — | |
positions_liquidity_constrained_by_check |
check | — | |
positions_market_resolution_check |
check | — | |
positions_status_check |
check | — |
Relationships
-
many-to-one to
market_groupsvia -
many-to-one to
sessionsvia -
many-to-one from
opportunitiesvia
limitlessctfexchange.proxy_factory_updated
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
old_proxy_factory
|
TEXT |
No | — | |
new_proxy_factory
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
proxy_factory_updated_pkey |
primary_key |
id |
— |
unified.raw_events
DEPRECATED: Do not use in production. Replaced by specialized hot tables for better performance. Only use for debugging with sampling enabled.
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
Auto-incrementing primary key |
platform
|
TEXT |
No | — | Source platform |
event_type
|
TEXT |
No | — | Type of event received |
market_id
|
TEXT |
No | — | Platform market identifier |
event_data
|
JSONB |
No | — | Complete event payload (JSONB) |
blockchain_data
|
JSONB |
Yes | — | |
ingested_at
|
TIMESTAMP |
Yes |
now()
|
When event was received |
processed_at
|
TIMESTAMP |
Yes | — | When event was processed |
processing_status
|
TEXT |
Yes |
'pending'::text
|
Processing status |
retry_count
|
INTEGER |
Yes |
0
|
Number of retry attempts |
error_message
|
TEXT |
Yes | — | Error details if failed |
api_endpoint
|
TEXT |
Yes | — | API endpoint called |
http_method
|
TEXT |
Yes |
'GET'::text
|
HTTP method used (GET, POST, etc.) |
response_time_ms
|
INTEGER |
Yes | — | API response time in ms |
response_status_code
|
INTEGER |
Yes | — | HTTP status code |
rate_limit_remaining
|
INTEGER |
Yes | — | Number of requests remaining in rate limit window |
rate_limit_reset_at
|
TIMESTAMP |
Yes | — | When rate limit window resets |
data_freshness_seconds
|
INTEGER |
Yes | — | Age of data in seconds when received |
api_version
|
TEXT |
Yes | — | API version used |
request_headers
|
JSONB |
Yes | — | HTTP request headers |
response_headers
|
JSONB |
Yes | — | HTTP response headers |
pagination_cursor
|
TEXT |
Yes | — | Cursor for paginated requests |
batch_size
|
INTEGER |
Yes | — | Number of items in batch request |
is_incremental_update
|
BOOLEAN |
Yes |
false
|
True if this is an incremental update |
parent_request_id
|
UUID |
Yes | — | Parent request ID for related requests |
batch_operation_id
FK
|
UUID |
Yes | — |
References: unified.batch_operations(id)
|
batch_sequence_number
|
INTEGER |
Yes | — | |
batch_context
|
JSONB |
Yes | — | |
is_realtime
|
BOOLEAN |
Yes |
false
|
Whether from WebSocket/realtime |
websocket_session_id
|
TEXT |
Yes | — | Session ID for WebSocket connection that generated this event |
Indexes
| Name | Columns | Type |
|---|---|---|
idx_raw_events_api_endpoint |
api_endpoint |
Index |
idx_raw_events_batch_operation |
batch_operation_id |
Index |
idx_raw_events_batch_sequence |
batch_operation_id, batch_sequence_number |
Index |
idx_raw_events_event_type |
event_type |
Index |
idx_raw_events_failed_retry_optimization |
processing_status, retry_count, ingested_at |
Index |
idx_raw_events_incremental |
is_incremental_update |
Index |
idx_raw_events_ingested_at |
ingested_at |
Index |
idx_raw_events_market_id |
market_id |
Index |
idx_raw_events_parent_request |
parent_request_id |
Index |
idx_raw_events_pending |
platform, ingested_at |
Index |
idx_raw_events_platform |
platform |
Index |
idx_raw_events_platform_endpoint |
platform, api_endpoint |
Index |
idx_raw_events_platform_status |
platform, processing_status |
Index |
idx_raw_events_processing_status |
processing_status |
Index |
idx_raw_events_realtime |
is_realtime, platform, ingested_at |
Index |
idx_raw_events_response_status |
response_status_code |
Index |
idx_raw_events_response_time |
response_time_ms |
Index |
idx_raw_events_status_code |
response_status_code |
Index |
idx_raw_events_status_time |
processing_status, ingested_at |
Index |
idx_raw_events_websocket_session |
websocket_session_id |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
raw_events_pkey |
primary_key |
id |
— |
raw_events_batch_operation_id_fkey |
foreign_key |
batch_operation_id |
— |
check_batch_size_positive |
check | — | |
check_realtime_session_consistency |
check | — | |
check_response_time_positive |
check | — | |
check_valid_status_code |
check | — | |
raw_events_batch_sequence_number_check |
check | — | |
raw_events_event_type_check |
check | — | |
raw_events_platform_check |
check | — | |
raw_events_processing_status_check |
check | — | |
raw_events_retry_count_check |
check | — |
Relationships
-
many-to-one to
batch_operationsvia
kalshimarkets.raw_markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
market_id
PK
|
VARCHAR(255) |
No | — | |
event_ticker
|
VARCHAR(255) |
No | — | |
title
|
TEXT |
No | — | |
description
|
TEXT |
Yes | — | |
category
|
VARCHAR(255) |
Yes | — | |
subcategory
|
VARCHAR(255) |
Yes | — | |
status
|
VARCHAR(50) |
No | — | |
open_time
|
TIMESTAMP |
No | — | |
close_time
|
TIMESTAMP |
No | — | |
settlement_time
|
TIMESTAMP |
Yes | — | |
settlement_value
|
NUMERIC(20, 8) |
Yes | — | |
yes_bid
|
NUMERIC(20, 8) |
Yes | — | |
yes_ask
|
NUMERIC(20, 8) |
Yes | — | |
no_bid
|
NUMERIC(20, 8) |
Yes | — | |
no_ask
|
NUMERIC(20, 8) |
Yes | — | |
volume
|
NUMERIC |
Yes | — | |
open_interest
|
NUMERIC |
Yes | — | |
liquidity
|
NUMERIC |
Yes | — | |
last_trade_price
|
NUMERIC(20, 8) |
Yes | — | |
last_trade_time
|
TIMESTAMP |
Yes | — | |
rules_primary
|
TEXT |
Yes | — | |
rules_secondary
|
TEXT |
Yes | — | |
is_primary_market
|
BOOLEAN |
Yes | — | |
raw_metadata
|
JSON |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
updated_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
last_checked
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
raw_markets_pkey |
primary_key |
market_id |
— |
polymarket.raw_markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
condition_id
PK
|
VARCHAR(255) |
No | — | |
question_id
|
VARCHAR(255) |
No | — | |
question
|
TEXT |
No | — | |
description
|
TEXT |
Yes | — | |
category
|
VARCHAR(255) |
Yes | — | |
end_date_iso
|
TIMESTAMP |
Yes | — | |
game_start_time
|
TIMESTAMP |
Yes | — | |
market_slug
|
VARCHAR(255) |
Yes | — | |
active
|
BOOLEAN |
Yes | — | |
closed
|
BOOLEAN |
Yes | — | |
seconds_delay
|
NUMERIC |
Yes | — | |
icon
|
TEXT |
Yes | — | |
fpmm
|
VARCHAR(255) |
Yes | — | |
minimum_order_size
|
NUMERIC(20, 8) |
Yes | — | |
minimum_tick_size
|
NUMERIC(20, 8) |
Yes | — | |
min_incentive_size
|
NUMERIC(20, 8) |
Yes | — | |
max_incentive_spread
|
NUMERIC(20, 8) |
Yes | — | |
best_bid_price
|
NUMERIC(20, 8) |
Yes | — | |
best_bid_size
|
NUMERIC(20, 8) |
Yes | — | |
best_ask_price
|
NUMERIC(20, 8) |
Yes | — | |
best_ask_size
|
NUMERIC(20, 8) |
Yes | — | |
midpoint_price
|
NUMERIC(20, 8) |
Yes | — | |
spread
|
NUMERIC(20, 8) |
Yes | — | |
volume
|
NUMERIC(20, 8) |
Yes | — | |
liquidity
|
NUMERIC(20, 8) |
Yes | — | |
token_yes_id
|
VARCHAR(255) |
Yes | — | |
token_yes_outcome
|
TEXT |
Yes | — | |
token_no_id
|
VARCHAR(255) |
Yes | — | |
token_no_outcome
|
TEXT |
Yes | — | |
raw_metadata
|
JSON |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
updated_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
last_checked
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
raw_markets_pkey |
primary_key |
condition_id |
— |
limitlessctfexchange.removed_admin
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
removed_admin
|
TEXT |
No | — | |
admin
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
removed_admin_pkey |
primary_key |
id |
— |
limitlessctfexchange.removed_operator
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
removed_operator
|
TEXT |
No | — | |
admin
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
removed_operator_pkey |
primary_key |
id |
— |
limitlessctfexchange.safe_factory_updated
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
old_safe_factory
|
TEXT |
No | — | |
new_safe_factory
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
safe_factory_updated_pkey |
primary_key |
id |
— |
public.schema_migrations
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
version
PK
|
TEXT |
No | — | |
applied_at
|
TIMESTAMP |
No |
now()
|
|
checksum
|
TEXT |
No | — | |
execution_time_ms
|
INTEGER |
Yes | — | |
status
|
TEXT |
Yes |
'completed'::text
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_schema_migrations_applied_at |
applied_at |
Index |
idx_schema_migrations_status |
status |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
schema_migrations_pkey |
primary_key |
version |
— |
unified.schema_migrations
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
version
PK
|
TEXT |
No | — | |
description
|
TEXT |
Yes | — | |
applied_at
|
TIMESTAMP |
Yes |
now()
|
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
schema_migrations_pkey |
primary_key |
version |
— |
unified.series
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
title
|
TEXT |
No | — | |
normalized_title
|
TEXT |
Yes | — | |
description
|
TEXT |
Yes | — | |
category
|
TEXT |
Yes | — | |
series_type
|
TEXT |
Yes | — | |
frequency
|
TEXT |
Yes | — | |
status
|
TEXT |
No |
'active'::text
|
|
is_active
|
BOOLEAN |
Yes |
true
|
|
total_events
|
INTEGER |
Yes |
0
|
|
total_markets
|
INTEGER |
Yes |
0
|
|
active_markets
|
INTEGER |
Yes |
0
|
|
total_volume
|
NUMERIC(20, 8) |
Yes |
0
|
|
platforms
|
ARRAY |
Yes |
'{}'::text[]
|
|
platform_count
|
INTEGER |
Yes |
0
|
|
kalshi_series_id
|
TEXT |
Yes | — | |
kalshi_series_ticker
|
TEXT |
Yes | — | |
polymarket_series_id
|
TEXT |
Yes | — | |
polymarket_series_slug
|
TEXT |
Yes | — | |
limitless_series_id
|
TEXT |
Yes | — | |
similarity_hash
|
TEXT |
Yes | — | |
tags
|
ARRAY |
Yes | — | |
platform_metadata
|
JSONB |
Yes |
'{}'::jsonb
|
|
created_at
|
TIMESTAMP |
Yes |
now()
|
|
updated_at
|
TIMESTAMP |
Yes |
now()
|
|
last_synced
|
TIMESTAMP |
Yes |
now()
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_series_active |
is_active |
Index |
idx_series_category |
category |
Index |
idx_series_kalshi_id |
kalshi_series_id |
Index |
idx_series_normalized_title |
normalized_title |
Index |
idx_series_platforms |
platforms |
Index |
idx_series_polymarket_id |
polymarket_series_id |
Index |
idx_series_similarity_hash |
similarity_hash |
Index |
idx_series_status |
status |
Index |
idx_series_tags |
tags |
Index |
idx_series_type |
series_type |
Index |
series_unique_hash |
similarity_hash |
Unique |
series_unique_kalshi_id |
kalshi_series_id |
Unique |
series_unique_polymarket_id |
polymarket_series_id |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
series_pkey |
primary_key |
id |
— |
series_unique_hash |
unique |
similarity_hash |
— |
series_unique_kalshi_id |
unique |
kalshi_series_id |
— |
series_unique_polymarket_id |
unique |
polymarket_series_id |
— |
series_counts_check |
check | — | |
series_status_check |
check | — | |
series_type_check |
check | — |
Relationships
-
one-to-one from
event_seriesvia
trading.sessions
Groups related trades for analysis and risk management
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
name
|
TEXT |
No | — | |
mode
|
TEXT |
No | — | |
started_at
|
TIMESTAMP |
No |
now()
|
|
ended_at
|
TIMESTAMP |
Yes | — | |
total_positions
|
INTEGER |
Yes |
0
|
|
total_pnl
|
NUMERIC(20, 8) |
Yes |
0
|
|
status
|
TEXT |
No |
'active'::text
|
|
metadata
|
JSONB |
Yes |
'{}'::jsonb
|
Indexes
| Name | Columns | Type |
|---|---|---|
idx_sessions_started_at |
started_at |
Index |
idx_sessions_status |
status |
Index |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
sessions_pkey |
primary_key |
id |
— |
sessions_mode_check |
check | — | |
sessions_status_check |
check | — |
Relationships
-
many-to-one from
positionsvia
limitlessctfexchange.status
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
INTEGER |
No |
nextval('limitlessctfexchange.status_id_seq'::regclass)
|
|
height
|
INTEGER |
No | — | |
hash
|
TEXT |
Yes | — | |
nonce
|
INTEGER |
Yes | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
status_pkey |
primary_key |
id |
— |
unified.template_instantiations
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
UUID |
No |
gen_random_uuid()
|
|
template_id
FK
|
UUID |
No | — |
References: unified.group_templates(id)
|
group_id
FK
|
UUID |
No | — |
References: unified.market_groups(id)
|
instantiated_at
|
TIMESTAMP |
Yes |
now()
|
|
instantiated_by
|
VARCHAR(100) |
Yes | — | |
instantiation_config
|
JSONB |
Yes |
'{}'::jsonb
|
Indexes
| Name | Columns | Type |
|---|---|---|
unique_template_group |
template_id, group_id |
Unique |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
template_instantiations_pkey |
primary_key |
id |
— |
template_instantiations_group_id_fkey |
foreign_key |
group_id |
— |
template_instantiations_template_id_fkey |
foreign_key |
template_id |
— |
unique_template_group |
unique |
template_id, group_id |
— |
Relationships
-
one-to-one to
market_groupsvia -
one-to-one to
group_templatesvia
limitlessctfexchange.token_registered
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
token0
|
NUMERIC |
No | — | |
token1
|
NUMERIC |
No | — | |
condition_id
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
token_registered_pkey |
primary_key |
id |
— |
limitlessctfexchange.token_registry
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
complement
|
NUMERIC |
No | — | |
condition_id
|
TEXT |
No | — | |
last_updated
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
token_registry_pkey |
primary_key |
id |
— |
limitlessctfexchange.trading_paused
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
pauser
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
trading_paused_pkey |
primary_key |
id |
— |
limitlessctfexchange.trading_unpaused
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
pauser
|
TEXT |
No | — | |
timestamp
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — | |
tx_hash
|
TEXT |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
trading_unpaused_pkey |
primary_key |
id |
— |
polymarket.transformed_markets
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
market_id
PK
|
VARCHAR(255) |
No | — | |
question
|
TEXT |
No | — | |
description
|
TEXT |
Yes | — | |
category
|
VARCHAR(255) |
Yes | — | |
status
|
VARCHAR(50) |
Yes | — | |
end_date
|
TIMESTAMP |
Yes | — | |
volume
|
NUMERIC(20, 8) |
Yes | — | |
liquidity
|
NUMERIC(20, 8) |
Yes | — | |
best_buy_price
|
NUMERIC(20, 8) |
Yes | — | |
best_buy_size
|
NUMERIC(20, 8) |
Yes | — | |
best_sell_price
|
NUMERIC(20, 8) |
Yes | — | |
best_sell_size
|
NUMERIC(20, 8) |
Yes | — | |
midpoint
|
NUMERIC(20, 8) |
Yes | — | |
spread
|
NUMERIC(20, 8) |
Yes | — | |
is_active
|
BOOLEAN |
Yes | — | |
created_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
updated_at
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
|
last_checked
|
TIMESTAMP |
Yes |
'2025-07-06 21:57:45.966909+00'::timestamp with time zone
|
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
transformed_markets_pkey |
primary_key |
market_id |
— |
limitlessctfexchange.user_state
Columns
| Name | Type | Nullable | Default | Description |
|---|---|---|---|---|
id
PK
|
VARCHAR |
No | — | |
is_admin
|
BOOLEAN |
No | — | |
is_operator
|
BOOLEAN |
No | — | |
nonce
|
NUMERIC |
No | — | |
proxy_wallet_address
|
TEXT |
Yes | — | |
safe_address
|
TEXT |
Yes | — | |
last_updated
|
TIMESTAMP |
No | — | |
block
|
INTEGER |
No | — |
Constraints
| Name | Type | Columns | Definition |
|---|---|---|---|
user_state_pkey |
primary_key |
id |
— |
Database Migrations
This section lists all database migrations that have been applied to the schema.
000_baseline_schema.sql
001_20251216_add_orderbook_snapshot_event_type.sql
002_20251217_add_builder_orders_table.sql