Barfinex

How Barfinex Works

Signals context API — strategy context and triggers

How Barfinex provides HTF context (candles, bias, zones) and order-flow data for strategies and the Advisor. GET /signals/context/:symbol and response shape.

What this is for

Barfinex supports a context + trigger approach for strategies and the Advisor:

  • Higher-timeframe (HTF) candles (e.g. D1, H4, H1) provide context: regime, bias, levels, zones of interest.
  • Intraday order flow and order book provide entry timing: absorption, order book imbalance, sweep and reclaim, pullback with confirmation.
  • Risk and exit can be derived from HTF zones (e.g. stop beyond a zone, target at mid or opposite boundary).

The platform exposes this via the signals context API and related event streams so detectors and the Advisor can work with a consistent view of context and triggers.


Provider API: GET /api/signals/context/:symbol

This endpoint returns a normalized context for a symbol: candles (D1/H4/H1), order-flow aggregates, order-book aggregates, and optional context features (bias, regime, levels, zones).

Query parameters

ParameterDescriptionDefault (typical)
connectorTypeConnector (e.g. binance)binance
marketTypeMarket (spot, futures, margin)futures
daysD1Days of D1 history365
daysH4Days of H4 history180
daysH1Days of H1 history90
candlesModeFULL — return candle arrays; DELTA — omit candles if key matchesFULL
candlesKeyCache key from previous response; used with candlesMode=DELTA to avoid resending unchanged candles

Example request (full context)

curl "http://localhost:8080/api/signals/context/BTCUSDT?connectorType=binance&marketType=futures&daysD1=365&daysH4=180&daysH1=90"

Example request (delta — avoid resending candles)

curl "http://localhost:8080/api/signals/context/BTCUSDT?connectorType=binance&marketType=futures&candlesMode=DELTA&candlesKey=<lastCandlesKey>"

Response shape (main parts)

candles

  • cacheKey — Key you can send back as candlesKey for delta mode.
  • h1, h4, d1 — Arrays of candles (time, open, high, low, close, volume). Omitted or replaced with only cacheKey when candlesMode=DELTA and key matches.

orderFlow (aggregates)

Summary metrics for triggers (not tick-by-tick): e.g. delta ratio, CVD, absorption score, trade count, average/max trade size, buy/sell volume, delta, VWAP.

orderBook (aggregates)

  • Best bid/ask, mid, spread, spread %, imbalance, bid/ask wall (e.g. in USD).

contextFeatures (optional)

Compact HTF context computed by the provider: bias (e.g. LONG/SHORT/NEUTRAL), regime (e.g. range/trend), levels (htfHigh, htfLow, htfMid), and zones (e.g. HTF_LOW, HTF_HIGH with range and timeframe). Used by the Advisor and detectors as a quick summary; candles remain the full source when needed.


How detectors and Advisor use it

  • Detectors — Can use context (bias, zones) and trigger logic (order flow, order book) in a pipeline: e.g. no trade against HTF bias, entry only inside a zone, risk/exit from HTF range.
  • Advisor — Receives context features and aggregates (and optionally candle summaries) in the decision payload; full candle arrays are not required for the LLM but are available in the detector/context pipeline when needed.

For full API details, see Provider API reference. For architecture, see Barfinex architecture.

Let’s Get in Touch

Have questions or want to explore Barfinex? Send us a message.