Barfinex

Getting started

Understanding Barfinex Provider Logs

A detailed guide to Barfinex Provider logs — startup stages, typical messages, common errors, and quick diagnostic techniques.

🔍 Map of Barfinex Provider logs

When it starts, Barfinex Provider goes through several initialization stages: loading certificates, reading configuration, connecting to Redis, checking Binance, and launching REST/WebSocket APIs. Each stage is reflected in the logs — knowing this sequence, you can quickly see from the first lines whether everything went well and where to look for a problem.

How to view Barfinex Provider logs

Use:

docker compose logs -f provider

1️⃣ HTTPS enabled

✅ HTTPS включён (сертификаты загружены)

What it means
Certificates were found and loaded successfully. The server is available at:

  • https://localhost:8081
  • or at your domain, if you configured production certificates.

Typical issues

  • ENOENT: no such file or directory, open './cert.pem' — certificate not found.
    → check the path and file names in config or env vars (SSL_CERT_PATH, SSL_KEY_PATH).

  • Need a self‑signed certificate?
    → generate it with mkcert localhost and put the files into the directory referenced in docker-compose.yml (./cert/...).


2️⃣ Configuration loaded

🧩 Config path resolved to: ...config.json
📄 Loading nested config for "provider": config.provider.json
✅ Configuration successfully loaded.

What it means
The main config and nested JSON files were found and parsed correctly.

Typical issues

  • File not found
    → the required JSON file is missing. Create it from a template (config.example.provider.json or a similar one).

  • Error parsing JSON
    → syntax error in JSON. Check for:

    • extra/missing commas;
    • broken quotes;
    • unclosed objects/arrays.
  • Barfinex Provider key not found
    → the provider.connectors block lacks the required connector.
    → add an object with key and secret for the desired connection (for example, Binance).


3️⃣ NestJS modules initialized

[Nest] ... LOG [InstanceLoader] ConfigModule dependencies initialized

What it means
NestJS modules have been initialized successfully and dependencies are resolved.

Typical issues

  • Cannot find module '@barfinex/types'
    → a problem with project dependencies or tsconfig-paths. Check:

    • package installation;
    • paths settings in tsconfig.
  • Nest can't resolve dependencies
    → a missing module import or a missing forwardRef.
    → verify that all modules are imported in the correct order.


4️⃣ Connected to Redis

Connecting to Redis on localhost:6379
✅ Connected to Redis successfully!

What it means
Barfinex Provider successfully connected to Redis; events and queues are available.

Typical issues

  • ECONNREFUSED 127.0.0.1:6379
    → Redis is not running or not reachable at the given address.
    → check:

    • whether the redis container is running (docker compose ps);
    • values of REDIS_HOST and REDIS_PORT in .env.
  • Invalid TCP port
    → invalid port value. Make sure it’s a number, not a string with extra characters.


5️⃣ Binance API initialization

🧩 BinanceService initializing...
🔑 connectorKey (truncated): oQ9Ulh...
✅ Binance API initialized successfully

What it means
Barfinex Provider found the Binance connector configuration and successfully created an API client.

Typical issues

MessageCauseWhat to do
Binance connector not foundNo block with "connectorType": "binance"Add the connector to the config
Binance API credentials missingNo key/secret specifiedProvide keys in the config or .env
Invalid Binance time responseBinance not responding or returned bad dataCheck access to api.binance.com and the network

6️⃣ Binance time check

🕒 Binance time: 2025-10-31 08:53:42, Local: 2025-10-31 08:53:41

What it means
Binance time and local time are in sync, with a difference ≤ 1 second.
This is important for proper subscriptions and order handling.

Typical issues

  • FetchError
    → no internet access or traffic to Binance is blocked.
    → try:

    • checking network connectivity;
    • using a VPN;
    • configuring HTTPS_PROXY if you need a proxy.
  • Error 418 or other blocking codes
    → IP or keys might be banned.
    → change IP/keys or reduce request frequency.


7️⃣ WebSocket and REST API are ready

🚀 Barfinex Provider API is running on: https://localhost:8081/api
📑 Documentation: https://localhost:8081/docs
🔌 WebSocket (Socket.IO) at: https://localhost:8081/ws

What it means
Barfinex Provider is fully up:

  • REST API is available at /api;
  • Swagger docs — at /docs;
  • WebSocket (Socket.IO) — at /ws.

Typical issues

  • EADDRINUSE: address already in use :8081
    → the port is occupied by another process.
    → free the port or change it in .env and docker-compose.yml.

  • Cannot read property 'use' of undefined
    → error in middleware or main.ts configuration.
    → check your custom filters, interceptors, and middleware.


🧠 Monitoring best practices

PracticeDescription
Log key stagesModuleInit, Config Loaded, Redis Connected, API Ready
Colored loggingUse nestjs-pino, winston, or similar
Health endpoint/api/health should check Redis and Binance ping
Auto‑retry RedisMake several connection attempts with backoff
Pre‑startup validationValidate keys and config structure before NestFactory.create()

🧩 Example of a successful startup

✅ HTTPS включён (сертификаты загружены)
🧩 Config path resolved to: ...config.json
✅ Configuration successfully loaded.
✅ Connected to Redis successfully!
🔑 connectorKey (truncated): oQ9Ulh...
✅ Binance API initialized successfully
🕒 Binance time: 2025-10-31 08:53:42, Local: 2025-10-31 08:53:41
✅ BinanceService ModuleInit complete
🚀 Barfinex Provider API is running on: https://localhost:8081/api
📑 Documentation: https://localhost:8081/docs
🔌 WebSocket (Socket.IO) at: https://localhost:8081/ws

If all lines with appear and there are no errors, Barfinex Provider is ready for work.


📎 Useful commands

# Check Redis availability
redis-cli ping

# Check access to Binance
curl https://api.binance.com/api/v3/time

# Validate JSON config
jq . config/config.provider.json

# See which process uses port 8081 (Windows)
netstat -ano | find "8081"

# Local dev-mode start of Barfinex Provider (if supported)
npm run start:provider:dev

🧰 Troubleshooting summary

SymptomPossible causeFix
Barfinex Provider key not foundMissing key in connectorsAdd Binance keys to the config
ECONNREFUSED RedisRedis not runningdocker compose up redis
API not initializedBinanceService failed to startCheck keys and network connectivity
Invalid JSONSyntax error in configValidate using jq and a code editor
✅ Everything is greenNo errorsService is fully ready

📘 Log recap

  • Each log block corresponds to a specific Barfinex Provider startup stage.
  • Icons , 🧩, 🕒, 🚀 help you visually understand the status.
  • Redis, config, or Binance issues can be found and fixed in minutes.
  • It’s a good idea to store startup logs in CI/CD to automatically control deployment success.

📊 Registering Barfinex Provider in Studio Barfinex

Why register Barfinex Provider in Studio

Even if Barfinex Provider is already running, it’s important to connect it to Studio Barfinex:

  • Visual health monitoring
    See whether the provider is alive, whether there are errors, and how the exchange connection behaves.

  • Real‑time data monitoring
    Charts, tables, events — you immediately see that Barfinex Provider is actually sending data.

  • Diagnostics and strategy debugging
    Make sure signals, orders, and events flow exactly as you expect.

  • Single control panel
    If you have several Barfinex Provider instances (testnet, prod, different exchanges), Studio lets you manage them all from one place.


High‑level connection flow

  1. Start Barfinex Provider using the steps from the “Quick start Barfinex Provider” section.
  2. Ensure the Barfinex Provider API is available over HTTPS (for example, https://your-domain.com/api).
  3. Log in to https://studio.barfinex.com.
  4. Navigate to the section that manages providers (for example, “Data Sources” or “Barfinex Providers”).
  5. Create a new Barfinex Provider:
    • specify a name (for example, Binance Spot Prod);
    • add the API URL (base URL of your Barfinex Provider);
    • optionally add a description and tags (testnet/prod etc.).
  6. Save the settings and verify that the Barfinex Provider status changes to “Online” (or similar).

⚠️ Exact section names and fields may differ between Studio versions.
This part explains why and in broad strokes how to connect; a click‑by‑click guide with screenshots can live in a separate document.


What you’ll see after connecting

After registering Barfinex Provider in Studio:

  • the interface shows a card with your Provider and its current status;
  • basic metrics become available (uptime, latest errors, service version);
  • you can view data streams and events produced by Barfinex Provider;
  • it becomes easier to see whether a problem is in a strategy, exchange connection, or infrastructure.

Integration recap with Studio

  • Barfinex Provider without Studio is a “black box” on a server.
  • Barfinex Provider connected to Studio is a transparent, observable component of the overall Barfinex ecosystem.
  • We recommend registering every Barfinex Provider instance (dev/stage/prod, different exchanges) for convenient monitoring and operations.

Let’s Get in Touch

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