Databricks Lakeflow Designer and Lakeflow Connect for Trading Desk Risk and Action Tracking

Agenda

  1. Speaker background
  2. Important control boundary
  3. Lakeflow Designer and Lakeflow Connect
  4. Step 1: Create the Databricks Free Edition workspace
  5. Step 2: Define the desk-control operating model
  6. Step 3: Set concrete prototype thresholds
  7. Step 4: Create the Unity Catalog data model
  8. Step 5: Create raw event tables
  9. Step 6: Create the manager action ledger
  10. Step 7: Connect data sources with Lakeflow Connect
  11. Step 8: Enable source lineage
  12. Step 9: Build the visual preparation in Lakeflow Designer
  13. Step 10: Normalize orders and executions visually
  14. Step 11: Build stop-loss monitoring
  15. Step 12: Detect unauthorized averaging down
  16. Step 13: Monitor VaR and sensitivities
  17. Step 14: Detect fat-finger orders
  18. Step 15: Detect algorithm loops and runaway activity
  19. Step 16: Investigate hidden positions
  20. Step 17: Detect wash-trade and spoofing indicators
  21. Step 18: Build the manager action workflow
  22. Step 19: Handle extreme market conditions
  23. Step 20: Adapt quickly with the drag-and-drop interface
  24. Step 21: Build the trading-desk control dashboard
  25. Step 22: Use lineage to challenge concealed activity
  26. Step 23: Apply Unity Catalog security
  27. Step 24: Validate the control calculations
  28. Step 25: Operate the control workflow
  29. Lessons learned
  30. Important failure modes
  31. References

Key Takeaway

The speaker moved from hotel front-desk management into a trading-desk line-management role responsible for controlling desk risk, handling abnormal trading decisions, and protecting firm capital.

Speaker background

The speaker moved from hot ➔ A hotel front-desk manager ➔ A trading-desk line manage ➔ This guide uses Lakeflow D

The speaker moved from hotel front-desk management into a trading-desk line-management role responsible for controlling desk risk, handling abnormal trading decisions, and protecting firm capital.

A hotel front-desk manager operates a live control point. The manager handles arrivals, departures, payments, room allocation, complaints, unusual behavior, shift handovers, safety escalation, and coordination with housekeeping, security, engineering, and finance. The desk must record what happened, who acted, when the action occurred, and whether the issue was resolved.

A trading-desk line manager performs a similar control function under much higher financial speed and consequence. The manager watches losses, position concentration, Value at Risk, DV01, Delta, Gamma, Vega, liquidity, order behavior, trader conduct, and system health. When an abnormal condition appears, the manager must distinguish a valuation problem, a temporary market move, an operational error, an algorithm failure, and an actual limit or conduct breach.

This guide uses Lakeflow Designer and Lakeflow Connect to create a governed action-tracking prototype. The system records risk observations, trader explanations, limit changes, stop-loss decisions, hedge instructions, kill-switch events, cancellations, compliance referrals, and case closure. Unity Catalog lineage makes it harder to hide an exposure by moving it through an unapproved account, virtual portfolio, or over-the-counter derivative source.

Important control boundary

Databricks Free Edition is ➔ Use synthetic orders, posi ➔ The prototype detects, rec ➔ A production kill switch m

Databricks Free Edition is a perpetual, no-cost, serverless-only cloud environment for learning and prototyping. It is quota-limited and has no production service-level agreement.

Use synthetic orders, positions, prices, limits, P&L, risk sensitivities, accounts, and users. Do not connect Free Edition to a live order-management system, execution venue, exchange gateway, broker account, production risk system, market-data license, or actual kill switch.

The prototype detects, records, explains, and escalates risk. It must not autonomously submit, amend, or cancel an order; flatten a position; change a production limit; disable a trader; widen a live market-making spread; or contact an exchange.

A production kill switch must remain in the approved execution, order-management, or pre-trade risk platform with deterministic controls, authorized operators, tested recovery procedures, and exchange or broker connectivity. Databricks can provide the governed evidence and workflow context, but it should not be the only enforcement layer for a time-critical hard stop.

Lakeflow Designer and Lakeflow Connect

Lakeflow Connect focuses o ➔ Lakeflow Designer is a vis ➔ Lakeflow Designer is not s ➔ Lakeflow Connect automatic ➔ Lineage is an important de

Lakeflow Connect focuses on managed ingestion. It supports database, SaaS, file, streaming, community, and custom connector patterns. Managed connectors use Unity Catalog connections and write incrementally into governed Delta streaming tables. Database options include CDC patterns for systems such as PostgreSQL, MySQL, Microsoft SQL Server, and Oracle. SaaS and enterprise-source patterns include systems such as Salesforce, Workday, HubSpot, Jira, Google Drive, and SharePoint, depending on availability and release state.

Lakeflow Designer is a visual, no-code, AI-native data-preparation experience. Users build visual data preps by placing source, filter, join, transform, aggregate, and output operators on a drag-and-drop canvas. Each visual workflow is backed by generated code, can be versioned in Git, and can be scheduled as a job.

Lakeflow Designer is not simply a picture of a pipeline. The generated workflow remains governed through Unity Catalog, and each operator can be previewed before the entire workflow is run. This makes it useful when a risk manager needs to change thresholds, add a new source, or isolate a new abnormal-trading pattern quickly.

Lakeflow Connect automatically records source lineage for supported managed ingestion pipelines. It creates Unity Catalog external metadata for source objects and links source columns to destination Delta columns. Unity Catalog extends that lineage through downstream queries, jobs, dashboards, and notebooks.

Lineage is an important detective control, not proof that every position is complete. A hidden position can still exist outside all connected systems. The organization must reconcile against independent broker, clearing, custodian, confirmation, settlement, and general-ledger records.

Step 1: Create the Databricks Free Edition workspace

Create a Databricks Free E ➔ trading_desk_risk_control_ ➔ Create these folders: ➔ 00_environment ➔ 01_source_connections

Create a Databricks Free Edition workspace and name the project:

trading_desk_risk_control_free_nonprod

Create these folders:

  • 00_environment
  • 01_source_connections
  • 02_orders_and_executions
  • 03_positions_and_risk
  • 04_limits_and_controls
  • 05_abnormal_trading
  • 06_manager_actions
  • 07_lineage_and_reconciliation
  • 08_dashboards

Create a notebook named 00_environment_check and run:

SELECT
  current_user() AS current_user,
  current_catalog() AS current_catalog,
  current_schema() AS current_schema,
  current_timestamp() AS checked_at;

Record these constraints in the project README:

  • Synthetic data only.
  • Serverless-only compute.
  • Fair-use quotas can stop compute.
  • No production SLA.
  • No direct order or market connectivity.
  • No production kill-switch control.
  • No real trader disciplinary decision based only on the prototype.

Step 2: Define the desk-control operating model

Define the controlled enti ➔ A trader is identified by ➔ An account is identified b ➔ An order is the instructio ➔ A risk snapshot contains P

Define the controlled entities before building pipelines.

A trader is identified by a stable enterprise identity and desk assignment.

An account is identified by legal entity, desk, strategy, book, broker, venue, currency, product, and account type.

An order is the instruction submitted to buy or sell. An execution is a fill against an order. A position is the accumulated exposure after confirmed executions and position adjustments.

A risk snapshot contains P&L, VaR, DV01, Delta, Gamma, Vega, notional, gross exposure, net exposure, liquidity-adjusted exposure, stress loss, and concentration at a defined timestamp.

A limit is a controlled threshold with an owner, effective period, approval record, warning level, hard-stop level, and measurement unit.

An action is a manager or control decision such as request explanation, reduce position, hedge exposure, suspend strategy, disable an algorithm, invoke a production kill switch, request cancellations, refer to compliance, or close a case.

Every action record must preserve the actor, timestamp, reason, evidence, authorization, affected trader, affected book, related alert, status, and external control-system reference.

Step 3: Set concrete prototype thresholds

Use synthetic thresholds t ➔ Example daily-loss rules: ➔ Warning line: 60 percent o ➔ Escalation line: 80 percen ➔ Hard stop: 100 percent of

Use synthetic thresholds to exercise the workflow. Replace them with desk-approved values in a controlled production implementation.

Example daily-loss rules:

  • Warning line: 60 percent of the daily loss limit.
  • Escalation line: 80 percent of the daily loss limit.
  • Hard stop: 100 percent of the daily loss limit.

Example monthly drawdown rules:

  • Warning line: 70 percent.
  • Escalation line: 85 percent.
  • Hard stop: 100 percent.

Example order anomaly rules:

  • Order notional exceeds 150 percent of the trader's approved single-order limit.
  • Order quantity exceeds 10 times the trader's trailing 20-day median order size.
  • Limit price is more than 50 basis points from the approved reference price for a liquid instrument.
  • More than 100 new orders are generated in one second by one algorithm.
  • More than 1,000 orders are generated in one minute by one algorithm.
  • Cancel-to-fill ratio exceeds the desk threshold within a rolling interval.
  • Repeated opposite-side orders create potential wash-trade or spoofing concerns.

These are training examples, not universal thresholds. A 50-basis-point deviation can be normal in an illiquid instrument and catastrophic in a highly liquid short-dated government bond. Thresholds must be specific to asset class, venue, session, volatility regime, and order type.

Step 4: Create the Unity Catalog data model

Open SQL Editor and create ➔ If catalog creation is una ➔ Create a trader reference ➔ Create an account registry ➔ Create a limit table:

Open SQL Editor and create the catalog and schemas:

CREATE CATALOG IF NOT EXISTS desk_control;

CREATE SCHEMA IF NOT EXISTS desk_control.raw;
CREATE SCHEMA IF NOT EXISTS desk_control.silver;
CREATE SCHEMA IF NOT EXISTS desk_control.gold;
CREATE SCHEMA IF NOT EXISTS desk_control.reference;
CREATE SCHEMA IF NOT EXISTS desk_control.governance;
CREATE SCHEMA IF NOT EXISTS desk_control.actions;

If catalog creation is unavailable, create the schemas in the default catalog.

Create a trader reference table:

CREATE TABLE IF NOT EXISTS desk_control.reference.traders (
  trader_id STRING,
  trader_name STRING,
  desk STRING,
  line_manager_id STRING,
  legal_entity STRING,
  employment_status STRING,
  trading_status STRING,
  effective_from TIMESTAMP,
  effective_to TIMESTAMP
) USING DELTA;

Create an account registry:

CREATE TABLE IF NOT EXISTS desk_control.reference.accounts (
  account_id STRING,
  legal_entity STRING,
  desk STRING,
  strategy STRING,
  book STRING,
  broker STRING,
  venue STRING,
  account_type STRING,
  approved BOOLEAN,
  effective_from TIMESTAMP,
  effective_to TIMESTAMP
) USING DELTA;

Create a limit table:

CREATE TABLE IF NOT EXISTS desk_control.governance.risk_limits (
  limit_id STRING,
  trader_id STRING,
  desk STRING,
  book STRING,
  limit_type STRING,
  warning_value DECIMAL(24,8),
  escalation_value DECIMAL(24,8),
  hard_stop_value DECIMAL(24,8),
  limit_unit STRING,
  approved_by STRING,
  effective_from TIMESTAMP,
  effective_to TIMESTAMP
) USING DELTA;

Step 5: Create raw event tables

Create a raw order table: ➔ Create executions: ➔ Create position and risk s

Create a raw order table:

CREATE TABLE IF NOT EXISTS desk_control.raw.orders (
  source_system STRING,
  order_id STRING,
  parent_order_id STRING,
  event_time TIMESTAMP,
  received_time TIMESTAMP,
  trader_id STRING,
  account_id STRING,
  algo_id STRING,
  instrument_id STRING,
  side STRING,
  order_type STRING,
  quantity DECIMAL(24,8),
  limit_price DECIMAL(24,10),
  order_status STRING,
  venue STRING,
  source_sequence BIGINT,
  is_synthetic BOOLEAN,
  ingested_at TIMESTAMP
) USING DELTA;

Create executions:

CREATE TABLE IF NOT EXISTS desk_control.raw.executions (
  execution_id STRING,
  order_id STRING,
  execution_time TIMESTAMP,
  trader_id STRING,
  account_id STRING,
  instrument_id STRING,
  side STRING,
  executed_quantity DECIMAL(24,8),
  executed_price DECIMAL(24,10),
  venue STRING,
  broker STRING,
  is_synthetic BOOLEAN,
  ingested_at TIMESTAMP
) USING DELTA;

Create position and risk snapshots:

CREATE TABLE IF NOT EXISTS desk_control.raw.risk_snapshots (
  snapshot_time TIMESTAMP,
  trader_id STRING,
  account_id STRING,
  book STRING,
  instrument_id STRING,
  currency STRING,
  position_quantity DECIMAL(24,8),
  market_value DECIMAL(24,2),
  daily_pnl DECIMAL(24,2),
  monthly_pnl DECIMAL(24,2),
  var_99_1d DECIMAL(24,2),
  dv01 DECIMAL(24,2),
  delta_value DECIMAL(24,2),
  gamma_value DECIMAL(24,2),
  vega_value DECIMAL(24,2),
  stress_loss DECIMAL(24,2),
  source_system STRING,
  is_synthetic BOOLEAN,
  ingested_at TIMESTAMP
) USING DELTA;

Step 6: Create the manager action ledger

Create an append-oriented ➔ Use action types such as: ➔ REQUEST_EXPLANATION ➔ REDUCE_POSITION ➔ HEDGE_EXPOSURE

Create an append-oriented action ledger:

CREATE TABLE IF NOT EXISTS desk_control.actions.manager_action_ledger (
  action_id STRING,
  case_id STRING,
  alert_id STRING,
  action_time TIMESTAMP,
  actor_id STRING,
  actor_role STRING,
  trader_id STRING,
  desk STRING,
  book STRING,
  action_type STRING,
  action_reason STRING,
  requested_state STRING,
  confirmed_state STRING,
  authorization_reference STRING,
  external_system_reference STRING,
  evidence_uri STRING,
  action_status STRING,
  is_synthetic BOOLEAN,
  recorded_at TIMESTAMP
) USING DELTA;

Use action types such as:

  • REQUEST_EXPLANATION
  • REDUCE_POSITION
  • HEDGE_EXPOSURE
  • FREEZE_NEW_RISK
  • DISABLE_ALGO_REQUEST
  • KILL_SWITCH_REQUEST
  • CANCEL_ORDER_REQUEST
  • MARKET_MAKING_PAUSE_REQUEST
  • WIDEN_SPREAD_APPROVAL
  • COMPLIANCE_REFERRAL
  • MIDDLE_OFFICE_REVIEW
  • CASE_CLOSE

The ledger records the requested action and its confirmed external state separately. A request to activate a kill switch is not proof that the execution platform completed it.

Step 7: Connect data sources with Lakeflow Connect

Open Lakeflow Connect or A ➔ Create separate Unity Cata ➔ Order-management database. ➔ Execution-management datab ➔ Risk-engine database.

Open Lakeflow Connect or Add Data.

Create separate Unity Catalog connections for each approved source:

  • Order-management database.
  • Execution-management database.
  • Risk-engine database.
  • Market-data or reference-price source.
  • Trader and organization master.
  • Limit-management database.
  • Broker or clearing reconciliation files.
  • Compliance case-management system.

In Free Edition, use uploaded synthetic files or query-based sources that are available from serverless compute. Managed database CDC connectors can require a continuously running classic-compute ingestion gateway, so they are not a complete Free Edition path.

For a query-based connector, choose a timestamp or integer cursor that increases whenever a record changes. Use a stable primary key and validate late-arriving update behavior.

For production PostgreSQL, MySQL, Microsoft SQL Server, or Oracle sources, use managed CDC where supported and approved. The CDC gateway captures snapshots and source change logs, staging storage buffers the captured data, and a serverless ingestion pipeline applies changes to destination streaming tables.

Name each connection and pipeline explicitly:

oms_prod_orders_connection

ems_prod_executions_connection

risk_prod_snapshots_connection

lfc_oms_orders_to_desk_control_raw

lfc_ems_executions_to_desk_control_raw

lfc_risk_snapshots_to_desk_control_raw

Do not reuse one high-privilege database credential across all systems.

Step 8: Enable source lineage

Grant the pipeline identit ➔ After a managed ingestion ➔ Confirm that the source ob ➔ Lakeflow Connect lineage c ➔ Verify lineage from:

Grant the pipeline identity the required Unity Catalog privileges, including CREATE EXTERNAL METADATA where source-lineage creation requires it.

After a managed ingestion update completes, open Catalog Explorer, select a destination table, and open the Lineage tab.

Confirm that the source object appears as external metadata and that source-to-destination column mappings are present.

Lakeflow Connect lineage creation is best effort. A pipeline can continue even if lineage metadata fails because of a missing privilege. Treat missing lineage as a control issue and repair the permission before the next update.

Verify lineage from:

  • Source order table to raw orders.
  • Raw orders to normalized orders.
  • Normalized orders to abnormal-order alerts.
  • Alerts to the risk dashboard.
  • Alerts to manager actions.

Lineage should show where evidence came from. It does not confirm that a source system itself was complete or truthful.

Step 9: Build the visual preparation in Lakeflow Designer

Open Lakeflow Designer and ➔ trading_desk_risk_control_ ➔ Add a Source operator for

Open Lakeflow Designer and create a visual data prep named:

trading_desk_risk_control_prep

Add a Source operator for desk_control.raw.orders.

Add a Source operator for desk_control.raw.executions.

Add a Source operator for desk_control.raw.risk_snapshots.

Add a Source operator for desk_control.reference.traders.

Add a Source operator for desk_control.reference.accounts.

Add a Source operator for desk_control.governance.risk_limits.

Designer can also create external database connections for supported systems, but for a governed production pattern, ingest operational data into Unity Catalog first and use those governed tables as visual-prep sources.

Preview each source. Confirm timestamp types, quantities, prices, account IDs, trader IDs, and synthetic flags.

Step 10: Normalize orders and executions visually

From the order source, add ➔ Add a Transform operator t ➔ Order notional. ➔ Receive latency. ➔ Absolute price distance fr

From the order source, add a Filter operator that keeps records with non-null order ID, event time, trader ID, account ID, instrument, side, and quantity.

Add a Transform operator that standardizes side values to BUY and SELL.

Add a Transform operator that calculates:

  • Order notional.
  • Receive latency.
  • Absolute price distance from the approved reference price.
  • Price distance in basis points.
  • Event count by algorithm and time window.

Add a Join operator connecting orders to the trader master by trader_id and effective time.

Add another Join operator connecting orders to the approved-account registry by account_id and effective time.

Create flags:

  • UNKNOWN_TRADER
  • UNAPPROVED_ACCOUNT
  • INACTIVE_ACCOUNT
  • UNKNOWN_BOOK
  • MISSING_LIMIT
  • NEGATIVE_OR_ZERO_QUANTITY
  • STALE_REFERENCE_PRICE

Write valid normalized orders to:

desk_control.silver.orders_normalized

Write invalid or unresolved records to:

desk_control.governance.order_quarantine

Step 11: Build stop-loss monitoring

Add a visual branch from r ➔ Aggregate daily P&L by tra ➔ Join to the active daily-l ➔ Calculate loss utilization ➔ loss_utilization_pct = abs

Add a visual branch from risk snapshots.

Aggregate daily P&L by trader and desk.

Join to the active daily-loss limit.

Calculate loss utilization:

loss_utilization_pct = abs(min(daily_pnl, 0)) / hard_stop_value * 100

Classify the status:

CASE
  WHEN daily_pnl >= 0 THEN 'NORMAL'
  WHEN ABS(daily_pnl) >= hard_stop_value THEN 'HARD_STOP'
  WHEN ABS(daily_pnl) >= escalation_value THEN 'ESCALATE'
  WHEN ABS(daily_pnl) >= warning_value THEN 'WARNING'
  ELSE 'NORMAL'
END

Write the result to:

desk_control.gold.trader_stop_loss_status

A hard-stop row should trigger an urgent workflow notification and create a case. It should not directly flatten a live position from Databricks.

The line manager must verify current P&L, confirmed positions, market liquidity, existing hedges, and external control state before selecting the production response.

Step 12: Detect unauthorized averaging down

For a long position, avera ➔ Averaging is not automatic ➔ Detect long-side averaging ➔ Enhance the logic with cur

For a long position, averaging down means adding quantity after the market price falls below the existing average cost. For a short position, it means adding short quantity after the market price rises above average cost.

Averaging is not automatically misconduct. It becomes a control problem when it breaches a limit, violates an approved strategy, occurs after a freeze-new-risk instruction, or is used to conceal or defer a loss.

Detect long-side averaging after a warning:

SELECT
  o.trader_id,
  o.account_id,
  o.instrument_id,
  o.event_time,
  o.quantity,
  o.limit_price,
  s.status AS stop_loss_status
FROM desk_control.silver.orders_normalized o
JOIN desk_control.gold.trader_stop_loss_status s
  ON o.trader_id = s.trader_id
WHERE o.side = 'BUY'
  AND s.status IN ('WARNING', 'ESCALATE', 'HARD_STOP')
  AND o.event_time >= s.status_time;

Enhance the logic with current position direction, average cost, prior instruction, strategy allowance, and order status. Do not accuse a trader based on a simple buy-after-loss pattern.

Step 13: Monitor VaR and sensitivities

Create desk-level aggregat ➔ 99 percent one-day VaR. ➔ DV01 by currency and curve ➔ Options Delta by underlyin ➔ Gamma by underlying and ex

Create desk-level aggregates for:

  • 99 percent one-day VaR.
  • DV01 by currency and curve bucket.
  • Options Delta by underlying.
  • Gamma by underlying and expiry.
  • Vega by volatility bucket and expiry.
  • Stress loss by scenario.
  • Gross and net market value.

Do not sum all VaR values blindly. Portfolio VaR requires a consistent model and aggregation that recognizes dependence. If source VaR is not designed for additive aggregation, use the approved portfolio-level measure from the risk engine.

DV01 can be aggregated within compatible currency, curve, and bucket definitions. Delta, Gamma, and Vega require consistent units and underlying mappings.

Create concentration flags when one trader, book, instrument, issuer, currency, or risk factor contributes more than the desk-approved proportion of exposure.

Write the current output to:

desk_control.gold.desk_risk_summary

Step 14: Detect fat-finger orders

Create an order-anomaly br ➔ Join each order to the tra ➔ Join to a fresh approved r ➔ Calculate: ➔ Order notional divided by

Create an order-anomaly branch from normalized orders.

Join each order to the trader's active position and order limits.

Join to a fresh approved reference price.

Calculate:

  • Order notional divided by single-order limit.
  • Quantity divided by the trailing median order size.
  • Price deviation in basis points.
  • Order quantity divided by visible market depth.
  • Projected position after full fill.

Create a severity rule:

CASE
  WHEN projected_position > hard_position_limit THEN 'CRITICAL'
  WHEN order_notional > single_order_limit * 1.5 THEN 'CRITICAL'
  WHEN quantity > median_quantity_20d * 10 THEN 'HIGH'
  WHEN ABS(price_deviation_bps) > price_deviation_limit_bps THEN 'HIGH'
  ELSE 'NORMAL'
END

Do not automatically label a block trade as a fat-finger event. Check parent order, client instruction, block-trading workflow, auction session, and manual approval.

Step 15: Detect algorithm loops and runaway activity

Aggregate order events by ➔ Calculate new-order count, ➔ Raise ALGO_ORDER_RATE_CRIT ➔ Raise ALGO_REPEATED_ORDER_ ➔ Raise ALGO_CANCEL_LOOP whe

Aggregate order events by algorithm, trader, instrument, and one-second window.

Calculate new-order count, cancellation count, replacement count, total quantity, and unique client-order IDs.

Raise ALGO_ORDER_RATE_CRITICAL when the approved per-second or per-minute rate is exceeded.

Raise ALGO_REPEATED_ORDER_PATTERN when identical orders repeat without an expected state transition.

Raise ALGO_CANCEL_LOOP when new and cancel messages repeat at an abnormal rate.

Raise ALGO_SEQUENCE_ERROR when source sequences go backward, repeat unexpectedly, or contain unexplained gaps.

A critical alert should create a kill-switch request record and notify the authorized execution-control operator. Record whether the external platform confirmed algorithm disablement and order cancellation.

Step 16: Investigate hidden positions

Create an independent posi ➔ Use these sources where av ➔ Front-office position reco ➔ Execution and trade-bookin ➔ Broker statements.

Create an independent position-reconciliation workflow.

Use these sources where available:

  • Front-office position records.
  • Execution and trade-booking records.
  • Broker statements.
  • Clearing records.
  • Custodian records.
  • Confirmation platform records.
  • OTC derivative confirmations.
  • Collateral and margin records.
  • Settlement instructions.
  • General-ledger balances.
  • Market-risk sensitivities.

Normalize legal entity, account, trader, strategy, instrument, counterparty, currency, and settlement date.

Create expected positions from confirmed executions and lifecycle events. Compare them with front-office and independent records.

Flag:

  • An account not present in the approved registry.
  • A virtual account mapped to no authorized book.
  • An OTC confirmation with no front-office trade.
  • A front-office trade with no independent confirmation.
  • A broker position with no internal position.
  • A risk sensitivity without a matching position.
  • Collateral movement without a recognized exposure.
  • Repeated manual valuation adjustments.
  • Late or backdated booking near a reporting cut-off.

Write reconciliation exceptions to:

desk_control.gold.position_reconciliation_exceptions

Require middle-office ownership and documented resolution. Do not allow the front-office trader to close an independent reconciliation exception alone.

Step 17: Detect wash-trade and spoofing indicators

Create surveillance indica ➔ Potential wash-trade indic ➔ Potential spoofing indicat ➔ Use order lifecycle, execu ➔ Send high-risk patterns to

Create surveillance indicators, not final legal conclusions.

Potential wash-trade indicators include opposite-side executions in the same or economically equivalent instrument, close timestamps, common beneficial control, little market-risk change, and repeated patterns.

Potential spoofing indicators include large visible orders placed away from genuine execution intent, repeated cancellation before execution, opposite-side fills after the apparent order changes the market, and recurring behavior around the same price levels.

Use order lifecycle, execution, market-depth, account ownership, trader identity, and algorithm identity.

Send high-risk patterns to compliance surveillance with evidence references. A line manager should not determine that market abuse occurred solely from one pipeline flag.

Step 18: Build the manager action workflow

Create an abnormal-event t ➔ When a line manager review ➔ Explanation accepted. ➔ Data or valuation issue. ➔ Monitor with a deadline.

Create an abnormal-event table:

CREATE TABLE IF NOT EXISTS desk_control.gold.abnormal_events (
  alert_id STRING,
  detected_at TIMESTAMP,
  alert_type STRING,
  severity STRING,
  trader_id STRING,
  desk STRING,
  book STRING,
  account_id STRING,
  instrument_id STRING,
  measured_value DECIMAL(24,8),
  threshold_value DECIMAL(24,8),
  evidence_table STRING,
  evidence_record_id STRING,
  alert_status STRING,
  is_synthetic BOOLEAN
) USING DELTA;

When a line manager reviews an alert, record one of these decisions:

  • Explanation accepted.
  • Data or valuation issue.
  • Monitor with a deadline.
  • Reduce position.
  • Hedge exposure.
  • Freeze new risk.
  • Request algorithm disablement.
  • Request kill switch.
  • Request cancellation.
  • Refer to middle office.
  • Refer to compliance.
  • Escalate to desk head or risk officer.

Require a reason and evidence reference for every decision.

For a HARD_STOP, enforce maker-checker authorization in the external production control system. The Databricks action ledger should record both the manager request and the independent confirmation.

Step 19: Handle extreme market conditions

Create market-stress indic ➔ Example triggers: ➔ Spread greater than five t ➔ Visible depth below 20 per ➔ One-minute price move abov

Create market-stress indicators using approved price, spread, volatility, depth, and venue-status sources.

Example triggers:

  • Spread greater than five times the recent median.
  • Visible depth below 20 percent of the recent median.
  • One-minute price move above the asset-specific stress threshold.
  • Multiple venues enter auction, halt, or reject state.
  • Market-data divergence exceeds the approved tolerance.
  • Risk valuation becomes stale or unavailable.

When a stress trigger activates, the manager workflow can record:

  • Pause market-making request.
  • Widen-spread approval.
  • Reduce quote size.
  • Restrict new risk.
  • Hedging priority.
  • Controlled liquidation review.
  • Exchange or broker contact.

Do not apply one universal stress rule across FX, rates, equities, options, commodities, and credit. Create asset-specific visual branches and limit tables.

Step 20: Adapt quickly with the drag-and-drop interface

When a new abnormal patter ➔ Add a Source operator for ➔ Add filters and joins for ➔ Preview each operator usin ➔ Compare the output with kn

When a new abnormal pattern appears, duplicate the current visual data prep and create a controlled branch.

Add a Source operator for the new data source or a new field.

Add filters and joins for the new hypothesis.

Preview each operator using synthetic or replayed data.

Compare the output with known normal and abnormal cases.

Write the new output to a versioned test table.

Review the generated code and Git change.

Require risk, data, and control-owner review before scheduling it as a monitored job.

Lakeflow Designer accelerates safe change because a user can see the operator chain and preview intermediate results. It does not remove change management. A visual error can still create a false alert or miss a real breach.

Step 21: Build the trading-desk control dashboard

Create an AI/BI dashboard ➔ Show current values for: ➔ Traders at warning, escala ➔ Daily and monthly drawdown ➔ Desk VaR and stress loss.

Create an AI/BI dashboard using gold tables.

Show current values for:

  • Traders at warning, escalation, and hard-stop levels.
  • Daily and monthly drawdown utilization.
  • Desk VaR and stress loss.
  • DV01 by currency and maturity bucket.
  • Delta, Gamma, and Vega concentration.
  • Positions above limits.
  • Unapproved accounts.
  • Fat-finger alerts.
  • Algorithm-rate alerts.
  • Open reconciliation exceptions.
  • Compliance referrals.
  • Manager actions awaiting external confirmation.

Use clear status labels:

  • NORMAL
  • WARNING
  • ESCALATE
  • HARD_STOP
  • DATA_QUALITY_BLOCK
  • PENDING_MANAGER_REVIEW
  • PENDING_EXTERNAL_CONFIRMATION
  • REFERRED_TO_MIDDLE_OFFICE
  • REFERRED_TO_COMPLIANCE
  • CLOSED

The dashboard must display data age. A green indicator based on stale risk data is unsafe.

Step 22: Use lineage to challenge concealed activity

For each abnormal position ➔ Trace the record backward ➔ Trace it forward to the al ➔ Compare the source lineage ➔ Run a daily completeness q

For each abnormal position, open its Unity Catalog lineage.

Trace the record backward to the source position, order, execution, account, and reference data.

Trace it forward to the alert, dashboard, case, and manager action.

Compare the source lineage against the approved source inventory. If a book or account has no lineage to an independent source, treat it as an unresolved coverage gap.

Run a daily completeness query:

SELECT account_id
FROM desk_control.reference.accounts
WHERE approved = true
EXCEPT
SELECT DISTINCT account_id
FROM desk_control.silver.positions_normalized;

Also reverse the comparison:

SELECT DISTINCT account_id
FROM desk_control.silver.positions_normalized
EXCEPT
SELECT account_id
FROM desk_control.reference.accounts
WHERE approved = true;

The first query can identify approved accounts with no current data. The second can identify data from unknown or unapproved accounts.

Lineage and reconciliation together make concealment harder, but neither can discover activity in an unknown external system without an independent inventory, attestation, broker statement, confirmation, settlement, collateral, or ledger source.

Step 23: Apply Unity Catalog security

Create groups: ➔ trading_desk_line_managers ➔ trading_desk_traders ➔ middle_office_risk ➔ compliance_surveillance

Create groups:

  • trading_desk_line_managers
  • trading_desk_traders
  • middle_office_risk
  • compliance_surveillance
  • operations_reconciliation
  • data_engineering
  • audit_readers

Traders should not be able to alter limits, action history, reconciliation status, compliance referrals, or source lineage.

Line managers should see their own desk but not unrelated desks unless they have enterprise authority.

Middle office should be able to review risk and reconciliation independently.

Compliance should receive surveillance evidence and case referrals without granting broad write access to trading records.

Protect personal and disciplinary information with row filters and column masks. Limit access to trader names where an ID is sufficient.

Use service principals for pipelines. Do not run production ingestion under a departing employee's identity.

Step 24: Validate the control calculations

Create a synthetic trader ➔ Set warning at USD 600,000 ➔ At a daily P&L of negative ➔ At negative USD 850,000, s ➔ At negative USD 1,020,000,

Create a synthetic trader with a USD 1,000,000 daily loss hard stop.

Set warning at USD 600,000 and escalation at USD 800,000.

At a daily P&L of negative USD 650,000, status should be WARNING and utilization should be 65 percent.

At negative USD 850,000, status should be ESCALATE and utilization should be 85 percent.

At negative USD 1,020,000, status should be HARD_STOP and utilization should be 102 percent.

Create a synthetic order with a USD 10,000,000 single-order limit and a notional of USD 16,000,000. The order-notional rule should produce a critical alert because it is 160 percent of the limit.

Create an algorithm that sends 130 orders in one second against a 100-order threshold. The algorithm-rate rule should create a critical alert and a kill-switch request, but no actual trading action.

Create one unapproved account containing an OTC derivative position. Confirm that the account-registry comparison and independent confirmation reconciliation both flag it.

Step 25: Operate the control workflow

At the start of the sessio ➔ Confirm that the approved- ➔ Run the Lakeflow Connect i ➔ Run the Lakeflow Designer ➔ Review data-quality blocks

At the start of the session, verify source freshness and connector status.

Confirm that the approved-account, trader, and limit reference data are current.

Run the Lakeflow Connect ingestion pipelines or load the synthetic source files.

Run the Lakeflow Designer visual data prep.

Review data-quality blocks before reviewing financial alerts.

Review hard stops first, then critical order and algorithm alerts, then escalation and warning cases.

For every manager decision, write an action-ledger record.

For every action performed in an external system, require the external confirmation ID and confirmed state.

At the end of the shift, hand over every open case with owner, current status, latest evidence time, unresolved questions, and next deadline.

Lessons learned

A trading-desk line manage ➔ Stop-loss enforcement must ➔ Risk metrics need context. ➔ Abnormal trading detection ➔ Lakeflow Connect and Lakef

A trading-desk line manager is not only a profit manager. The manager is a capital-protection control point responsible for stopping a local decision from becoming a firm-threatening loss.

Stop-loss enforcement must distinguish warning, escalation, and hard-stop states. A warning requires explanation and preparation. A hard stop requires the authorized production control process and must not be negotiated through hopeful averaging.

Risk metrics need context. VaR is model-dependent. DV01 requires curve and currency alignment. Delta, Gamma, and Vega require consistent underlyings, units, and expiry buckets. A dashboard that combines incompatible measures can create false confidence.

Abnormal trading detection should create evidence and escalation, not automatic accusations. Oversized orders, high cancellation rates, opposite-side trades, and unexplained positions require investigation across market, system, strategy, and conduct context.

Lakeflow Connect and Lakeflow Designer are useful because they unify ingestion, visual transformation, managed execution, and Unity Catalog governance. A line manager can adapt a detection branch quickly while retaining generated code, version history, permissions, and lineage.

Lineage does not prove completeness. Hidden positions are controlled through independent reconciliation across front office, middle office, brokers, clearing, custodians, confirmations, collateral, settlement, and the general ledger.

Important failure modes

A stale-risk failure occur ➔ A double-count failure occ ➔ A missing-limit failure oc ➔ A false-fat-finger failure ➔ A kill-switch assurance fa

A stale-risk failure occurs when the dashboard displays old P&L or sensitivities as current. Show data age and block decisions when freshness is outside tolerance.

A double-count failure occurs when the same execution arrives from multiple sources and inflates the reconstructed position. Deduplicate using stable execution identifiers and source precedence.

A missing-limit failure occurs when an exposure is treated as permitted because no limit joined. Missing limits must fail closed for control reporting.

A false-fat-finger failure occurs when a valid block or auction order is compared with normal continuous-market behavior. Include order context and approval references.

A kill-switch assurance failure occurs when a request is mistaken for completed platform action. Require external confirmation.

A hidden-source failure occurs when lineage covers connected systems but an unofficial account or OTC platform is absent. Maintain an independent source inventory and reconcile external records.

A visual-change failure occurs when a drag-and-drop change is deployed without reviewing generated logic. Version, test, review, and approve every material rule change.

A Free Edition failure occurs when quotas, unavailable connectors, or preview limits interrupt the demonstration. Use synthetic files and preserve restart instructions.

References

Databricks Free Edition ➔ Lakeflow Designer ➔ What is Lakeflow Designer ➔ Ingest data into Lakeflow