Three quotes arrive in different milliseconds. Multiply them, and the market briefly disagrees with itself.
A EUR/USD quote of 1.08650, a GBP/USD quote of 1.27200, and an EUR/GBP quote of 0.85450 should belong to one coherent currency system. When one leg moves before the others, their implied exchange rates separate.
For systematic traders, that separation creates a triangular arbitrage candidate. For engineers, it creates a difficult data problem: identify the inconsistency quickly, prove that it is executable, and submit all three legs without allowing the signal to decay during the hedge.
This article builds a production-oriented monitoring system for the EUR/USD–GBP/USD–EUR/GBP triangle. It covers quote normalization, synthetic-rate calculation, timestamp synchronization, executable spread checks, reconnect behavior, and the distinction between an apparent risk-free profit and an actual locked-in result.
1. Why Three Quotes Can Disagree
A currency triangle exists whenever one exchange rate can be derived from the other two. In this case:
- EUR/USD expresses USD per EUR.
- GBP/USD expresses USD per GBP.
- EUR/GBP expresses GBP per EUR.
Let the mid-market rates be:
- (A = EUR/USD)
- (B = GBP/USD)
- (q = EUR/GBP)
The synthetic EUR/GBP rate implied by the USD pairs is:
[
q^{*} = \frac{A}{B}
]
The triangle is internally consistent when:
[
q = \frac{A}{B}
]
Equivalently:
[
A = Bq
]
In practice, executable bid and ask prices make exact equality impossible. The question is not whether the quotes are mathematically identical. The question is whether the residual is large enough to survive spreads, slippage, funding, and execution risk.
1.1 An Illustrative Market Snapshot
The following values demonstrate the calculation. They are not a historical performance claim.
| Metric | EUR/USD | GBP/USD | EUR/GBP |
|---|---|---|---|
| Bid | 1.08650 | 1.27200 | 0.85440 |
| Ask | 1.08660 | 1.27210 | 0.85450 |
| Mid | 1.08655 | 1.27205 | 0.85445 |
| Synthetic mid EUR/GBP | — | — | (1.08655 / 1.27205 = 0.85402) |
| Direct minus synthetic | — | — | +0.00043 GBP/EUR |
| Mid residual | — | — | +5.03 bps |
The synthetic rate is below the direct EUR/GBP quote. The triangle therefore appears inconsistent.
The executable gross return is smaller than the mid-rate residual because each leg must cross the spread. For the available bid and ask prices:
[
r_{EUR \rightarrow USD \rightarrow GBP \rightarrow EUR}
\frac{A_{bid}}{B_{ask}q_{ask}}
]
[
r_{EUR \rightarrow GBP \rightarrow USD \rightarrow EUR}
\frac{q_{ask}B_{bid}}{A_{ask}}
]
The system should evaluate both executable cycles rather than assume that the mid-price direction remains profitable after crossing the spread.
| Execution estimate | Basis | Result |
|---|---|---|
| Gross executable edge | Best executable cycle | +3.90 bps |
| Modeled friction | 0.15 bps per leg | −0.45 bps |
| Net edge before funding | Gross minus modeled friction | +3.45 bps |
| EUR 100,000 notional | Net edge applied to notional | approximately €34.50 |
The final value can become negative after overnight funding, data latency, rejected orders, or price movement between leg submissions.
1.2 The “Risk-Free” Label Is Dangerous
An apparent triangular arbitrage is not automatically a risk-free profit.
The calculation assumes that all of the following remain true:
- The displayed bid and ask prices represent executable size.
- All three legs fill at the calculated quantities.
- The three fills complete within the strategy’s latency tolerance.
- The feed timestamps are synchronized.
- No stale quote survives into the order decision.
- Funding, commissions, and conversion costs remain below the edge.
- The account can hold the required currencies and margin.
- The broker or venue does not reject a partially filled leg.
A triangle is therefore a candidate signal, not a guaranteed profit. The monitoring system should report both the gross residual and the residual after explicit friction assumptions.
2. Triangular Arbitrage Mechanics
2.1 Case One: Direct EUR/GBP Is Too Low
Suppose the direct EUR/GBP rate is below its synthetic value:
[
A > Bq
]
The profitable conversion cycle is:
- Borrow 1 EUR.
- Sell 1 EUR through EUR/USD.
- Buy the resulting USD amount through GBP/USD.
- Buy EUR through EUR/GBP.
- Repay the borrowed EUR and retain the surplus.
Using executable prices, the cycle starts with one unit of EUR and finishes with:
[
EUR_{final}
\frac{A_{bid}}{B_{ask}q_{ask}}
]
The gross return is:
[
r_{gross}
\left(
\frac{A_{bid}}{B_{ask}q_{ask}}
- 1
\right)
\times 10{,}000
]
in basis points.
2.2 Case Two: Direct EUR/GBP Is Too High
When the direct rate is above the synthetic value, the conversion cycle reverses:
- Borrow 1 EUR.
- Buy EUR through EUR/GBP.
- Sell the received GBP through GBP/USD.
- Buy EUR through EUR/USD.
- Repay the borrowed EUR and retain the surplus.
The resulting EUR amount is:
[
EUR_{final}
\frac{q_{ask}B_{bid}}{A_{ask}}
]
The gross return is:
[
r_{gross}
\left(
\frac{q_{ask}B_{bid}}{A_{ask}}
- 1
\right)
\times 10{,}000
]
2.3 Why Both Executable Cycles Matter
The sign of the mid-price residual identifies the likely direction, but it does not determine the executable return.
Consider a narrow triangle:
- EUR/USD: 1.08650 / 1.08660
- GBP/USD: 1.27200 / 1.27210
- EUR/GBP: 0.85440 / 0.85450
A mid-price calculation may show a positive residual. If the spread is wider on the leg required by that direction, however, the executable edge can disappear.
The correct implementation evaluates both cycles independently and selects the larger positive result.
2.4 Residual Measures
A useful monitoring stack contains three related measures.
Synthetic residual
The direct rate minus the synthetic rate:
[
\Delta_{rate} = q - \frac{A}{B}
]
This is useful for diagnostics but does not determine executable profitability.
Normalized residual
The ratio form is easier to compare across market regimes:
[
R = \frac{A}{Bq}
]
- (R > 1): the synthetic EUR/GBP rate is below the direct rate.
- (R < 1): the synthetic EUR/GBP rate is above the direct rate.
- (R = 1): the triangle is internally consistent.
Executable edge
The production decision should use the best executable cycle:
[
r_{exec} =
10{,}000
\left[
\max
\left(
\frac{A_{bid}}{B_{ask}q_{ask}},
\frac{q_{ask}B_{bid}}{A_{ask}}
\right)
- 1
\right]
]
The final alert should use (r_{exec}), not the mid-price residual.
3. System Architecture
A reliable monitor has four layers: feed normalization, synchronized market state, signal computation, and execution-aware alerting.
┌──────────────────────────────────────────────────────────────┐
│ Licensed FX market-data feed │
│ EUR/USD | GBP/USD | EUR/GBP │
└──────────────────────────────┬───────────────────────────────┘
│ WebSocket quote batches
▼
┌──────────────────────────────────────────────────────────────┐
│ Normalization layer │
│ - Symbol normalization │
│ - Decimal price parsing │
│ - Sequence validation │
│ - Feed timestamp validation │
└──────────────────────────────┬───────────────────────────────┘
▼
┌──────────────────────────────────────────────────────────────┐
│ Synchronized state layer │
│ - Atomic three-symbol snapshots │
│ - Maximum quote age │
│ - Maximum timestamp skew │
│ - Monotonic sequence checks │
└──────────────────────────────┬───────────────────────────────┘
▼
┌──────────────────────────────────────────────────────────────┐
│ Arbitrage engine │
│ - Synthetic EUR/GBP rate │
│ - Both executable conversion cycles │
│ - Gross and friction-adjusted edge │
│ - Minimum notional and liquidity filters │
└──────────────────────────────┬───────────────────────────────┘
▼
┌──────────────────────────────────────────────────────────────┐
│ Execution and alerting │
│ - Basket order when supported │
│ - Atomic fill reconciliation │
│ - Webhook, email, or dashboard alert │
└──────────────────────────────────────────────────────────────┘
3.1 The Feed Contract
The example implementation expects atomic quote batches in the following normalized format:
{
"type": "quote_batch",
"batch_id": 18420651,
"ts": 1782864000123,
"quotes": [
{
"symbol": "EUR/USD",
"bid": 1.08650,
"ask": 1.08660,
"ts": 1782864000120,
"seq": 7281041
},
{
"symbol": "GBP/USD",
"bid": 1.27200,
"ask": 1.27210,
"ts": 1782864000121,
"seq": 7281042
},
{
"symbol": "EUR/GBP",
"bid": 0.85440,
"ask": 0.85450,
"ts": 1782864000122,
"seq": 7281043
}
]
}
Real FX feeds differ in protocol. A production adapter must preserve four properties:
- It must emit all three symbols from the same feed event where possible.
- It must preserve exchange timestamps and sequence identifiers.
- It must distinguish executable bids from executable asks.
- It must identify the feed or venue associated with each quote.
If the upstream venue publishes each symbol on a separate channel, the adapter should reject snapshots that combine quotes from different local receipt windows. Combining old and new quotes creates a synthetic arbitrage that does not exist in the market.
3.2 Latency Requirements
“Millisecond-level updates” describes an end-to-end property, not a function of the calculation code.
The relevant latency budget includes:
| Stage | Example budget |
|---|---|
| Venue-to-feed normalization | 1–5 ms |
| Network transport | 1–10 ms |
| Parsing and validation | Under 1 ms |
| Signal calculation | Under 0.1 ms |
| Decision and order routing | Provider dependent |
| Total | Venue and deployment dependent |
A monitor that receives quotes every millisecond but submits legs sequentially may still expose the triangle to hundreds of milliseconds of execution risk.
4. Production-Grade WebSocket Monitor
The following Python service:
- Subscribes to all three symbols.
- Uses environment-variable authentication.
- Processes atomic quote batches.
- Rejects stale or out-of-sequence updates.
- Calculates both executable cycles with
Decimal. - Reports gross and friction-adjusted edge in basis points.
- Sends heartbeats.
- Reconnects with exponential backoff and jitter.
- Handles rate-limit responses.
- Applies bounded WebSocket message sizes and connection timeouts.
The upstream feed must implement the normalized message contract described above. Broker-specific subscription and authentication formats should be isolated inside the adapter rather than mixed into the signal engine.
import asyncio
import json
import os
import random
import time
from dataclasses import dataclass
from decimal import Decimal, getcontext
from typing import Dict, Optional
from urllib.parse import quote, urlencode, urlsplit, urlunsplit
import websockets
from websockets.exceptions import ConnectionClosed
getcontext().prec = 28
SYMBOLS = ("EUR/USD", "GBP/USD", "EUR/GBP")
MAX_QUOTE_AGE_MS = 500
MAX_TIMESTAMP_SKEW_MS = 100
MIN_NET_EDGE_BPS = Decimal("1.0")
FRICTION_BPS_PER_LEG = Decimal("0.15")
HEARTBEAT_INTERVAL_SECONDS = 10
RECONNECT_BASE_SECONDS = 1
RECONNECT_MAX_SECONDS = 30
@dataclass(frozen=True)
class Quote:
symbol: str
bid: Decimal
ask: Decimal
exchange_ts_ms: int
sequence: int
def validate(self) -> None:
if self.symbol not in SYMBOLS:
raise ValueError(f"Unsupported symbol: {self.symbol}")
if self.bid <= 0 or self.ask <= 0:
raise ValueError(f"Invalid prices for {self.symbol}")
if self.ask < self.bid:
raise ValueError(f"Crossed market for {self.symbol}")
if self.exchange_ts_ms <= 0 or self.sequence <= 0:
raise ValueError(f"Invalid timestamp or sequence for {self.symbol}")
@dataclass(frozen=True)
class CycleResult:
direction: str
gross_ratio: Decimal
gross_bps: Decimal
net_bps: Decimal
@property
def executable(self) -> bool:
return self.net_bps >= MIN_NET_EDGE_BPS
class QuoteBook:
def __init__(self) -> None:
self._quotes: Dict[str, Quote] = {}
def update_batch(self, quotes: Dict[str, Quote]) -> None:
for symbol, quote in quotes.items():
previous = self._quotes.get(symbol)
if previous and quote.sequence <= previous.sequence:
raise ValueError(
f"Out-of-order update for {symbol}: "
f"{quote.sequence} <= {previous.sequence}"
)
self._quotes.update(quotes)
def complete_snapshot(self) -> bool:
return all(symbol in self._quotes for symbol in SYMBOLS)
def get(self, symbol: str) -> Quote:
return self._quotes[symbol]
def max_age_ms(self, now_ms: int) -> int:
return max(now_ms - self._quotes[symbol].exchange_ts_ms for symbol in SYMBOLS)
def max_timestamp_skew_ms(self) -> int:
timestamps = [
self._quotes[symbol].exchange_ts_ms
for symbol in SYMBOLS
]
return max(timestamps) - min(timestamps)
def as_decimal(value) -> Decimal:
return Decimal(str(value))
def parse_quote_batch(message: dict) -> Dict[str, Quote]:
if message.get("type") != "quote_batch":
raise ValueError("Expected a quote_batch message")
raw_quotes = message.get("quotes")
if not isinstance(raw_quotes, list):
raise ValueError("quote_batch.quotes must be a list")
parsed: Dict[str, Quote] = {}
for item in raw_quotes:
quote = Quote(
symbol=str(item["symbol"]),
bid=as_decimal(item["bid"]),
ask=as_decimal(item["ask"]),
exchange_ts_ms=int(item["ts"]),
sequence=int(item["seq"]),
)
quote.validate()
parsed[quote.symbol] = quote
if set(parsed) != set(SYMBOLS):
raise ValueError(
f"Incomplete triangle: expected {SYMBOLS}, received {tuple(parsed)}"
)
return parsed
def calculate_cycles(book: QuoteBook) -> list[CycleResult]:
eur_usd = book.get("EUR/USD")
gbp_usd = book.get("GBP/USD")
eur_gbp = book.get("EUR/GBP")
# EUR -> USD -> GBP -> EUR:
# sell EUR/USD, buy GBP/USD, buy EUR/GBP.
ratio_forward = eur_usd.bid / (gbp_usd.ask * eur_gbp.ask)
# EUR -> GBP -> USD -> EUR:
# buy EUR/GBP, sell GBP/USD, buy EUR/USD.
ratio_reverse = (eur_gbp.ask * gbp_usd.bid) / eur_usd.ask
total_friction_bps = FRICTION_BPS_PER_LEG * Decimal("3")
forward = CycleResult(
direction="EUR->USD->GBP->EUR",
gross_ratio=ratio_forward,
gross_bps=(ratio_forward - Decimal("1")) * Decimal("10000"),
net_bps=(
(ratio_forward - Decimal("1")) * Decimal("10000")
- total_friction_bps
),
)
reverse = CycleResult(
direction="EUR->GBP->USD->EUR",
gross_ratio=ratio_reverse,
gross_bps=(ratio_reverse - Decimal("1")) * Decimal("10000"),
net_bps=(
(ratio_reverse - Decimal("1")) * Decimal("10000")
- total_friction_bps
),
)
return [forward, reverse]
def build_authenticated_url(base_url: str, api_key: str) -> str:
if not api_key:
raise ValueError("FOREX_API_KEY is required")
parts = urlsplit(base_url)
if parts.scheme != "wss":
raise ValueError("FOREX_WS_URL must use wss://")
query = dict(part.split("=", 1) for part in parts.query.split("&") if part)
query["api_key"] = api_key
return urlunsplit(
(
parts.scheme,
parts.netloc,
parts.path,
urlencode(query),
parts.fragment,
)
)
def emit_alert(
result: CycleResult,
book: QuoteBook,
batch_id: int,
max_age_ms: int,
timestamp_skew_ms: int,
) -> None:
alert = {
"event": "forex_triangular_arbitrage_candidate",
"batch_id": batch_id,
"direction": result.direction,
"gross_bps": float(result.gross_bps),
"net_bps": float(result.net_bps),
"threshold_bps": float(MIN_NET_EDGE_BPS),
"max_quote_age_ms": max_age_ms,
"timestamp_skew_ms": timestamp_skew_ms,
"quotes": {
symbol: {
"bid": str(book.get(symbol).bid),
"ask": str(book.get(symbol).ask),
"ts": book.get(symbol).exchange_ts_ms,
"seq": book.get(symbol).sequence,
}
for symbol in SYMBOLS
},
}
print(json.dumps(alert, separators=(",", ":")), flush=True)
async def consume_feed(ws_url: str, api_key: str) -> None:
authenticated_url = build_authenticated_url(ws_url, api_key)
book = QuoteBook()
# ⚠️ This service assumes the normalized feed protocol described above.
# ⚠️ Keep venue-specific authentication inside the feed adapter.
# ⚠️ For colocated or ultra-low-latency execution, replace this generic
# WebSocket transport with the venue's native binary protocol.
async with websockets.connect(
authenticated_url,
open_timeout=10,
close_timeout=5,
ping_interval=20,
ping_timeout=10,
max_size=1_000_000,
) as websocket:
await websocket.send(
json.dumps(
{
"cmd": "subscribe",
"symbols": list(SYMBOLS),
"mode": "snapshot",
}
)
)
last_heartbeat = time.monotonic()
while True:
elapsed = time.monotonic() - last_heartbeat
if elapsed >= HEARTBEAT_INTERVAL_SECONDS:
await websocket.send(
json.dumps(
{
"cmd": "ping",
"ts": int(time.time() * 1000),
}
)
)
last_heartbeat = time.monotonic()
try:
raw_message = await asyncio.wait_for(
websocket.recv(),
timeout=HEARTBEAT_INTERVAL_SECONDS,
)
except asyncio.TimeoutError:
# The explicit heartbeat above keeps the application layer alive.
continue
message = json.loads(raw_message)
message_type = message.get("type")
if message_type == "pong":
continue
if message_type == "error":
code = int(message.get("code", 0))
if code == 3001:
retry_after = int(message.get("retry_after", 5))
await asyncio.sleep(retry_after)
continue
if code in (1001, 1002):
raise PermissionError(
"Invalid or missing feed API key; check FOREX_API_KEY"
)
raise RuntimeError(
f"Feed error {code}: {message.get('message', 'unknown error')}"
)
if message_type != "quote_batch":
continue
batch_id = int(message["batch_id"])
quotes = parse_quote_batch(message)
book.update_batch(quotes)
now_ms = int(time.time() * 1000)
max_age_ms = book.max_age_ms(now_ms)
timestamp_skew_ms = book.max_timestamp_skew_ms()
if max_age_ms > MAX_QUOTE_AGE_MS:
continue
if timestamp_skew_ms > MAX_TIMESTAMP_SKEW_MS:
continue
for result in calculate_cycles(book):
if result.executable:
emit_alert(
result=result,
book=book,
batch_id=batch_id,
max_age_ms=max_age_ms,
timestamp_skew_ms=timestamp_skew_ms,
)
async def run() -> None:
ws_url = os.environ.get("FOREX_WS_URL")
api_key = os.environ.get("FOREX_API_KEY")
if not ws_url:
raise ValueError("FOREX_WS_URL is required")
if not api_key:
raise ValueError("FOREX_API_KEY is required")
retry = 0
while True:
try:
await consume_feed(ws_url, api_key)
retry = 0
except (
ConnectionClosed,
asyncio.TimeoutError,
ConnectionError,
OSError,
ValueError,
) as error:
print(
json.dumps(
{
"event": "feed_connection_error",
"error": type(error).__name__,
"detail": str(error),
}
),
flush=True,
)
delay = min(
RECONNECT_BASE_SECONDS * (2 ** retry),
RECONNECT_MAX_SECONDS,
)
jitter = random.uniform(0, delay * 0.1)
await asyncio.sleep(delay + jitter)
retry = min(retry + 1, 10)
if __name__ == "__main__":
try:
asyncio.run(run())
except KeyboardInterrupt:
pass
4.1 Environment Configuration
The service expects two environment variables:
export FOREX_WS_URL="wss://your-feed.example/stream"
export FOREX_API_KEY="your-feed-api-key"
Install the dependency and start the monitor:
python -m pip install "websockets>=12,<16"
python forex_triangle_monitor.py
The example deliberately does not embed a provider URL or credential. FX feeds differ substantially in symbol formats, authentication, subscription semantics, and timestamp conventions. Copying a provider’s request format without checking its execution conditions creates a misleading example.
4.2 Operational Safeguards
Before enabling order routing, add the following controls:
| Control | Reason |
|---|---|
| Maximum quote age | Prevents stale-price signals |
| Maximum timestamp skew | Prevents mixing asynchronous quotes |
| Minimum executable edge | Filters sub-cost residuals |
| Maximum deviation from reference price | Detects bad ticks |
| Per-symbol notional cap | Limits quote-size exposure |
| Duplicate alert suppression | Prevents repeated webhook or order storms |
| Circuit breaker | Stops trading after sequence or reconciliation errors |
| Fill reconciliation | Detects partial or rejected legs |
The alert threshold should also be volatility-aware. A fixed 1 bp threshold may be meaningful in a quiet session and excessive during a central-bank announcement.
5. Converting a Signal into Executable Orders
5.1 Basket Execution
The preferred execution method is a basket or atomic multi-leg order. Some venues and brokers expose this functionality directly; others require the application to manage the legs.
For the forward cycle:
[
EUR \rightarrow USD \rightarrow GBP \rightarrow EUR
]
the application must determine the notional for each leg from the same base amount:
[
N_{EUR/USD} = N
]
[
N_{GBP/USD} = N \cdot \frac{A_{bid}}{B_{ask}}
]
[
N_{EUR/GBP} = N \cdot \frac{A_{bid}}{B_{ask}q_{ask}}
]
where (N) is the EUR-denominated base notional.
For the reverse cycle:
[
EUR \rightarrow GBP \rightarrow USD \rightarrow EUR
]
the quantities are:
[
N_{EUR/GBP} = N
]
[
N_{GBP/USD} = N \cdot q_{ask}
]
[
N_{EUR/USD} = N \cdot \frac{q_{ask}B_{bid}}{A_{ask}}
]
The formulas specify economic quantities, not necessarily broker order quantities. Production code must apply:
- Minimum lot size.
- Price increment.
- Currency rounding rules.
- Available balance and margin.
- Maximum order notional.
- Funding requirements.
5.2 Legging Risk
A sequential execution can fail after the first leg fills:
- EUR/USD fills.
- GBP/USD is rejected.
- The system now holds unintended EUR and USD exposure.
That is not an arbitrage; it is an unhedged directional position.
A resilient execution controller should define the state machine before sending orders:
NEW
├── Partially filled
│ ├── Complete remaining legs
│ ├── Unwind filled legs
│ └── Enter failed state
├── Rejected
│ └── Unwind any filled legs
└── Completely filled
└── Reconcile positions and realized result
The controller must also define a timeout. If the basket does not complete within the strategy’s permitted window, it should either hedge the residual immediately or reduce exposure according to a pre-tested policy.
5.3 Funding and Balance-Sheet Costs
A short-duration signal can still lose money because the triangle requires currency balances.
The system should subtract:
- Overnight funding in each currency.
- Commission per leg.
- Bid-ask spread.
- Market impact.
- Conversion between reporting and settlement currencies.
- Balance-sheet or holding costs.
- Withdrawal or settlement charges where applicable.
The residual can also change after execution. Final profitability should be calculated from actual fills:
[
P_{net}
Value_{final}
Value_{initial}
Commissions
Funding
Slippage
]
6. Feed Selection Criteria
The feed is part of the strategy, not a replaceable utility.
| Characteristic | Polling-oriented feed | Streaming institutional feed | Venue-native feed |
|---|---|---|---|
| Update mechanism | Periodic REST snapshots | Push updates | Direct venue protocol |
| Latency consistency | Variable | Generally lower and more predictable | Lowest infrastructure overhead |
| Atomic multi-symbol data | Often unavailable | Sometimes available | Often available at venue level |
| Timestamp detail | May be coarse | Exchange and receipt timestamps | Native exchange sequence data |
| Quoted size | Sometimes absent | Often present | Usually available |
| Operating complexity | Low | Moderate | High |
| Appropriate use | Research and periodic monitoring | Live signal monitoring | Low-latency execution |
The important distinction is not whether a provider claims “real-time” data. It is whether the feed can provide a coherent, timestamped, executable view of all three quotes at the moment the system makes a decision.
For backtests, the same standard applies. A historical dataset should preserve the quote state available at each decision time. Applying current spreads to historical mid-prices systematically overstates arbitrage returns.
7. Deployment Guide
7.1 Recommended Configurations
| User segment | Feed architecture | Signal logic | Execution model |
|---|---|---|---|
| Researcher | Historical snapshots or periodic REST data | Synthetic residual and diagnostics | Paper execution |
| Individual developer | Streaming WebSocket feed | Both executable cycles with conservative friction | Manual or broker API execution |
| Small systematic team | Multi-venue streaming feed | Cross-venue consistency and latency filters | Basket orders with reconciliation |
| Institutional team | Venue-native feeds plus normalized event bus | Microsecond-aware state, inventory controls | Atomic or hedged multi-leg execution |
7.2 Initial Validation Procedure
Before allowing the monitor to submit orders, run the service through four stages.
Stage One: Snapshot Validation
Replay fixed quote snapshots and verify:
- The synthetic rate matches the reference calculation.
- Both cycle directions are calculated correctly.
- Decimal rounding does not reverse the sign of small edges.
- Friction is deducted exactly once.
Stage Two: Replay Validation
Use timestamped market snapshots and ensure that the system does not combine quotes from different replay events. Include cases with missing symbols, delayed timestamps, crossed markets, and duplicate sequences.
Stage Three: Shadow Execution
Generate intended orders without sending them. Compare the model’s quantities and prices with the actual market state several milliseconds later. Track:
- Signal-to-order latency.
- Edge decay.
- Expected versus executable spread.
- Missing update frequency.
- Reconnect behavior.
Stage Four: Limited Live Execution
Begin with the smallest broker-valid notional. Reconcile every fill against the internal state machine. Expand the size only after slippage and rejection rates remain within assumptions.
7.3 Capability Boundaries for TickDB
TickDB does not support forex order-book depth. Its depth channel covers US equities at L1, Hong Kong equities at L1–L10, and crypto at L1–L10; it does not support forex, precious metals, or indices.
Accordingly, the EUR/USD–GBP/USD–EUR/GBP monitor in this article must use a licensed FX feed or a broker-native stream. TickDB should not be presented as an alternative source for these depth or trade events.
TickDB is relevant when the same research pipeline expands into supported markets:
- US equity historical OHLCV through the
/v1/market/klineendpoint. - Current US equity candles through
/v1/market/kline/latest. - US equity L1 or Hong Kong equity L1–L10 depth.
- Supported crypto and Hong Kong equity trade streams.
Keeping that boundary explicit prevents the monitor from generating alerts against nonexistent or unsupported data.
8. Operational Checklist
A production-ready triangle monitor should satisfy the following conditions:
Market data
- All three symbols come from the same venue or an explicitly modeled cross-venue setup.
- Quotes include bid, ask, exchange timestamp, and sequence.
- The feed exposes executable size where available.
- The system rejects stale snapshots.
- The system rejects timestamp skew above the configured limit.
- Reconnects never reuse a previously processed sequence.
Signal calculation
- The synthetic EUR/GBP rate uses
EUR/USD / GBP/USD. - Both executable cycle directions are calculated.
- Gross and net edge are reported separately.
- Spread, friction, and funding assumptions are explicit.
- The minimum edge is volatility-aware.
- Quote anomalies and crossed books are rejected.
Execution
- The system prefers atomic basket execution.
- Partial-fill behavior has a tested unwind path.
- Notional, lot size, and currency rounding are enforced.
- Inventory and margin checks occur before submission.
- Every fill is reconciled against the expected triangle.
- Repeated alerts cannot create duplicate orders.
Security
- API credentials come from environment variables.
- Credentials are absent from application logs.
- The WebSocket connection uses TLS.
- API permissions are restricted to required operations.
- Production and test credentials are separated.
9. Conclusion
Three quotes. Two milliseconds. One temporarily broken identity.
The EUR/USD–GBP/USD–EUR/GBP triangle becomes actionable only when the monitor moves beyond mid-price consistency. It must use executable prices, synchronized timestamps, explicit friction, and an execution model that can manage partial fills.
The key insight is straightforward: triangular arbitrage is not the multiplication of three displayed prices. It is the coordinated execution of three currency conversions whose net residual remains positive after every cost and risk constraint.
Next Steps
If you are building an FX research pipeline, connect the monitor to a licensed streaming feed and validate the signal against timestamped snapshots before enabling execution.
If you want to develop the monitoring service, begin with the normalized feed contract, atomic quote batches, and both executable-cycle calculations. Add broker-specific authentication and order routing only after the state and reconciliation logic is stable.
If your strategy also covers supported equities or crypto markets, TickDB provides US equity historical OHLCV, current candle data, and supported-market depth and trade streams. Visit tickdb.ai to create an API key, or contact [email protected] for institutional data requirements.
If you use AI coding assistants, search for and install the tickdb-market-data SKILL in your tool’s marketplace.
This article does not constitute investment advice. Markets involve risk; past performance does not guarantee future results.