NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Trading Analytics for Laravel

Volume, value, commissions & timing

Four aggregate metrics describe trading activity. Each has a total, count, average, highest and lowest — with the responsible pair — at every breakdown level:

  • volume — the traded size, over every trade.
  • value — the notional value at entry: size × open price, over every trade.
  • commission — the commission per trade; a trade without one counts as 0, so the average is per trade and the lowest can be 0.
  • duration — how long closed trades stayed open, in seconds (2 decimals), averaged over the closed trades.
$analytics->volume->global->total->total;            // '3.50' — total size traded
$analytics->volume->forPair('BTC/USD')->buy->total;   // '0.50'
$analytics->value->global->total->average;           // '9700.00' — size x open price
$analytics->value->global->total->highest;           // '20000.00'
$analytics->value->global->total->highestPair;       // 'BTC/USD'
$analytics->commission->global->total->total;        // '19.00'
$analytics->commission->forQuoteCurrency('USD')->sell->average;
$analytics->duration->global->total->average;        // '38400.00' — seconds
$analytics->duration->global->total->highest;        // '86400.00' — the longest hold

Trading frequency

frequency measures how often trades are opened: the average gap between opens — the span from the earliest to the latest open time, divided by the opens minus one — expressed as trades per hour, day, week, month or year, whichever unit fits the gap. It needs neither sorted input nor any per-trade history. The unit is stored as the value’s suffix. Fewer than two trades, or trades that all opened in the same second, leave it at 0 with no unit, and there is no buy/sell split:

(string) $analytics->frequency->total;       // '4.7 per week'
$analytics->frequency->total->toRawString(); // '4.7'
$analytics->frequency->total->suffix;        // 'per week'
$analytics->frequency->forPair('ETH/USD');
$analytics->frequency->forBaseCurrency('ETH');

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.