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 headerx-api-token: <token>
Interactive API docs: {baseUrl}/docs. OpenAPI JSON: {baseUrl}/docs-json.
Main REST areas
| Area | Endpoints (examples) |
|---|---|
| Options | GET /options — Provider metadata, connectors, detectors, accounts |
| Accounts | GET /accounts, GET /accounts/:connectorType/:marketType, PUT /accounts/leverage |
| Assets | GET /assets/:connectorType/:marketType |
| Symbols | GET /symbols/:connectorType/:marketType |
| Candles | GET /candles/:connectorType/:marketType/:symbol/:interval (query: from, to, days) |
| Orders | POST /orders, GET /orders/:orderId, PUT /orders/close, PUT /orders/:orderId, plus detector-scoped order endpoints |
| Connectors | GET /connectors, GET /connectors/:connectorType/:marketType |
| Detectors | GET /detectors, GET /detectors/:key, POST /detectors, PUT /detectors/:key, DELETE /detectors/:key |
| Inspectors | GET /inspectors, GET /inspectors/:sysname, POST /inspectors, PUT /inspectors/:sysname, DELETE /inspectors/:sysname |
| Subscriptions | GET /subscriptions |
| Replay | POST /replay/start, POST /replay/stop (body: from, to, speed, symbols) |
| Signals context | GET /signals/context/:symbol (query: connectorType, marketType, daysD1, daysH4, daysH1, candlesMode, candlesKey) |
| EventSink | GET /eventsink (query: page, limit, category, symbol, from, to, search) |
| Dashboard | GET /dashboard/overview (query: windowMinutes) |
Proxy to Advisor, Inspector, Detector
The Provider proxies requests to registered apps. Use one base URL and path pattern:
| Target | Method | Provider path | Description |
|---|---|---|---|
| Advisor | ALL | /advisors/:appKey/* | Proxies to Advisor API |
| Inspector | ALL | /inspectors/:appKey/* | Proxies to Inspector API |
| Detector | ALL | /detectors/:appKey/* | Proxies to Detector API |
| Discovery | GET | /proxy/targets | List 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:
| Method | Path | Purpose |
|---|---|---|
| POST | /apps/registry/register | Register an app (advisor/inspector/detector) |
| POST | /apps/registry/heartbeat | Update activity |
| POST | /apps/registry/unregister | Unregister |
| GET | /apps/registry | List registered apps (query: appType, includeInactive) |
| GET | /apps/registry/:appType/:appKey | Get 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_CANDLEPROVIDER_ACCOUNT_EVENT,PROVIDER_ORDER_CREATE,PROVIDER_ORDER_CLOSEPROVIDER_SYMBOLS,PROVIDER_SYMBOL_PRICESINSPECTOR_RISK_LIMIT_BREACH,INSPECTOR_RISK_KILL_SWITCHDETECTOR_SIGNAL_GENERATED,DETECTOR_SIGNAL_UPDATED,DETECTOR_SIGNAL_INVALIDATEDDETECTOR_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
- Building with the API — Use Provider as the single gateway
- Detector API, Inspector API, Advisor API — Proxied endpoints