Development of a statistics dashboard for a crypto bot with real-time analytics

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1376
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1350
  • B2B Advance company logo design
    B2B Advance company logo design
    796
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1088
  • AIDER company logo development
    AIDER company logo development
    1034
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1130

Crypto bot dashboard: why reports lag behind the market

While the crypto bot dashboard is assembled by manual export — once an hour or once a day — analytics shows not the market, but its yesterday's snapshot. During this window, trading logic manages to open and close dozens of positions and endure a drawdown.

By the time the numbers reach the table, decisions based on them can no longer be made: all that remains is to explain after the fact why the result differs from expectations.

The second problem is discrepancies in reports. Data comes from at least three sources: the bot log, exchange API responses, and records in the internal database.

Each has its own timestamp, capture moment, and rounding rules, while partially filled orders, fees, funding on perpetual contracts, and transfers between subaccounts are not reflected in the bot log at all.

The final profitability stops reconciling with the balance, and the engineer spends hours on reconciliation instead of analyzing the strategy.

Bot data lag costs more than it seems. While only closed trades are visible in the trading bot monitoring, an open position with growing drawdown remains invisible, and risk limits and strategy shutdown trigger late — after the loss has already been realized. Management relies on numbers that are several hours old.

This is solved by streaming trade analytics: events from the bot and exchange go into a single stream, and aggregates for position, fees, and result are recalculated as they arrive, not on a schedule.

The dashboard shows the strategy state at the moment of the request, and discrepancies are caught immediately — at the reconciliation stage, not in the final report. Let's break down how this works.

What streaming trade analytics provides

Streaming trade analytics is not about beautiful charts, but about how many seconds pass from order execution to the moment a human sees it.

If data is pulled by export once every few minutes, arbitrage between pairs is already closed, and incident analysis begins with reconstructing what was happening in the market.

When subscribing to a trade stream, latency fits within a few seconds, and its magnitude immediately shows the bottleneck: ingestion, aggregation, or rendering.

The first effect is freshness: the numbers in the crypto bot dashboard match what strategies are doing right now, so decisions are made based on the current picture, not yesterday's slice.

The second is a single source of data: all trading pairs and position types converge into one loop, and the discrepancy between the exchange report and the internal log surfaces at the moment it appears, not during reconciliation at the end of the day.

The third is that all pairs are visible in one window: there is no need to keep a tab per instrument and manually match event times.

The fourth is that trading bot metrics (profitability, fees, average position holding time, share of canceled orders) are calculated by one rule for all instruments, so strategy comparison no longer depends on who assembled the export.

The fifth is that drawdown alerts arrive by threshold rule: drawdown on a pair, deviation from expected profitability, a series of cancellations — the signal goes to the on-call channel before the problem becomes noticeable in the final report.

Analysis takes minutes instead of an hour, and the class of manual reconciliation errors — missed trades, duplicates, mismatched time zones — disappears along with the manual operation itself.

Crypto bot dashboard operating modes: comparison

Crypto bot dashboard operating modes differ by where metrics come from: from a live event stream, from regular recalculation over accumulated history, or from a combination of both.

The choice determines launch time, load on the trading system, and accuracy of the numbers on screen — and redoing it after handover is more expensive than planning it upfront.

Option When it fits Limitations
Streaming calculation When an in-the-moment reaction is needed: monitoring open positions, risk limits, drawdown Harder launch: the stream requires failure handling and event redelivery
Periodic metric recalculation Reporting and retrospective trade analysis: strategy slices, exchange reconciliation Lag from several minutes; at peak load, recalculation falls behind trades
Hybrid analytics scheme The working case for most bots: some metrics are critical in the moment, the rest are history Reconciliation of two loops is needed, otherwise aggregates diverge from the stream

In practice, we more often deploy a hybrid analytics scheme: streaming calculation holds financial result, open positions, and risk, while periodic metric recalculation fills history and heavy slices — the trading loop receives no analytical queries at all.

We store aggregates in a columnar storage (ClickHouse): it holds millions of events and returns a strategy slice in fractions of a second while the bot continues trading.

If there are few trades, periodic recalculation is sometimes enough — it launches faster and is simpler to maintain.

Implementation stages: from schema audit to handover

Implementation stages of analytics are built around data, not around charts. First we fix where trades and positions come from, then we agree on formulas, and only then does the interface appear.

This order eliminates the classic situation where the crypto bot dashboard shows growth, but independent reconciliation against the trade archive does not confirm it.

  1. Data source audit. Inventory: order and trade history from venues, strategy telemetry, records of fees and transfers. We note where there are gaps, with what delay updates arrive, and which instrument identifiers need to be matched between sources.

  2. Normalization schema. We reduce events to a single model: trade, order, position, fee charge. We bring timestamps to one time zone and resolution, and mark duplicates and partial records with separate flags so they do not enter the calculation.

  3. Metric definition. We agree on a dictionary: how we calculate profitability, realized and unrealized profit, drawdown, win rate. Each metric gets a formula, source, aggregation period, and owner — disputes about numbers turn into edits of a single description line.

  4. Streaming update. We build a loop that receives trade events and updates latest values without full history recalculation. Heavy aggregates are calculated separately on a schedule, so the interface remains responsive under peak load.

  5. Acceptance on historical data. We run metrics on the archive and compare with independent calculation over control periods. Deviation on key indicators must fit within an agreed share, otherwise we look for the cause in normalization, not in display.

  6. Handover and policies. We hand over access, source descriptions, restart rules, the procedure for adding a new metric, and a responsibility matrix. The customer's team can develop the dashboard without our involvement.

Composition of materials handed over: configurations and schemas

We hand over not a set of files, but working documentation by which the customer's team can independently set up the environment, explain a discrepancy in numbers, and change a calculation rule without contacting us. Below is the minimum composition that remains in the customer's environment.

  • Configurations of collection and processing services — connection parameters to sources, trigger thresholds, request limits, retry rules, and timeouts. With comments on which value changes as load grows and what will happen to the streams.
  • Data flow schema — from exchange sources through the queue and storage to the marts from which the dashboard reads. Indicating where data is aggregated, where it is stored in raw form, and at which segment an event may be lost.
  • Metric description — a dictionary of indicators: formula, aggregation window, behavior when data is missing and when the service restarts. It is used to reconcile discrepancies between the report and the exchange.
  • Metric update policy — the procedure for adding a new indicator or changing an existing one: who prepares the edit, how it is tested on historical data, and at what point it enters the working version.
  • Report access roles — a matrix mapping roles and dashboard sections, including restrictions on export and on viewing trading data for individual accounts.
  • Panel description — which widgets and slices are included in each panel, which filters are available, how often values update, and how an incomplete interval is marked.
  • Deployment and recovery instructions — startup sequence, readiness check, rollback procedure to the previous version, and actions when a source is unavailable.

The package is agreed upon using an acceptance checklist: for each item, we record who on the customer's side confirms correctness and in which environment it is checked.

Everything described in the documentation is reproducible in your environment without our engineers — this is a condition for closing the work.

Case study: how discrepancies and data lag were eliminated

Starting point

Before the rework, the crypto bot dashboard was built on a batch job: every 15 minutes, an export of trades from the exchange API, a full recalculation of aggregates, and a rewrite of the mart.

The turnover and profit report lagged the market by 20–40 minutes, and after connection drops, order duplicates appeared in the data — the discrepancy with the account balance reached 4% and was resolved manually.

What was changed and what it delivered

The event stream for orders and trades was moved to incremental writing: each record has an order key, a repeat arrives with the same key and does not create a second row.

Recalculation is triggered only for affected metric windows, not the entire history, and reconciliation with the exchange account was moved to a separate service — it compares positions, balance, and open orders and flags discrepancies. Panels and streaming marts were assembled in Grafana on top of the columnar storage.

  • report lag: 20–40 minutes → 3–5 seconds at the 95th percentile;
  • discrepancy with exchange balance: up to 4% → 0.1%, the remainder is fee rounding;
  • mart recalculation: about 12 minutes → 40 seconds;
  • manual reconciliations: several requests per week → zero.

The idempotency rules and key schema were documented separately — they are what eliminate discrepancies during connection drops, not a specific exchange. Historical aggregates remained nearby, so the period can be recalculated anew without losing the current picture.

How does streaming analytics differ from batch analytics?

The difference is not in the metric formula, but in when it is calculated. Batch analytics works with closed windows: trades are grouped by intervals and aggregated after each group closes.

Streaming calculates for each event immediately, as soon as it arrives from the trading core or from the exchange stream.

For the crypto bot dashboard, this is the difference between a report and an instrument panel.

The batch loop answers what the strategy did over the past interval, while the streaming loop answers what it is doing right now: current drawdown, open positions, deviation of actual execution from calculated.

The price for freshness lies in maintenance. The streaming loop needs idempotent writing, filtering out redelivered trades, windows with tolerance for late events, and correct recalculation of affected aggregates.

An event log such as Apache Kafka maintains message order, but we describe and cover with tests the recalculation rules and window state ourselves.

The processing scheme is chosen by strategy, not by fashion. Scalping, market making, and arbitrage are blind without a streaming layer: a decision is made before the batch window closes.

Portfolio and long-term strategies, reporting, and reconciliations are fine with batch calculation — it is simpler to maintain and more predictable in load.

The working option is a hybrid: a streaming layer for operational control, batch for marts and reconciliation, while both schemes calculate metrics by one definition, otherwise discrepancies in the dashboard cannot be explained.

Technical doubts before starting work

Before starting, the same questions are usually asked: will the dashboard interfere with the trading loop, can the numbers on screen be trusted, who is responsible for analytics after handover.

We address them point by point — the answers are tied to the data collection architecture, not to promises.

Basic principle: the dashboard reads but does not write. The source is the trade log, account and order book state snapshots, balance history; the trading loop remains the sole owner of state, and the collector only mirrors events into a separate analytics database.

The bot is already trading — will it have to be stopped?

No. We connect to logs and external exchange interfaces in read mode and do not restart the trading process.

We load history for past periods in a separate pass in parallel with the live stream, then verify the boundaries — the junction of history and real time must not produce gaps in the charts.

How does the dashboard affect the load on the trading system?

Collection runs asynchronously and in a separate process: requests do not enter the bot's transactional loop, polling frequency is limited, and writing goes only to the analytics database.

The trading process only experiences lock-free reads, so order placement time does not change, and activity peaks do not create a queue.

How much can the metrics be trusted?

We calculate from primary events, not from ready-made aggregates: every point on the chart can be expanded down to a specific trade.

Control reconciliation of amounts is performed regularly, and if there is a discrepancy, aggregates are recalculated from raw data, and an alert is sent about the mismatch.

What about the security of bot data?

Keys are issued read-only, without withdrawal or trading rights. Secrets are stored in a secure vault, panel access is role-based, and administrator actions are recorded in a log. External export is closed by default.

Who maintains the analytics after launch?

We hand over the data schema, calculation rules for each metric, and alert settings. Separately, we set up stream freshness monitoring: if data does not arrive longer than a specified interval, the dashboard marks the numbers as stale rather than silently showing old ones.

Let's discuss the task and return with an estimate and plan

So that the estimate and work plan are based on facts, not guesses, it is useful to collect the inputs for the analytics task in advance.

Below is a list of what most often determines the scope of work on a crypto bot dashboard: the more specific the answers, the more accurate the timelines, stage composition, and preparation order before start.

  • Metric list: what exactly we calculate — trade volume and price, result of closed and open positions, drawdown, holding time, fees, and deviations from the defined strategy.
  • Data sources and access: trading logs, exports from the bot core, exchange APIs — indicating where data resides and in what form it is provided.
  • Freshness requirements: which indicators are needed as a stream, and which are sufficient to aggregate once an hour or once a day.
  • History depth: for what period charts and reconciliations are needed and whether there is an archive for past intervals.
  • Usage scenarios: a summary for management, an operational monitor for a trader, alerts when parameters go out of bounds.
  • Roles and access: who sees which accounts, whether restricted visibility and a user action log are needed.
  • Constraints: rate limits for source requests, requirements for storing trading and personal data, expected load.
  • Delivery method: browser access, export to tables, embedding into an already used panel, or mobile viewing.

Describe the task in a convenient form — a short message or using the points above. We will return with an estimate and work plan: stage order, checkpoints, and what will be required from your side at the start.