Databricks LTAP, Lakebase, and Real-Time Analytics for Institutional Market Liquidity Depth
Speaker background
The speaker moved from military combat engineering into institutional-grade trading and now provides market-liquidity depth analysis to international trading desks.
Combat engineering and institutional liquidity analysis share an operational discipline. A combat engineer evaluates terrain, load capacity, routes, obstacles, redundancy, failure points, and the time required to restore a passage. A liquidity analyst evaluates order-book depth, executable capacity, market impact, venue resilience, stale prices, fragmented routes, and the time required to enter or exit a position.
The core question is similar: can the route support the intended load under current conditions, and what happens if a critical component fails?
This guide builds a Databricks Free Edition prototype that combines transactional data capture, streaming market events, lakehouse analytics, and low-latency serving. It explains the relationship between online transaction processing, online analytical processing, Databricks Lake Transactional/Analytical Processing, Lakebase Postgres, Structured Streaming real-time mode, Lakehouse Real-Time, and Unity Catalog.
Scope of the prototype
The prototype records institutional market-liquidity observations and analyst decisions while continuously calculating market-depth indicators.
The workflow supports the following research activities:
- Record analyst watchlists, thresholds, notes, and investigation status as transactional data.
- Ingest synthetic or properly licensed market-depth events.
- Calculate spread, depth, imbalance, slippage, market impact, and liquidity-resilience indicators.
- Maintain current liquidity state and historical observations.
- Query governed Delta tables through Databricks SQL.
- Serve selected analytical results to a low-latency application database when Lakebase is available.
- Explain how production Lakehouse Real-Time can support sub-second analytical reads at high concurrency.
The prototype does not place orders, route trades, transfer funds, or connect to a production execution-management system. Free Edition is not a production trading platform.
Databricks Free Edition boundary
Databricks Free Edition is a perpetual, no-cost, serverless-only environment for learning and experimentation. The environment is quota-limited and does not include guaranteed reliability, support, or a service-level agreement.
Free Edition provides serverless notebook compute, one limited SQL warehouse, default storage, Unity Catalog capabilities, Databricks Apps, Lakeflow features, Genie, and access to Lakebase where enabled. Feature availability can vary by region, cloud, preview status, and workspace configuration.
Use Free Edition to prove the data model, streaming calculations, SQL logic, application workflow, and governance concepts. Move to a paid Databricks account before using confidential trading data, licensed real-time exchange feeds, material positions, counterparty information, client data, or operational decision workflows.
OLTP, OLAP, and LTAP
Online transaction processing, or OLTP, is optimized for frequent, small, concurrent changes. Examples include creating a watchlist, updating a liquidity threshold, acknowledging an alert, writing an analyst note, or changing the status of an investigation. An OLTP system normally requires low-latency inserts and updates, transaction isolation, indexes, primary keys, and predictable point lookups.
Online analytical processing, or OLAP, is optimized for scanning, filtering, joining, and aggregating large datasets. Examples include measuring average spread across a month, estimating slippage by order size, comparing venue resilience, calculating liquidity around an announcement, and identifying repeated periods of shallow depth.
Traditional architectures normally place OLTP data in PostgreSQL, MySQL, SQL Server, or Oracle and move copies into a warehouse or lakehouse using change data capture. That creates a synchronization pipeline, duplicated data, delay, operational cost, and governance complexity.
Databricks Lake Transactional/Analytical Processing, or LTAP, is an architecture that serves transactional and analytical workloads from a unified storage layer in the lake under one governance model. LTAP is not one product switch. It is implemented through Lakebase capabilities that separate PostgreSQL compute from durable cloud storage and make operational records available to lakehouse engines without maintaining the traditional second analytical copy.
Lakebase remains appropriate for row-oriented transactional access. Delta and Iceberg tables remain appropriate for large analytical scans. LTAP unifies the storage and governance layer while allowing each workload to use a suitable execution engine.
Lakebase role
Lakebase is a fully managed PostgreSQL service integrated with Databricks. It supports standard PostgreSQL clients and workflows, automatic scaling, scale to zero, instant branching, read replicas, point-in-time restore, high availability options, regional disaster recovery capabilities, Unity Catalog integration, and synchronization between PostgreSQL and lakehouse data.
For this use case, Lakebase stores operational application state such as watchlists, alert acknowledgements, analyst cases, threshold changes, and workflow status. The lakehouse stores large volumes of market events and derived historical metrics.
Lakebase can also serve selected Unity Catalog tables to an application for low-latency reads. PostgreSQL changes can be stored as Delta data for analytics and audit when the relevant capability is available.
A Free Edition Lakebase project should be treated as a learning resource. Scale-to-zero behavior, quotas, regional availability, and feature limits must be checked in the workspace.
Structured Streaming real-time mode
Structured Streaming traditionally processes events using micro-batches. A micro-batch collects records for a short interval and then processes them together. This model provides strong throughput and fault tolerance but adds scheduling and batch-boundary latency.
Databricks real-time mode refactors the execution path for lower latency and processes data continuously rather than waiting for normal micro-batch boundaries. Direct Structured Streaming real-time mode has compute and runtime requirements. Serverless real-time processing is provided through supported Lakeflow pipeline configurations, while direct API execution can require classic compute and an appropriate Databricks Runtime.
Because Free Edition is serverless-only, do not assume that every direct classic-compute real-time-mode example can run there. Build the Free Edition version with serverless-supported streaming or trigger modes, and treat specialized real-time mode as a production extension where the required Lakeflow or compute capability is enabled.
Lakehouse Real-Time role
Lakehouse Real-Time, also written Lakehouse//RT, is a serverless analytical warehouse designed for low-latency, high-concurrency reads against Unity Catalog tables stored in Delta Lake or Apache Iceberg formats.
The Beta documentation describes sub-second SQL read latency for hundreds to thousands of concurrent users. It is intended for operational analytics, custom applications, and BI dashboards. It requires a supported region and preview enablement and is not guaranteed to be available in Free Edition.
Do not confuse the two real-time capabilities:
- Structured Streaming real-time mode reduces event-processing latency.
- Lakehouse//RT reduces analytical query-serving latency and increases query concurrency.
A production architecture can use both. Streaming updates the current analytical state, and Lakehouse//RT serves that state to many users.
Step 1: Create and inspect the Free Edition workspace
Open the Databricks Free Edition sign-up page and create a workspace.
Use a project name that makes the non-production status explicit:
institutional_liquidity_ltap_free_nonprod
Open the workspace and confirm access to Workspace, Catalog, SQL Editor, SQL Warehouses, Jobs and Pipelines, and Lakebase where available.
Create a project directory:
/Workspace/Users/<your-user>/institutional_liquidity_ltap
Create these folders:
00_environment01_reference_data02_market_ingestion03_streaming_metrics04_lakebase05_sql_analytics06_application07_governance
Create a notebook named 00_environment_check.
Run:
SELECT
current_user() AS current_user,
current_catalog() AS current_catalog,
current_schema() AS current_schema,
current_timestamp() AS checked_at;
Record the Free Edition constraints in a README:
- The workspace is for learning and prototyping.
- Compute is serverless-only.
- Usage is subject to fair-use quotas.
- The SQL warehouse is limited.
- Applications and Lakebase resources can scale to zero.
- Preview capabilities might be unavailable.
- No production reliability or latency commitment applies.
Step 2: Define the institutional liquidity-depth model
Use a normalized event model. One market-depth event represents the observable state of one venue, instrument, and price level at one event time.
Required identifiers:
event_idevent_timereceived_timevenueinstrumentasset_classcurrencysidepricequantitylevel_numberevent_typesequence_numbersource_systemis_synthetic
Use event types such as SNAPSHOT, ADD, MODIFY, DELETE, and TRADE.
Store event time and receive time separately. Their difference is feed latency:
feed_latency_ms = received_time - event_time
Define top-of-book spread:
spread = best_ask - best_bid
Define spread in basis points:
spread_bps = (best_ask - best_bid) / midpoint * 10000
Define depth within a price-distance band:
bid_depth_10bps = sum(bid quantity where bid price >= midpoint * (1 - 0.001))
ask_depth_10bps = sum(ask quantity where ask price <= midpoint * (1 + 0.001))
Define order-book imbalance:
imbalance = (bid_depth - ask_depth) / (bid_depth + ask_depth)
The value normally ranges from negative one to positive one. A positive value indicates more modeled bid depth than ask depth in the selected band. It does not guarantee that price will rise.
Define estimated buy slippage for a target order size as the volume-weighted average execution price across ask levels minus the best ask. Define sell slippage using bid levels.
Define resilience after a shock:
resilience_seconds = first time depth returns to 80 percent of pre-shock depth - shock time
Treat 80 percent as a configurable research threshold rather than a universal market standard.
Define stale depth using both event age and sequence behavior. For a prototype, mark an instrument stale if no new event arrives for five seconds. For a real institutional feed, choose the threshold by venue, asset class, session, and contractual feed behavior.
Step 3: Create Unity Catalog objects
Open SQL Editor and select the Free Edition SQL warehouse.
Create a catalog and schemas. If the workspace does not permit catalog creation, use the default catalog and create the schemas there.
CREATE CATALOG IF NOT EXISTS market_liquidity;
CREATE SCHEMA IF NOT EXISTS market_liquidity.raw;
CREATE SCHEMA IF NOT EXISTS market_liquidity.silver;
CREATE SCHEMA IF NOT EXISTS market_liquidity.gold;
CREATE SCHEMA IF NOT EXISTS market_liquidity.reference;
CREATE SCHEMA IF NOT EXISTS market_liquidity.governance;
Create the raw event table:
CREATE TABLE IF NOT EXISTS market_liquidity.raw.depth_events (
event_id STRING,
event_time TIMESTAMP,
received_time TIMESTAMP,
venue STRING,
instrument STRING,
asset_class STRING,
currency STRING,
side STRING,
price DECIMAL(24,10),
quantity DECIMAL(24,8),
level_number INT,
event_type STRING,
sequence_number BIGINT,
source_system STRING,
is_synthetic BOOLEAN,
ingestion_time TIMESTAMP
) USING DELTA;
Create a venue reference table:
CREATE TABLE IF NOT EXISTS market_liquidity.reference.venues (
venue STRING,
jurisdiction STRING,
timezone STRING,
asset_class STRING,
market_open_local STRING,
market_close_local STRING,
expected_feed_interval_ms BIGINT,
source_license STRING,
active BOOLEAN,
reviewed_at TIMESTAMP
) USING DELTA;
Create an instrument reference table:
CREATE TABLE IF NOT EXISTS market_liquidity.reference.instruments (
instrument STRING,
asset_class STRING,
base_asset STRING,
quote_asset STRING,
tick_size DECIMAL(24,10),
lot_size DECIMAL(24,8),
contract_multiplier DECIMAL(24,8),
price_scale INT,
quantity_scale INT,
active BOOLEAN
) USING DELTA;
Create a quality issue table:
CREATE TABLE IF NOT EXISTS market_liquidity.governance.quality_issues (
issue_id STRING,
event_id STRING,
detected_at TIMESTAMP,
issue_type STRING,
issue_detail STRING,
severity STRING,
resolution_status STRING
) USING DELTA;
Step 4: Generate or upload safe market-depth data
Use synthetic data for the first prototype. Do not upload licensed exchange data to Free Edition unless the license and security policy explicitly allow it.
Create a CSV or JSON dataset with at least two venues, three instruments, both order-book sides, ten price levels, and several thousand timestamped updates.
For demonstration purposes, use synthetic instruments such as:
FX_USD_SGD_SIMFX_USD_KRW_SIMFUT_EQ_INDEX_SIM
Mark every event with is_synthetic = true.
Upload the file through Catalog Explorer or the notebook file interface.
Load the file into the raw Delta table. Adjust the uploaded path to the path shown by the workspace.
COPY INTO market_liquidity.raw.depth_events
FROM '/Volumes/market_liquidity/raw/uploads/depth_events'
FILEFORMAT = JSON
FORMAT_OPTIONS ('inferSchema' = 'true')
COPY_OPTIONS ('mergeSchema' = 'true');
If COPY INTO is not appropriate for the uploaded location, use a serverless notebook:
from pyspark.sql import functions as F
source_path = "/Volumes/market_liquidity/raw/uploads/depth_events"
raw_df = (
spark.read
.format("json")
.load(source_path)
.withColumn("ingestion_time", F.current_timestamp())
)
(raw_df.write
.format("delta")
.mode("append")
.saveAsTable("market_liquidity.raw.depth_events"))
Confirm the load:
SELECT
venue,
instrument,
COUNT(*) AS event_count,
MIN(event_time) AS first_event,
MAX(event_time) AS last_event
FROM market_liquidity.raw.depth_events
GROUP BY venue, instrument
ORDER BY venue, instrument;
Step 5: Apply market-feed quality controls
Create a validated view:
CREATE OR REPLACE VIEW market_liquidity.silver.depth_events_validated AS
SELECT
*,
timestampdiff(MILLISECOND, event_time, received_time) AS feed_latency_ms,
CASE
WHEN event_id IS NULL THEN 'MISSING_EVENT_ID'
WHEN event_time IS NULL THEN 'MISSING_EVENT_TIME'
WHEN received_time < event_time THEN 'NEGATIVE_FEED_LATENCY'
WHEN side NOT IN ('BID', 'ASK') THEN 'INVALID_SIDE'
WHEN price <= 0 THEN 'INVALID_PRICE'
WHEN quantity < 0 THEN 'INVALID_QUANTITY'
WHEN level_number < 1 THEN 'INVALID_LEVEL'
ELSE 'VALID'
END AS quality_status
FROM market_liquidity.raw.depth_events;
Check duplicate events:
SELECT event_id, COUNT(*) AS duplicate_count
FROM market_liquidity.raw.depth_events
GROUP BY event_id
HAVING COUNT(*) > 1;
Check sequence gaps:
WITH sequenced AS (
SELECT
venue,
instrument,
sequence_number,
LAG(sequence_number) OVER (
PARTITION BY venue, instrument
ORDER BY sequence_number
) AS previous_sequence_number
FROM market_liquidity.raw.depth_events
)
SELECT *
FROM sequenced
WHERE previous_sequence_number IS NOT NULL
AND sequence_number <> previous_sequence_number + 1;
A sequence gap can invalidate the reconstructed book. Do not fill it by assuming no change. Mark the instrument as requiring a fresh snapshot.
Check crossed or locked books after reconstruction. A crossed book has best bid greater than best ask. A locked book has equal best bid and best ask. These states can represent valid market conditions, feed timing, or reconstruction errors depending on the source. Preserve the evidence and apply source-specific rules.
Step 6: Create a Structured Streaming pipeline
Create a notebook named 03_streaming_liquidity_metrics.
Read new Delta events as a stream:
from pyspark.sql import functions as F
source = (
spark.readStream
.table("market_liquidity.raw.depth_events")
.filter("price > 0 AND quantity >= 0")
.withWatermark("event_time", "30 seconds")
)
Create a time-windowed liquidity aggregate:
windowed_depth = (
source
.groupBy(
F.window("event_time", "5 seconds", "1 second"),
"venue",
"instrument",
"side"
)
.agg(
F.sum("quantity").alias("observed_quantity"),
F.count("event_id").alias("event_count"),
F.max("received_time").alias("latest_received_time"),
F.max("sequence_number").alias("latest_sequence_number")
)
.select(
F.col("window.start").alias("window_start"),
F.col("window.end").alias("window_end"),
"venue",
"instrument",
"side",
"observed_quantity",
"event_count",
"latest_received_time",
"latest_sequence_number"
)
)
Write the streaming result:
query = (
windowed_depth.writeStream
.format("delta")
.outputMode("append")
.option(
"checkpointLocation",
"/Volumes/market_liquidity/raw/checkpoints/windowed_depth"
)
.trigger(processingTime="5 seconds")
.toTable("market_liquidity.silver.windowed_depth")
)
This Free Edition baseline uses a processing-time trigger. It remains a micro-batch implementation. It is appropriate for validating schemas, watermarks, checkpoints, and metrics, but it does not prove millisecond-level processing.
Keep the checkpoint path stable. Deleting a checkpoint can cause reprocessing or altered state behavior. Create a new checkpoint for material query changes.
Step 7: Calculate current depth and liquidity indicators
Create a top-of-book view from the latest valid observations:
CREATE OR REPLACE VIEW market_liquidity.gold.top_of_book AS
WITH ranked AS (
SELECT
venue,
instrument,
side,
price,
quantity,
event_time,
ROW_NUMBER() OVER (
PARTITION BY venue, instrument, side
ORDER BY event_time DESC, sequence_number DESC, level_number ASC
) AS row_number
FROM market_liquidity.silver.depth_events_validated
WHERE quality_status = 'VALID'
)
SELECT
venue,
instrument,
MAX(CASE WHEN side = 'BID' AND row_number = 1 THEN price END) AS best_bid,
MAX(CASE WHEN side = 'ASK' AND row_number = 1 THEN price END) AS best_ask,
MAX(CASE WHEN side = 'BID' AND row_number = 1 THEN quantity END) AS best_bid_quantity,
MAX(CASE WHEN side = 'ASK' AND row_number = 1 THEN quantity END) AS best_ask_quantity,
MAX(event_time) AS latest_event_time
FROM ranked
WHERE row_number = 1
GROUP BY venue, instrument;
Create spread metrics:
CREATE OR REPLACE VIEW market_liquidity.gold.spread_metrics AS
SELECT
*,
(best_bid + best_ask) / 2 AS midpoint,
best_ask - best_bid AS spread,
(best_ask - best_bid)
/ NULLIF((best_bid + best_ask) / 2, 0)
* 10000 AS spread_bps,
timestampdiff(SECOND, latest_event_time, current_timestamp()) AS age_seconds,
CASE
WHEN timestampdiff(SECOND, latest_event_time, current_timestamp()) > 5
THEN 'STALE'
WHEN best_bid > best_ask
THEN 'CROSSED'
WHEN best_bid = best_ask
THEN 'LOCKED'
ELSE 'NORMAL'
END AS market_state
FROM market_liquidity.gold.top_of_book;
Create a five-second depth-imbalance view:
CREATE OR REPLACE VIEW market_liquidity.gold.depth_imbalance AS
SELECT
window_start,
window_end,
venue,
instrument,
SUM(CASE WHEN side = 'BID' THEN observed_quantity ELSE 0 END) AS bid_depth,
SUM(CASE WHEN side = 'ASK' THEN observed_quantity ELSE 0 END) AS ask_depth,
(
SUM(CASE WHEN side = 'BID' THEN observed_quantity ELSE 0 END)
- SUM(CASE WHEN side = 'ASK' THEN observed_quantity ELSE 0 END)
) / NULLIF(SUM(observed_quantity), 0) AS imbalance
FROM market_liquidity.silver.windowed_depth
GROUP BY window_start, window_end, venue, instrument;
Do not interpret imbalance alone. Combine it with spread, absolute depth, event rate, cancellation rate, trade flow, volatility, venue status, and data quality.
Step 8: Estimate executable slippage
Create a parameter table containing representative institutional order sizes:
CREATE TABLE IF NOT EXISTS market_liquidity.reference.order_sizes (
instrument STRING,
order_size DECIMAL(24,8),
size_label STRING
) USING DELTA;
Example size labels can be SMALL, DESK_STANDARD, and STRESS_SIZE. The actual quantities must reflect the instrument contract, desk mandate, and venue liquidity.
For each candidate order size, walk the order-book levels from best to worst price until cumulative quantity reaches the target. Calculate the volume-weighted average execution price.
For a buy order:
buy_slippage_bps = (estimated_vwap - best_ask) / best_ask * 10000
For a sell order:
sell_slippage_bps = (best_bid - estimated_vwap) / best_bid * 10000
If the visible depth is less than the target order size, return INSUFFICIENT_VISIBLE_DEPTH. Do not extrapolate missing depth as zero impact.
Store these outputs in a gold table:
CREATE TABLE IF NOT EXISTS market_liquidity.gold.slippage_estimates (
calculation_time TIMESTAMP,
venue STRING,
instrument STRING,
side STRING,
target_quantity DECIMAL(24,8),
filled_quantity DECIMAL(24,8),
best_price DECIMAL(24,10),
estimated_vwap DECIMAL(24,10),
slippage_bps DECIMAL(18,6),
depth_status STRING,
source_event_time TIMESTAMP,
is_synthetic BOOLEAN
) USING DELTA;
Step 9: Create a Lakebase project
Open the app switcher and select Lakebase Postgres. If Lakebase is not displayed, the feature is not available in the current region or workspace. Continue with the Delta-only workflow and treat this step as a production extension.
Select Autoscaling and choose New project.
Use this name:
liquidity-operations-nonprod
Select the available PostgreSQL version.
Lakebase creates a production branch, a default databricks_postgres database, and branch compute. Scale to zero is enabled by default for the documented production branch configuration, with an inactivity timeout that can be adjusted where permitted.
Open the production branch and select Connect. Lakebase supports standard PostgreSQL clients such as psql, pgAdmin, DBeaver, and application frameworks.
For the browser-based prototype, open the Lakebase SQL Editor.
Create application tables:
CREATE SCHEMA IF NOT EXISTS liquidity_ops;
CREATE TABLE IF NOT EXISTS liquidity_ops.watchlist (
watchlist_id UUID PRIMARY KEY,
desk_name TEXT NOT NULL,
venue TEXT NOT NULL,
instrument TEXT NOT NULL,
max_spread_bps NUMERIC(12,4) NOT NULL,
min_visible_depth NUMERIC(24,8) NOT NULL,
stale_after_ms INTEGER NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
created_by TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS liquidity_ops.investigation_case (
case_id UUID PRIMARY KEY,
watchlist_id UUID REFERENCES liquidity_ops.watchlist(watchlist_id),
opened_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
opened_by TEXT NOT NULL,
case_status TEXT NOT NULL,
severity TEXT NOT NULL,
reason TEXT NOT NULL,
current_owner TEXT,
closed_at TIMESTAMPTZ
);
CREATE TABLE IF NOT EXISTS liquidity_ops.analyst_note (
note_id UUID PRIMARY KEY,
case_id UUID REFERENCES liquidity_ops.investigation_case(case_id),
note_text TEXT NOT NULL,
created_by TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
Add indexes for transactional access:
CREATE INDEX IF NOT EXISTS idx_watchlist_active
ON liquidity_ops.watchlist(active, venue, instrument);
CREATE INDEX IF NOT EXISTS idx_case_status
ON liquidity_ops.investigation_case(case_status, opened_at DESC);
CREATE INDEX IF NOT EXISTS idx_note_case
ON liquidity_ops.analyst_note(case_id, created_at DESC);
Use Lakebase for application state, not for storing every raw depth event. High-volume historical market events belong in Delta tables where analytical engines can scan and aggregate them efficiently.
Step 10: Connect Lakebase and the lakehouse
Where the capability is available, register or govern Lakebase resources through Unity Catalog.
Use one direction for each data class:
- PostgreSQL to Delta for watchlist, case, threshold, and audit changes that must be analyzed historically.
- Unity Catalog to PostgreSQL for selected current metrics that an application must retrieve with low latency.
Do not create uncontrolled bidirectional updates to the same business field. Define a system of record.
Recommended ownership:
- Lakebase owns watchlists, analyst cases, acknowledgements, and workflow state.
- Delta owns raw events, historical metrics, model outputs, and analytical aggregates.
- A served read model in Lakebase holds selected current liquidity summaries but is not the analytical system of record.
When PostgreSQL-to-Delta change storage is available, preserve inserts, updates, deletes, commit timestamps, and source identifiers. Use that history to answer questions such as:
- Which threshold was active when the alert fired?
- Who changed the watchlist?
- How long did a case remain unresolved?
- Which venues repeatedly breached depth requirements?
Step 11: Create a Lakebase development branch
In the Lakebase project, create a branch named:
feature-liquidity-thresholds
Use the branch to test schema changes without altering the production branch.
Example change:
ALTER TABLE liquidity_ops.watchlist
ADD COLUMN max_slippage_bps NUMERIC(12,4);
Test application queries and constraints on the branch. If the change is rejected, delete the branch. If accepted, apply the reviewed migration to the production branch through a controlled migration process.
Branching is useful for isolated database development. It does not remove the need for schema migration scripts, code review, data classification, or rollback planning.
Step 12: Add real-time mode as a production extension
The direct Structured Streaming real-time-mode setup requires supported compute and runtime conditions. Current documentation specifies Databricks Runtime 16.4 LTS or above for the direct API path, with autoscaling, Photon, and spot instances disabled. Some stream-to-stream join configurations require newer runtimes.
Free Edition is serverless-only, so use a supported Lakeflow real-time pipeline if the workspace exposes it. Otherwise, retain the micro-batch prototype and document that millisecond processing was not validated.
For an eligible production workspace, enable the appropriate preview or feature and use a supported source, sink, and operator set.
The real-time pipeline should perform only latency-sensitive transformations:
- Validate required fields.
- Deduplicate by venue, instrument, and sequence number.
- Reconstruct current state.
- Calculate top-of-book and bounded-depth metrics.
- Detect stale sequences and gaps.
- Publish compact current-state outputs.
Move large historical joins, long windows, and expensive model training to separate analytical pipelines. This prevents heavy computation from destabilizing the latency-sensitive path.
Measure end-to-end latency using event time, receive time, ingestion time, metric time, and application-display time. A low processing latency does not compensate for a slow external feed or delayed application refresh.
Step 13: Add Lakehouse Real-Time as a production extension
Lakehouse//RT is Beta and requires account or workspace enablement in a supported region. It cannot be assumed to exist in Free Edition.
In an eligible workspace, open Previews and enable Lakehouse RT.
Open Compute, select SQL Warehouses, and create a warehouse of type Real-Time.
Choose the query size based on the complexity of one query. Configure autoscaling based on projected concurrent users. Configure auto stop to control idle cost.
Use Lakehouse//RT for read-heavy endpoints such as:
- Current spread and depth by venue.
- Liquidity heatmaps across instruments.
- Slippage estimates by requested size.
- Stale-feed status.
- Venue comparison.
- Current alert context.
Do not use it as a substitute for Lakebase transactions. Lakehouse//RT serves analytical reads; Lakebase manages row-level transactional application state.
Test concurrency with realistic query shapes and user counts. The platform targets sub-second reads and high concurrency, but actual performance depends on table design, data volume, query complexity, cache state, concurrency, and warehouse configuration.
Step 14: Apply Unity Catalog governance
Use Unity Catalog to govern lakehouse tables, views, functions, volumes, lineage, and supported Lakebase integrations.
Create groups that reflect duties:
liquidity_data_engineersliquidity_analystsinternational_trading_desk_readersliquidity_risk_reviewers
Grant analysts access to curated gold views rather than unrestricted raw feeds.
Example:
GRANT USE CATALOG ON CATALOG market_liquidity
TO `liquidity_analysts`;
GRANT USE SCHEMA ON SCHEMA market_liquidity.gold
TO `liquidity_analysts`;
GRANT SELECT ON VIEW market_liquidity.gold.spread_metrics
TO `liquidity_analysts`;
GRANT SELECT ON VIEW market_liquidity.gold.depth_imbalance
TO `liquidity_analysts`;
Apply row filters or dynamic views when desks may only view approved venues or instruments.
Do not expose exchange credentials, broker secrets, private keys, or database passwords in notebooks. Use approved secret management in the production environment.
Preserve lineage from raw events to validated events, metrics, dashboards, and applications. Lineage supports incident analysis when a metric is challenged.
Step 15: Create the institutional liquidity workspace queries
Create a saved query for current spread exceptions:
SELECT
venue,
instrument,
latest_event_time,
spread_bps,
age_seconds,
market_state
FROM market_liquidity.gold.spread_metrics
WHERE spread_bps > 10
OR age_seconds > 5
OR market_state <> 'NORMAL'
ORDER BY
CASE market_state
WHEN 'CROSSED' THEN 1
WHEN 'STALE' THEN 2
WHEN 'LOCKED' THEN 3
ELSE 4
END,
spread_bps DESC;
Create a saved query for imbalance extremes:
SELECT
window_end,
venue,
instrument,
bid_depth,
ask_depth,
imbalance
FROM market_liquidity.gold.depth_imbalance
WHERE ABS(imbalance) >= 0.60
ORDER BY window_end DESC, ABS(imbalance) DESC;
Create a saved query for slippage stress:
SELECT
calculation_time,
venue,
instrument,
side,
target_quantity,
filled_quantity,
slippage_bps,
depth_status,
source_event_time
FROM market_liquidity.gold.slippage_estimates
WHERE depth_status <> 'COMPLETE'
OR slippage_bps > 15
ORDER BY calculation_time DESC;
The 10-basis-point spread, 0.60 imbalance, and 15-basis-point slippage values are prototype thresholds. Replace them with instrument-specific limits approved by the desk and risk function.
Step 16: Build a Databricks App
Create a Databricks App named:
Institutional Liquidity Depth Console
Use Lakebase for user-managed watchlists and investigation cases. Use governed Databricks SQL or a supported serving layer for analytical liquidity metrics.
The application should provide:
- Venue and instrument filters.
- Best bid, best ask, midpoint, and spread.
- Visible depth by configurable distance from midpoint.
- Order-book imbalance.
- Estimated slippage for configured order sizes.
- Feed age and sequence-gap state.
- Watchlist threshold management.
- Case creation and analyst notes.
Keep the application read-only with respect to trading and execution systems. Do not include order-entry, smart-order-routing, payment, withdrawal, or position-changing controls.
When the app writes a watchlist change, write it transactionally to Lakebase. When it displays a historical or aggregated metric, read it from a governed lakehouse view or an approved low-latency served copy.
Make market-state labels explicit:
NORMALLOCKEDCROSSEDSTALESEQUENCE_GAPINSUFFICIENT_VISIBLE_DEPTHSYNTHETIC_DATA
Step 17: Validate the analytical logic
Validate spread calculations with a worked example.
If best bid is 100.00 and best ask is 100.04, midpoint is 100.02. Spread is 0.04. Spread in basis points is approximately 3.9992.
Validate imbalance.
If bid depth is 12 million units and ask depth is 8 million units:
imbalance = (12 - 8) / (12 + 8) = 0.20
This indicates 20 percent net bid-depth imbalance under the chosen aggregation rule. It does not establish trade direction.
Validate buy slippage.
If the ask book contains 2 million at 100.04, 3 million at 100.05, and 5 million at 100.07, a 6 million buy consumes all of the first two levels and 1 million of the third.
Estimated VWAP:
((2 * 100.04) + (3 * 100.05) + (1 * 100.07)) / 6 = 100.051667
Slippage from best ask:
(100.051667 - 100.04) / 100.04 * 10000 ≈ 1.1662 bps
Repeat validation for partial depth, zero depth, crossed books, duplicate events, out-of-order events, late events, sequence gaps, and stale feeds.
Step 18: Operate the prototype
Start each session by confirming that the workspace is within its quota and the SQL warehouse is running.
Run the environment check and inspect the latest raw event timestamp.
Load or append the synthetic event set.
Start the streaming notebook or pipeline. Confirm that the checkpoint is writable and the silver table is receiving rows.
Run the quality queries. If sequence gaps or invalid records appear, mark the affected instrument and do not present its calculated depth as complete.
Refresh the gold views and inspect spread, imbalance, and slippage outputs.
If Lakebase is available, create a watchlist and an investigation case. Confirm that the row appears immediately in PostgreSQL.
If Lakebase change storage is enabled, confirm that the application change becomes available to lakehouse analytics with the expected history and timestamps.
Stop or allow idle resources to scale to zero when the session ends.
Step 19: Understand the architecture trade-offs
Lakebase is optimized for transactions, but it should not become the raw tick-history warehouse. Writing every depth event into an application PostgreSQL table can create avoidable index, vacuum, storage, and read-replica pressure.
Delta tables are optimized for analytical history, but they are not a substitute for a transactional application database that requires frequent row updates, constraints, point lookups, and low-latency commits.
Structured Streaming provides continuous processing semantics, but low processor latency does not guarantee low end-to-end latency. Exchange feed delay, network delay, watermarking, state management, sink commit time, SQL refresh, and client rendering all contribute.
Lakehouse//RT can reduce analytical query latency, but it does not make an incorrect metric correct. Poor event reconstruction, missing sequence handling, stale data, and bad instrument reference data remain primary risks.
LTAP reduces synchronization and governance complexity, but it does not mean that one compute engine is best for every workload. The architecture retains PostgreSQL execution for OLTP and lakehouse execution for OLAP.
Step 20: Move from Free Edition to an institutional environment
Create separate development, test, and production workspaces.
Use a supported cloud region aligned with data-residency, exchange-license, and business-continuity requirements.
Implement account-level identity federation, single sign-on, group-based access, service principals, private networking, audit-log delivery, customer-managed encryption where required, secrets management, and centralized Unity Catalog governance.
Deploy licensed market-data connectors and validate contractual entitlements for storage, derived data, display, archival, and redistribution.
Configure Lakebase high availability and regional disaster recovery according to the application recovery-time and recovery-point objectives. Cross-region disaster recovery is a capability that must be explicitly designed and tested. It is not implied by creating a Free Edition database.
Adopt a broker-independent execution boundary. The liquidity system may publish analysis and approved alerts, but execution must pass through the firm’s controlled order-management, risk, compliance, and execution architecture.
Benchmark the production system with realistic event rates, instrument counts, depth levels, late-event patterns, concurrent users, and analytical queries. Record p50, p95, and p99 latency separately for ingestion, calculation, query serving, and application display.
Failure modes to monitor
A sequence-gap failure occurs when the system continues reconstructing the book after missing an event. Require a fresh snapshot.
An out-of-order failure occurs when a late event overwrites a newer state. Use sequence numbers and event-time rules.
A stale-feed failure occurs when the last valid book remains visible without an age warning. Display the age and block stale analysis.
A duplicate-event failure occurs when replayed records inflate event counts or depth. Deduplicate using source identifiers and sequence semantics.
A unit failure occurs when quantities, contract multipliers, currencies, or decimal scales differ across venues. Normalize through governed instrument reference data.
A visible-depth failure occurs when displayed book quantity is assumed to be fully executable. Account for queue position, cancellations, hidden liquidity, venue rules, fees, and market impact.
A latency-claim failure occurs when micro-batch results are described as millisecond real time. Measure and label the actual processing mode.
A Free Edition failure occurs when quota shutdown, scale to zero, or missing preview features interrupt the demonstration. Preserve notebooks, data definitions, and restart instructions.
How the components work together
Lakebase handles operational transactions such as watchlists, cases, notes, and thresholds.
Structured Streaming transforms continuous market events and maintains near-current liquidity metrics.
Delta Lake stores the historical event and metric record for large-scale analysis.
Lakehouse//RT serves governed analytical data with low latency and high concurrency when enabled in a production workspace.
Unity Catalog governs access, definitions, lineage, and supported cross-system resources.
LTAP reduces the traditional separation between the transactional application and analytical lakehouse by using a unified storage and governance architecture while retaining fit-for-purpose execution engines.
For an international trading desk, the result is a controlled liquidity-depth platform that answers not only where the best price appears, but whether displayed depth is fresh, reconstructable, sufficiently large, resilient, and usable for the intended order size.
References
- Databricks Free Edition overview
- Databricks Free Edition limitations
- Lakebase Postgres
- Create a Lakebase Postgres database
- Lakebase PostgreSQL compatibility and features
- Databricks LTAP architecture
- Lakebase and LTAP engineering architecture
- Lakehouse Real-Time
- Structured Streaming real-time-mode setup
About Vertex Macro
https://vertexmacro.com/
Vertex Macro is a premier, founder-led boutique investment firm advising sophisticated institutional partners and private capital networks. The firm translates complex macroeconomic shifts into disciplined portfolio execution by anchoring its methodology in proprietary causal research, cross-asset risk transmission, and enduring structural drivers. Built on institutional-grade risk governance, Vertex Macro enforces rigorous exit protocols and liquidity controls to safeguard capital stability—dedicating its mandate to long-term capital preservation, disciplined compounding, and asymmetric resilience across market cycles.
About Frontier Macro
https://frontiertechcap.com/
Frontier Macro is an institutional investment management platform engineered for consistent return-path performance through precision risk budgeting and systematic execution. By distilling global macro complexity into a continuously monitored transmission framework—spanning energy markets, inflation expectations, rate regimes, and systemic liquidity—the strategy proactively calibrates portfolio exposure to sustain smooth compounding and structural resilience across all market regimes. Operating with strict regulatory discretion and institutional confidentiality, Frontier Macro enforces objective, rule-based risk triggers governed purely by systematic market thresholds, delivering disciplined portfolio governance for discerning capital allocators.
About Hong Kong Databricks FSI Group
https://usergroups.databricks.com/hong-kong-databricks-fsi-group/
The Hong Kong Databricks FSI Group is an exclusive, practitioner-led executive and technical forum uniting senior data leaders, quantitative architects, and technologists across Hong Kong’s premier capital markets, banking, and insurance institutions. Dedicated to advancing governed data and enterprise AI architectures on Databricks, the forum facilitates high-caliber peer exchange through technical briefings, architectural labs, and curated industry networking. As an independent, practitioner-driven consortium, its programming is shaped directly by the real-world priorities and institutional expertise of the region's leading financial services professionals.
About Y Combinator Stack AI + APP Builders
https://vertexmacro.com/events/ai_app_builders/yc_stack_ai_app_builders.html
Y Combinator Stack AI + APP Builders is a six-part enterprise AI event series based in Hong Kong designed for senior engineers, platform architects, and technical builders creating context-aware, memory-enabled, and research-ready production agents. The technical sessions explore end-to-end agentic architectures across unified enterprise context with Hyperspell, persistent cross-session memory with Mem0, real-time web-to-LLM ingestion pipelines with Firecrawl, observable voice workflows with Vapi, intent-aware neural research with Exa, and rapid product prototyping with Magic Patterns. Combining modular system patterns, governance controls, and practical integration blueprints, the series equips enterprise teams to assemble scalable, governed AI applications across the modern data stack.
About MongoDB AI + APP Builders
https://vertexmacro.com/events/ai_app_builders/mongodb_ai_app_builders.html
MongoDB AI + APP Builders is a five-part enterprise architecture event series designed for senior engineers, platform architects, and technical leaders building secure AI agents and high-performance applications. Its focused technical sessions explore production-grade data architectures across automated security defense, ultra-low-latency situational awareness, active-active database migration, dynamic XDR rule engines, and Domain-Driven Design mid-platform refactoring. Combining concrete architectural patterns, performance benchmarks, and governance controls, the series equips enterprise teams with practical implementation lessons to accelerate delivery cycles and scale modern data stacks in complex, real-world production environments.
Top comments (0)