Barfinex

How Barfinex Works

Provider API reference

REST and WebSocket API of the Barfinex Provider: accounts, orders, candles, connectors, proxy to Advisor/Inspector/Detector, and real-time events.

Overview

The Provider is the single entry point for the Barfinex platform. All REST and WebSocket traffic from the front-end or integrators goes through the Provider.

  • REST base: {baseUrl}/api (e.g. http://localhost:8080/api)
  • WebSocket: {baseUrl}/ws (Socket.IO, path /ws)
  • Auth: Authorization: Bearer <token> or header x-api-token: <token>

Interactive API docs: {baseUrl}/docs. OpenAPI JSON: {baseUrl}/docs-json.


Main REST areas

AreaEndpoints (examples)
OptionsGET /options — Provider metadata, connectors, detectors, accounts
AccountsGET /accounts, GET /accounts/:connectorType/:marketType, PUT /accounts/leverage
AssetsGET /assets/:connectorType/:marketType
SymbolsGET /symbols/:connectorType/:marketType
CandlesGET /candles/:connectorType/:marketType/:symbol/:interval (query: from, to, days)
OrdersPOST /orders, GET /orders/:orderId, PUT /orders/close, PUT /orders/:orderId, plus detector-scoped order endpoints
ConnectorsGET /connectors, GET /connectors/:connectorType/:marketType
DetectorsGET /detectors, GET /detectors/:key, POST /detectors, PUT /detectors/:key, DELETE /detectors/:key
InspectorsGET /inspectors, GET /inspectors/:sysname, POST /inspectors, PUT /inspectors/:sysname, DELETE /inspectors/:sysname
SubscriptionsGET /subscriptions
ReplayPOST /replay/start, POST /replay/stop (body: from, to, speed, symbols)
Signals contextGET /signals/context/:symbol (query: connectorType, marketType, daysD1, daysH4, daysH1, candlesMode, candlesKey)
EventSinkGET /eventsink (query: page, limit, category, symbol, from, to, search)
DashboardGET /dashboard/overview (query: windowMinutes)

Proxy to Advisor, Inspector, Detector

The Provider proxies requests to registered apps. Use one base URL and path pattern:

TargetMethodProvider pathDescription
AdvisorALL/advisors/:appKey/*Proxies to Advisor API
InspectorALL/inspectors/:appKey/*Proxies to Inspector API
DetectorALL/detectors/:appKey/*Proxies to Detector API
DiscoveryGET/proxy/targetsList available proxy targets by type

Example: GET /api/inspectors/inspector/inspector/risk/dashboard → Provider forwards to the Inspector’s risk dashboard endpoint. The appKey (e.g. inspector, advisor, detector) is the key the app used when registering.


App Registry

Apps register with the Provider so it can proxy and list them in Studio:

MethodPathPurpose
POST/apps/registry/registerRegister an app (advisor/inspector/detector)
POST/apps/registry/heartbeatUpdate activity
POST/apps/registry/unregisterUnregister
GET/apps/registryList registered apps (query: appType, includeInactive)
GET/apps/registry/:appType/:appKeyGet one app

WebSocket API

  • URL: {baseUrl}/ws, path /ws
  • Namespaces: default (main events), /eventsink (audit/analytics stream)

Catalog of events: GET /api/ws/events/catalog returns all WS event names with short descriptions (EN/RU).

Default namespace: Subscribe to event names (same as bus channel names). Examples:

  • PROVIDER_MARKETDATA_TRADE, PROVIDER_MARKETDATA_ORDERBOOK, PROVIDER_MARKETDATA_CANDLE
  • PROVIDER_ACCOUNT_EVENT, PROVIDER_ORDER_CREATE, PROVIDER_ORDER_CLOSE
  • PROVIDER_SYMBOLS, PROVIDER_SYMBOL_PRICES
  • INSPECTOR_RISK_LIMIT_BREACH, INSPECTOR_RISK_KILL_SWITCH
  • DETECTOR_SIGNAL_GENERATED, DETECTOR_SIGNAL_UPDATED, DETECTOR_SIGNAL_INVALIDATED
  • DETECTOR_POSITION_OPEN_REQUEST, DETECTOR_POSITION_CLOSE_REQUEST, …
  • ADVISOR_DECISION_RESPONSE, ADVISOR_DECISION_CONTEXT_SNAPSHOT

Client → server: health (get health:ok), message (example).

Eventsink namespace: listen to event for real-time audit/analytics events.


Common enums

  • ConnectorType: e.g. binance, alpaca, testnetBinanceFutures
  • MarketType: spot, futures, margin
  • TimeFrame (candles): min1, min5, min15, min30, h1, h2, h4, day, week, month
  • OrderSide: BUY, SELL
  • OrderType: MARKET, LIMIT, STOP_MARKET, TAKE_PROFIT_MARKET, …

Next steps

Let’s Get in Touch

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