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

The facade is the recommended default, not the only way in. It’s a thin layer over RoundlyConsulting\TradingAnalytics\TradingAnalyticsManager, the facade root — a container singleton. Inject it through the constructor for the same API with an explicit dependency and no static calls:

use RoundlyConsulting\TradingAnalytics\TradingAnalyticsManager;

final class PerformanceReport
{
    public function __construct(private TradingAnalyticsManager $analytics) {}

    public function build(iterable $rows): array
    {
        return $this->analytics->for($rows)->scale(2)->calculate()->toArray();
    }
}

The engine class

RoundlyConsulting\TradingAnalytics\Analytics works on its own, too. Its static for() and make() take a LazyCollection of Trade objects — map rows with Trade::collect() first:

use RoundlyConsulting\TradingAnalytics\Analytics;
use RoundlyConsulting\TradingAnalytics\DataTransferObjects\Trade;

// The engine itself — takes a LazyCollection of Trade objects
Analytics::for(Trade::collect($rows))->calculate();
Analytics::make($trades)->only([Counts::class])->calculate();   // make() is the same constructor

No action classes

The package has no action classes: it is a stateless calculation engine, and the manager only normalises the input and builds the engine. A setting made with using() on the singleton applies to injected managers and the facade alike.

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.