Quantitative Data Sources: Compliance Red Lines for Live Trading
A trader can own the most precise order book data in the building and still be unable to use it legally in production.
The distinction matters because “access” and “permission” are not the same thing. A market-data license may allow internal research while prohibiting client redistribution, automated execution, derived-data publication, or use across affiliated legal entities. A quote that appears real-time on one terminal may also carry a delayed-feed designation, a venue-specific restriction, or a prohibition on storing it beyond a specified window.
Institutional teams need a more precise question than “Can I buy this data?” They need to determine what the data license permits, what the data represents, how it can be transformed, which parties may receive it, and what evidence must exist when a regulator or vendor audits the system.
This article provides a practical compliance framework for quantitative data-source evaluation. It covers real-time trading permissions, redistribution, derived data, audit evidence, and the controls that technical teams should implement before data reaches a production strategy.
1. Why Data Licensing Is a Production Risk
Market data creates value through access, but legal permission determines whether that value can be monetized.
The failure mode is rarely obvious at the beginning of a project. A research team may purchase a vendor feed, use it in an internal notebook, and later share derived charts with clients. The initial activity can appear harmless. Over time, the same data may pass through a signal service, an execution platform, a client dashboard, and a model-training pipeline. Each transfer can change the compliance position.
A practical licensing assessment therefore separates four questions:
- Can the data be used for live trading?
- Can the data be processed, transformed, or combined with other inputs?
- Can the data or a derived output be redistributed to clients or affiliates?
- What records must the organization retain to demonstrate compliant use?
The answer can differ by instrument, venue, user, subscription tier, and delivery method. A feed that permits exchange-displayed data may not permit proprietary order-book data. A low-latency package may include execution rights that a standard research package does not. A product designed for internal analytics may prohibit using the same output as a managed trading signal.
The table below illustrates how permissions can change across common use cases.
| Data use | Internal research | Internal live trading | Client redistribution | Typical compliance risk |
|---|---|---|---|---|
| Historical OHLCV | Usually permitted | Usually permitted, subject to terms | Often restricted or separately licensed | Sharing raw files with clients |
| Delayed quotes | Commonly permitted | Permitted if clearly marked delayed | Sometimes permitted with delay notices | Accidentally treating delayed data as real-time |
| Real-time consolidated quotes | Depends on contract | Often available with execution-related rights | Usually requires a display agreement | Missing exchange attribution or reporting |
| Level 1 order book | Depends on market and feed | Commonly available with appropriate rights | Often restricted | Storing and forwarding snapshots |
| Level 2–10 order book | Often separately priced | May require market-specific entitlements | Frequently prohibited without redistribution rights | Treating depth data as freely redistributable |
| Derived technical signal | Depends on license language | Often possible if output is not raw data | May be permitted if the output is not a substitute for the source data | Licensing by reference |
| Signal delivered to clients | Depends on agreement | May be treated as a managed service | Usually requires additional rights | Cross-persona disclosure obligations |
These categories describe a risk framework, not a universal permission matrix. The governing contract and applicable exchange or vendor policies control the outcome.
2. The Compliance Model: Five Permission Layers
Technical and legal teams should evaluate a data source through five separate permission layers. A positive answer in one layer does not imply a positive answer in the others.
2.1 Instrument and Market Rights
The first layer is scope. The contract must identify the permitted instruments, exchanges, venues, regions, and asset classes.
For example, a license for US equity consolidated quotes may not automatically include:
- New York Stock Exchange or Nasdaq depth data
- Options quotes or derived volatility surfaces
- Canadian, London, or Hong Kong exchange data
- Crypto exchange-specific order books
- Futures and options data
- Non-display use for an algorithmic execution product
The technical implementation must also ensure that the application does not use a symbol merely because the vendor’s API returns it. An undocumented symbol in a response does not prove that the subscription permits commercial use.
A robust entitlement system should map each data field to its licensing scope.
from dataclasses import dataclass
from enum import Enum
class MarketScope(str, Enum):
US_EQUITIES = "us-equities"
HK_EQUITIES = "hk-equities"
CRYPTO = "crypto"
FOREX = "forex"
COMMODITIES = "commodities"
INDICES = "indices"
class UseType(str, Enum):
RESEARCH = "research"
LIVE_TRADING = "live-trading"
DISPLAY = "display"
REDISTRIBUTION = "redistribution"
DERIVED_OUTPUT = "derived-output"
@dataclass(frozen=True)
class Entitlement:
market: MarketScope
use_type: UseType
may_store: bool
max_storage_seconds: int | None = None
requires_delay_label: bool = False
ENTITLEMENTS = {
(MarketScope.US_EQUITIES, UseType.RESEARCH): Entitlement(
market=MarketScope.US_EQUITIES,
use_type=UseType.RESEARCH,
may_store=True,
),
(MarketScope.HK_EQUITIES, UseType.LIVE_TRADING): Entitlement(
market=MarketScope.HK_EQUITIES,
use_type=UseType.LIVE_TRADING,
may_store=True,
max_storage_seconds=300,
),
}
def can_use(
market: MarketScope,
use_type: UseType,
*,
symbol: str,
tenant_id: str,
) -> bool:
"""Reject unauthorized market/use combinations before data leaves the system."""
if not symbol:
return False
entitlement = ENTITLEMENTS.get((market, use_type))
if entitlement is None:
return False
# A production implementation should query a tenant-specific entitlement
# service and log every decision with an audit reference.
return bool(tenant_id and entitlement)
This example is deliberately conservative. Production systems should not rely on a hard-coded map. They should resolve entitlements from a controlled configuration service, version it, and attach the resulting decision to each data-processing job.
2.2 Use-Type Rights
The second layer distinguishes how the data will be used.
A license may separately authorize:
- Historical research and backtesting
- Internal visualization
- Real-time trading
- Order execution
- Client display
- Automated reporting
- Machine-learning feature construction
- Redistribution to affiliates or external customers
“Real-time trading” can itself be a narrow category. Some agreements define it as submitting orders generated by a third-party signal, while others require the data user to create the signal. Vendor algorithms, managed accounts, and client-directed trading may be treated differently.
The architecture should therefore tag each workload with an explicit purpose. Generic service accounts with unrestricted market-data access create unnecessary compliance exposure.
2.3 Storage and Retention Rights
The third layer governs persistence.
A contract may allow a team to store historical bars while prohibiting storage of real-time tick data or order-book snapshots. Even if storage is permitted, the contract may impose limits on:
- Maximum retention period
- Number of copies
- Backup retention
- Derived database synchronization
- Access by disaster-recovery operators
- Geographic location of stored data
The distinction between temporary buffering and durable retention matters. A five-second in-memory queue can still create a derived dataset if it is written to disk, replicated, or available to downstream services.
Production storage should therefore support a retention policy enforced by the data platform rather than by application convention.
from datetime import datetime, timedelta, timezone
from typing import Any
class RetentionError(RuntimeError):
pass
def enforce_retention(
record: dict[str, Any],
*,
now: datetime | None = None,
max_age_seconds: int = 300,
) -> None:
"""Reject records that exceed the configured entitlement retention window."""
now = now or datetime.now(timezone.utc)
timestamp = datetime.fromisoformat(record["timestamp"].replace("Z", "+00:00"))
if timestamp.tzinfo is None:
timestamp = timestamp.replace(tzinfo=timezone.utc)
age = now - timestamp
if age > timedelta(seconds=max_age_seconds):
raise RetentionError(
f"Record age {age.total_seconds():.1f}s exceeds "
f"the permitted {max_age_seconds}s retention window"
)
A stronger implementation would apply this policy at ingestion, storage, export, and backup boundaries. It should also record whether a record was deleted because it reached its retention limit.
2.4 Redistribution and Display Rights
The fourth layer determines who may receive the data outside the licensed organization.
Redistribution is not limited to copying raw files. The following can constitute redistribution or display:
- Forwarding quotes to a client dashboard
- Providing raw bars through an API
- Sending book snapshots to another vendor
- Embedding data in a customer report
- Hosting a visual terminal for clients
- Exposing a chart with delayed data without labeling it
- Providing a signal derived directly from proprietary depth data
A useful legal and technical distinction is between an output and a reconstructable substitute. If a client can reverse-engineer the source quotes, order book, or timestamps from the output, the output may still be treated as redistribution under the license.
Redistribution rights are commonly priced separately. They may also require:
- Per-user or per-device reporting
- Exchange attribution
- Delayed-feed display
- Audit access
- Approved downstream vendors
- Geographic restrictions
2.5 Audit and Evidence Rights
The fifth layer is the ability to demonstrate compliance.
A production program needs records showing:
- Which data version was received
- Which entitlement decision was applied
- Which users and services accessed it
- Whether data was stored, transformed, displayed, or redistributed
- When and why records were deleted
- Which external counterparties received outputs
- How delayed or non-real-time status was communicated
Without this evidence, a team may have the right to use the data but still be unable to prove that it stayed within the permitted scope.
3. Architecture for Compliant Data Handling
The safest architecture separates entitlement, ingestion, processing, storage, and distribution into explicit control points.
+---------------------------+
| Contract / Entitlement |
| Registry |
+-------------+-------------+
|
v
+---------------------------+ +----------------------+
| Data Ingestion Gateway |------>| Raw Message Log |
| - API key isolation | | - short retention |
| - scope validation | | - immutable audit ID |
| - timestamp validation | +----------+-----------+
+-------------+-------------+ |
| v
v +----------------------+
+---------------------------+ | Processing Store |
| Stream Normalizer |------>| - entitlement tag |
| - venue metadata | | - retention policy |
| - sequence correction | | - lineage metadata |
| - delay classification | +----------+-----------+
+-------------+-------------+ |
| |
v v
+---------------------------+ +----------------------+
| Signal and Model Layer | | Distribution Layer |
| - feature lineage |------>| - client entitlement |
| - derived-data checks | | - display labels |
+---------------------------+ | - export controls |
+----------+-----------+
|
v
+----------------------+
| Audit and Reporting |
| - access records |
| - versioned decisions |
| - periodic attestations|
+----------------------+
The architecture applies different controls to each path. Ingestion validates the connection and scope. Processing preserves lineage. Distribution checks the consumer’s rights. Audit records every decision.
A common design mistake is to put all control in the application layer. If a data lake can accept any symbol and a dashboard can query it directly, the application’s authorization logic is only advisory.
3.1 Data Classification Tags
Every record should carry metadata that reflects its provenance and intended use.
from dataclasses import dataclass, asdict
from datetime import datetime, timezone
from typing import Literal
DataClass = Literal[
"delayed",
"real-time",
"historical",
"derived",
"proprietary",
]
@dataclass(frozen=True)
class DataEnvelope:
symbol: str
market: str
data_class: DataClass
source: str
entitlement_id: str
ingestion_time: datetime
payload: dict
def audit_record(self) -> dict:
record = asdict(self)
record["ingestion_time"] = self.ingestion_time.isoformat()
return record
These tags support several operational tasks:
- Blocking an unauthorized export
- Applying the correct retention period
- Labeling delayed data in a user interface
- Separating raw source data from derived output
- Reconstructing the lineage of a model feature
- Producing evidence during a vendor or regulatory review
4. Production-Grade Data-Access Example
The following example demonstrates a controlled access pattern for historical bars and a WebSocket depth stream. It is an engineering example, not a substitute for reviewing the applicable data agreement.
The code includes:
- Environment-variable authentication
- HTTP timeouts
- A WebSocket heartbeat
- Exponential backoff with jitter
- Reconnection handling
- Rate-limit handling for error code
3001 - Explicit entitlement checks
- Audit logging
4.1 Historical Bars
import json
import os
import time
from typing import Any
import requests
API_KEY = os.environ.get("TICKDB_API_KEY")
BASE_URL = "https://api.tickdb.ai"
if not API_KEY:
raise RuntimeError("Set TICKDB_API_KEY before running this client.")
def handle_api_error(
response: dict[str, Any],
symbol: str | None = None,
) -> Any:
"""Handle TickDB API errors and apply the documented rate-limit rule."""
code = response.get("code", 0)
if code == 0:
return response.get("data")
if code in (1001, 1002):
raise ValueError(
"Invalid or missing API key — check the TICKDB_API_KEY environment variable"
)
if code == 2002:
raise KeyError(
f"Symbol {symbol} not found — verify it through /v1/symbols/available"
)
if code == 3001:
# The API documentation identifies code 3001 as a rate-limit error.
# The caller should honor Retry-After before making another request.
retry_after = int(response.get("retry_after", 5))
time.sleep(retry_after)
return None
raise RuntimeError(
f"Unexpected TickDB API error {code}: {response.get('message', 'unknown error')}"
)
def fetch_historical_bars(
symbol: str,
*,
interval: str = "1h",
limit: int = 100,
) -> Any:
"""Fetch completed historical bars for an authorized research workload."""
response = requests.get(
f"{BASE_URL}/v1/market/kline",
headers={"X-API-Key": API_KEY},
params={
"symbol": symbol,
"interval": interval,
"limit": limit,
},
timeout=(3.05, 10),
)
response.raise_for_status()
return handle_api_error(response.json(), symbol=symbol)
The REST endpoint is appropriate for completed historical periods. A live dashboard that repeatedly polls historical bars introduces unnecessary load and can produce stale results. The /v1/market/kline/latest endpoint should be used for a current candle when that distinction matters.
4.2 WebSocket Depth Stream
The WebSocket client below uses the API key in the URL query parameter, as required for TickDB WebSocket authentication. It does not print the key or include it in a persisted log.
import json
import os
import random
import time
from datetime import datetime, timezone
from typing import Any
import websocket
API_KEY = os.environ.get("TICKDB_API_KEY")
WS_URL = "wss://stream.tickdb.ai"
if not API_KEY:
raise RuntimeError("Set TICKDB_API_KEY before running this client.")
class DepthClient:
"""Minimal resilient depth consumer with heartbeat and reconnect logic."""
def __init__(self, symbol: str, levels: int = 1) -> None:
self.symbol = symbol
self.levels = levels
self.retry_count = 0
self.running = True
def log(self, event: str, **fields: Any) -> None:
safe_fields = {
key: value
for key, value in fields.items()
if key not in {"api_key", "authorization"}
}
print(
json.dumps(
{
"event": event,
"timestamp": datetime.now(timezone.utc).isoformat(),
**safe_fields,
},
default=str,
)
)
def process_depth(self, message: dict[str, Any]) -> None:
"""Validate and record a depth message without storing the API key."""
if message.get("code") == 3001:
retry_after = int(message.get("retry_after", 5))
self.log("rate_limit", retry_after=retry_after)
time.sleep(retry_after)
return
if message.get("code") not in (0, None):
self.log("stream_error", code=message.get("code"))
return
data = message.get("data", {})
symbol = data.get("symbol")
if symbol != self.symbol:
self.log("symbol_mismatch", received=symbol)
return
bids = data.get("bids", [])
asks = data.get("asks", [])
bid_volume = sum(float(level.get("size", 0)) for level in bids[: self.levels])
ask_volume = sum(float(level.get("size", 0)) for level in asks[: self.levels])
pressure_ratio = bid_volume / ask_volume if ask_volume else None
self.log(
"depth_update",
symbol=symbol,
bid_volume=bid_volume,
ask_volume=ask_volume,
pressure_ratio=pressure_ratio,
)
def run(self) -> None:
"""Connect, consume data, and reconnect with exponential backoff."""
while self.running:
try:
url = f"{WS_URL}?api_key={API_KEY}"
ws = websocket.create_connection(url, timeout=15)
self.retry_count = 0
self.log("connected", symbol=self.symbol)
last_ping = time.monotonic()
while self.running:
now = time.monotonic()
if now - last_ping >= 20:
ws.send(json.dumps({"cmd": "ping"}))
last_ping = now
self.log("heartbeat")
raw = ws.recv()
message = json.loads(raw)
if message.get("cmd") == "pong":
self.log("heartbeat_ack")
continue
self.process_depth(message)
except KeyboardInterrupt:
self.running = False
self.log("shutdown")
except Exception as exc:
self.log("connection_error", error=str(exc))
finally:
try:
ws.close()
except Exception:
pass
if not self.running:
break
# Exponential backoff plus jitter prevents reconnect attempts from
# synchronizing across multiple workers after an outage.
base_delay = min(2 ** self.retry_count, 60)
delay = base_delay + random.uniform(0, base_delay * 0.1)
self.retry_count += 1
self.log("reconnect_scheduled", delay_seconds=round(delay, 2))
time.sleep(delay)
if __name__ == "__main__":
# US equity depth support is limited to the market’s configured levels.
# Verify the market and entitlement before connecting to production data.
DepthClient(symbol="AAPL.US", levels=1).run()
For US equities, the available depth configuration is L1. For Hong Kong equities and crypto, the supported configuration is L1–L10. Depth is not supported for forex, precious metals, or indices. A client that silently requests unsupported levels must treat that as a configuration error rather than silently switching to another feed.
4.3 What This Example Does Not Solve
The code demonstrates connection resilience, but it does not determine legal entitlement. Before deployment, the team must also verify:
- Whether the account includes live-trading rights
- Whether the market and feed are covered
- Whether raw depth snapshots may be stored
- Whether the service may expose them to downstream users
- Whether the output is classified as proprietary or derived data
- Whether the team must report users or devices
The code is therefore only one component of a controlled data platform.
5. Can Purchased Data Be Used for Live Trading?
The answer depends on the license’s grant and the way the application uses the data.
5.1 The Minimum Conditions
A data source is generally suitable for live trading only when the agreement clearly permits the relevant activity. The evaluation should confirm at least the following:
| Requirement | Evidence to retain |
|---|---|
| Real-time or execution-grade use | Contract clause and entitlement confirmation |
| Instrument and venue coverage | Symbol list and venue metadata |
| Internal automated processing | Technical architecture and access policy |
| Storage and retention | Data policy and deletion evidence |
| Derived feature generation | Written interpretation from legal or compliance |
| Client delivery | Redistribution agreement or display approval |
| Auditability | Usage logs and periodic attestations |
If the agreement says only “research use,” a production strategy should not treat the feed as approved for execution. If the agreement permits “display” but does not address automated signal generation, the team should obtain clarification before connecting the feed to an order-generation service.
5.2 The “Signal” Is Not Automatically a Safe Harbor
A common assumption is that replacing raw quotes with a technical indicator removes the redistribution issue. That assumption is too broad.
A moving average derived from consolidated closing prices is materially different from a client-facing feed that reproduces the vendor’s order book. The legal question depends on how closely the output reveals or substitutes for the licensed data.
The following questions help classify a derived output:
- Does the output reveal prices, sizes, venues, or timestamps beyond the permitted use?
- Can a recipient reconstruct the source data from repeated outputs?
- Is the output individualized or based on a client’s live market view?
- Does the output update continuously with the source feed?
- Is the output provided as a managed trading signal?
- Does the agreement contain an explicit derived-data clause?
The absence of an explicit permission is not always a prohibition, but it is not a safe approval either. Legal review should convert ambiguous language into a documented interpretation.
6. Redistribution: The Most Common Failure Point
Redistribution risk expands when data moves through a multi-tenant architecture.
A typical institutional flow may look like this:
Vendor Feed
|
v
Ingestion Service
|
+--> Feature Store --> Model --> Execution
|
+--> Raw Store --> Research UI
|
+--> Export Service --> Client Dashboard
The model team may use the data under an internal research right. The client dashboard, however, creates a new disclosure and redistribution context.
6.1 Redistribution Control Checklist
Before enabling an external data path, the platform should verify:
- The recipient is a contracted customer or approved user
- The recipient is authorized for the market and feed
- The display is delayed when required
- Exchange and vendor attribution is present
- The payload contains only approved fields
- Raw order-book data is not exposed accidentally
- API responses cannot be bulk-scraped without controls
- Downstream vendors are contractually permitted
- Usage is logged for reporting
- The path can be disabled immediately if the contract changes
6.2 API Export Controls
An export API should enforce entitlement at request time, not only during onboarding.
import time
from dataclasses import dataclass
@dataclass
class ExportRequest:
tenant_id: str
market: str
symbol: str
data_class: str
requested_at: float
class ExportPolicy:
def __init__(self, allowed_tenants: set[str]) -> None:
self.allowed_tenants = allowed_tenants
def authorize(self, request: ExportRequest) -> None:
if request.tenant_id not in self.allowed_tenants:
raise PermissionError("Tenant has no redistribution entitlement")
if request.data_class not in {"delayed", "historical"}:
raise PermissionError(
"Real-time and proprietary payloads require a separate export entitlement"
)
if request.market not in {"us-equities", "hk-equities"}:
raise PermissionError("Market is outside the approved export scope")
def export_bars(request: ExportRequest) -> dict:
policy = ExportPolicy(allowed_tenants={"tenant-001"})
policy.authorize(request)
# The actual fetch must be performed with the tenant's server-side
# credentials. Do not accept an API key from the client.
return {
"status": "authorized",
"tenant_id": request.tenant_id,
"requested_at": request.requested_at,
}
The implementation is simplified, but it demonstrates an important principle: external data access requires a server-side entitlement decision. The client should never provide or select its own feed credentials.
6.3 Delayed Data Must Be Labeled
A delayed feed is often commercially attractive because it is less expensive to redistribute. The technical cost of delayed data is obvious; the compliance cost is often overlooked.
The user interface should preserve the delay state through the entire chain:
- The ingestion layer records whether the source is delayed.
- The API preserves the classification.
- The display renders a visible timestamp or delay notice.
- The export includes the same classification.
- The audit log records the recipient’s access.
Changing the label only on the front end is insufficient. The underlying payload must remain distinguishable from a real-time source.
7. Institutional Compliance Checklist
Institutional adoption requires a formal review rather than an informal approval from a data engineer.
7.1 Contract and Licensing
- The vendor agreement explicitly covers live trading or automated execution.
- The agreement identifies all covered instruments, venues, and asset classes.
- Internal research, production trading, client display, and redistribution are separated.
- Derived data and calculated values are addressed explicitly.
- Storage, retention, backup, and disaster recovery are covered.
- Affiliate use and contractor access are covered.
- The agreement defines reporting, audit, and termination obligations.
- Exchange attribution and delayed-feed requirements are documented.
- The organization records the contract version and approval date.
7.2 Architecture and Access
- Production services use server-side credentials.
- API keys are stored in a secret manager, not source code.
- Each tenant has explicit data entitlements.
- Raw, delayed, real-time, and derived data have separate classifications.
- External export paths are centrally controlled.
- The ingestion layer rejects out-of-scope symbols and venues.
- Retention policies are enforced by the storage platform.
- Logs redact credentials and unnecessary proprietary payloads.
- Backups inherit the original retention and residency restrictions.
- Emergency disablement is tested.
7.3 Research and Model Governance
- Every feature records its source dataset and transformation lineage.
- Research notebooks declare their intended commercial use.
- Backtests identify whether the data was permitted for the intended purpose.
- Team members receive training on redistribution restrictions.
- Vendor documentation and internal interpretations are reviewed when terms change.
- A periodic review identifies new downstream uses of the data.
- The organization maintains a list of approved data products and outputs.
7.4 Audit Evidence
- Access logs identify the user, service, tenant, and purpose.
- Entitlement decisions are versioned and reproducible.
- The system records source timestamps and ingestion timestamps.
- Deletion events are logged when retention policies expire data.
- Exports identify the destination, purpose, and data classification.
- Periodic reports reconcile usage with vendor obligations.
- The evidence package is retained according to the organization’s policy.
- A quarterly owner reviews exceptions and remediation items.
7.5 Ownership
Compliance failures often arise because no single team owns the complete chain.
A practical responsibility model assigns clear accountability:
| Role | Primary responsibility |
|---|---|
| Data owner | Source selection, contract interpretation, renewal, vendor relationship |
| Compliance or legal | Permission interpretation, redistribution approval, regulatory review |
| Platform engineering | Enforcement of identity, entitlement, retention, and audit controls |
| Quant research | Correct use of data in research, features, and models |
| Product management | Client-facing use cases, display, pricing, and distribution |
| Security | Secret management, access reviews, incident response |
| Internal audit | Independent testing of controls and evidence quality |
A useful release gate requires sign-off from the data owner, compliance, engineering, and the product owner for any new external data path.
8. The TickDB Implementation Boundary
TickDB provides specific market-data capabilities that must be mapped to the organization’s entitlement controls rather than treated as automatic permission to redistribute.
8.1 Supported Data Boundaries
The technical planning should account for these documented capability boundaries:
| Capability | Supported scope | Important limitation |
|---|---|---|
US equity historical OHLCV (kline) |
More than 10 years of cleaned and aligned data | Historical bars do not provide US equity tick trades |
| HK equity trades | Supported | Use only within the contracted trading and storage scope |
| Crypto trades | Supported | Exchange-specific permissions and storage terms still apply |
| US equity depth | L1 | L2–L10 is not supported for US equities |
| HK equity depth | L1–L10 | Market and account entitlements still apply |
| Crypto depth | L1–L10 | Exchange-specific redistribution rules still apply |
| Forex, precious metals, and index depth | Not supported | Do not design a depth-monitoring workflow around these instruments |
The trades endpoint does not support US equities or A-shares. A US equity strategy that requires tick-level trades must use a different source or remain within the historical OHLCV and supported depth boundaries.
8.2 REST and WebSocket Authentication
REST authentication uses the X-API-Key header. WebSocket authentication uses the api_key URL parameter. The implementation must avoid placing the REST key in a URL, exposing it in client-side code, or recording it in logs.
For a production deployment, the team should also establish:
- Which account tier and market rights apply
- Whether raw depth snapshots may be stored
- Whether derived values can be exposed externally
- Which customer or tenant can receive each dataset
- What audit reports must be produced
TickDB should therefore appear in the workflow as a controlled data-acquisition layer, not as a substitute for contract review.
9. A Practical Launch Decision Framework
A quantitative team can use a launch checklist to convert legal uncertainty into explicit engineering decisions.
9.1 Green Path
A use case is ready for production when:
- The contract covers the intended market and live-trading use.
- The data is correctly classified as historical, delayed, real-time, or derived.
- The entitlement service permits the specific tenant and destination.
- Retention and redistribution controls are enabled.
- Audit logs identify the source, user, purpose, and output.
- Compliance has approved the client-facing interpretation.
9.2 Amber Path
A use case should remain in research or sandbox mode when:
- The agreement mentions live use but does not explicitly address automated execution.
- The output is derived but could be reconstructable.
- A downstream vendor has not been approved.
- Delayed-feed labeling is incomplete.
- The contract allows internal storage but does not define backup retention.
- The application exposes a generic API that can serve multiple tenant entitlements.
9.3 Red Path
A use case should be blocked when:
- The source is research-only and the team plans to use it for live orders.
- Raw order-book data is scheduled for client redistribution without rights.
- The API key is embedded in a browser, repository, or public notebook.
- The system stores real-time depth indefinitely without a retention decision.
- The frontend removes a delayed-data label while the API still serves the underlying data.
- A contractor or affiliate receives data without written permission.
- The organization cannot identify which users received a proprietary payload.
9.4 Decision Table
| Question | Green | Amber | Red |
|---|---|---|---|
| Live trading | Explicitly permitted | Ambiguous | Prohibited |
| Internal storage | Permitted with defined limits | Terms unclear | Prohibited or unlimited without review |
| Derived output | Explicitly addressed | Technical interpretation needed | Could expose source data |
| Client redistribution | Contracted and instrumented | Pending approval | Prohibited |
| Audit evidence | Complete | Partial | None |
| Credential management | Secret manager | Temporary environment variables | Hardcoded or client-exposed |
The most important operational rule is simple: unresolved amber questions must not be converted into green assumptions through engineering convenience.
10. Audit-Ready Logging
An audit record should answer who used the data, what data they used, under which entitlement, and what they did with it.
import hashlib
import json
import uuid
from datetime import datetime, timezone
def create_audit_event(
*,
tenant_id: str,
user_id: str,
purpose: str,
market: str,
symbol: str,
data_class: str,
entitlement_id: str,
action: str,
) -> str:
event_id = str(uuid.uuid4())
timestamp = datetime.now(timezone.utc).isoformat()
event = {
"event_id": event_id,
"timestamp": timestamp,
"tenant_id": tenant_id,
"user_id": user_id,
"purpose": purpose,
"market": market,
"symbol": symbol,
"data_class": data_class,
"entitlement_id": entitlement_id,
"action": action,
}
# Hash the canonical record so later mutation is detectable.
canonical = json.dumps(event, sort_keys=True, separators=(",", ":"))
event["integrity_hash"] = hashlib.sha256(
canonical.encode("utf-8")
).hexdigest()
print(json.dumps(event, sort_keys=True))
return event_id
For high-assurance environments, the hash should be written to an append-only audit store or external integrity service. The application log alone may not be independent evidence.
11. Conclusion: The Data Contract Is Part of the Architecture
The first rule of quantitative data governance is simple: access is not permission.
A data purchase may authorize research while prohibiting live execution, client redistribution, durable storage, or derived-data delivery. A technically excellent feed can therefore become a compliance liability if the organization treats the API key as the entire permission model.
The strongest engineering approach makes compliance visible in the system: classify each dataset, resolve entitlements per tenant and purpose, enforce retention at the platform boundary, preserve lineage from raw feed to model feature, and record every external export.
The practical launch decision should be based on evidence rather than assumptions. If the team cannot answer who may use the data, how long it may be stored, and what clients may receive, the production launch is not ready.
Next Steps
If you are an individual quant developer, begin by writing a one-page data-use register for every source, endpoint, field, symbol, and intended output. Obtain the current agreement before connecting the feed to an automated strategy.
If you are building a production platform, implement server-side entitlements, secret management, retention controls, delayed-data labeling, and export auditing as separate controls. Do not rely on front-end restrictions alone.
If you need historical US equity OHLCV or a controlled real-time market-data workflow, review TickDB’s supported data boundaries, choose the endpoint that matches the use case, and obtain an API key at tickdb.ai. Set TICKDB_API_KEY through your secret-management system rather than embedding it in source code.
If your organization requires institutional data licensing, redistribution, or historical coverage review, contact [email protected] with your markets, latency requirements, storage model, and client-delivery architecture.
If you use AI coding assistants, search for and install the tickdb-market-data SKILL in your AI tool’s marketplace, then validate every generated integration against the current contract and entitlement rules.
This article does not constitute investment advice. Markets involve risk; past performance does not guarantee future results.