Barfinex

How Barfinex Works

Detector installation

This step describes how to connect Barfinex Provider with the Detector service to pass market data and signals via Redis Pub/Sub.

🔄 Integration with Detector

After successfully starting the Provider, the next step is integration with the Detector service, which analyzes market data, builds indicators, and generates trading signals.


1️⃣ What is Detector

Barfinex Detector is an analytics engine that:

  • receives a data stream from Provider (via Redis Pub/Sub),
  • calculates custom and built-in indicators (SMA, EMA, VWAP, etc.),
  • applies strategy rules and plugins (e.g. Volume Follow, Orderflow Trade Analytics),
  • generates signals for Advisor and Inspector.

2️⃣ Redis channels for communication

Provider and Detector exchange data via Redis Pub/Sub. Main channels:

ChannelPurpose
PROVIDER_MARKETDATA_CANDLECandlestick stream (OHLCV)
PROVIDER_MARKETDATA_TRADETrades stream
PROVIDER_MARKETDATA_ORDERBOOKOrder book stream
DETECTOR_EVENTResponses and signals from Detector
ADVISOR_EVENTSignal delivery to Advisor
INSPECTOR_EVENTAnalytics delivery to Inspector

3️⃣ Configuration setup

Open the file docker-config/config.detector.json and ensure that Redis and Provider parameters are set correctly:

{
  "redis": {
    "host": "redis",
    "port": 6379
  },
  "provider": {
    "url": "https://provider:8081/api",
    "key": "a3dc8b9bf681f4e6f334d2f1077f3272ae034c9b4f4925bfa731b0ee963d1074"
  },
  "detector": {
    "name": "main-detector",
    "plugins": ["orderflow-trade-analytics", "trade-journal"]
  }
}

4️⃣ Connecting Detector to Provider

If Detector runs as a separate microservice, ensure it is attached to the barfinapp-network:

  detector:
    container_name: detector
    image: barfinex/detector:latest
    restart: always
    env_file:
      - .env
    networks:
      - barfinapp-network
    depends_on:
      - redis
      - provider
    volumes:
      - ./docker-config:/usr/src/app/config

5️⃣ Verifying communication between services

After startup, verify that Detector receives data from Provider:

docker logs -f detector

You should see lines like:

[Nest] 18  - Connected to Redis: redis://redis:6379
[Nest] 18  - Subscribed: PROVIDER_MARKETDATA_CANDLE
[Nest] 18  - Subscribed: PROVIDER_MARKETDATA_TRADE
[Nest] 18  - Subscribed: PROVIDER_MARKETDATA_ORDERBOOK
[Nest] 18  - Received market data from provider

6️⃣ Verifying signal delivery

Open Redis Commander or use the CLI:

docker exec -it redis redis-cli
SUBSCRIBE DETECTOR_EVENT

You should see publications of signals sent by Detector.


Let’s Get in Touch

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