---
title: "Precision — Trading Analytics for Laravel | Roundly"
description: "Which figures follow the run’s scale and which have a fixed one — bcmath truncates, and ratios divide at full precision first."
url: https://roundly-consulting.com/open-source/docs/trading-analytics-for-laravel/precision
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Trading Analytics for Laravel](https://roundly-consulting.com/open-source/docs/trading-analytics-for-laravel.md)

# Precision

\->scale() (or the scale config key) sets the decimal places of every amount: P&L, volume, value, commission, their averages, the expectancy’s and risk/reward ratio’s average win and loss, and the drawdown. bcmath truncates rather than rounds, so each figure is truncated to its scale as it is stored; ratios are divided at a higher working scale first, so an operand below the result’s precision — a loss of 0.00005 BTC, a deviation of a few basis points — still counts. Ratios and percentages are reported at a fixed scale, whatever the run’s:

| Figures | Decimal places |
| --- | --- |
| volume, value, commission, P&L and their averages, expectancy value / averageWin / averageLoss, riskRewardRatio averageWin / averageLoss, maxDrawdown value / equity / peak | the run’s scale (default 10) |
| counts, wins, streaks | 0 |
| frequency | 1 |
| wins->winRatio, profitFactor | 2 |
| cumulativeReturn (percent), duration (seconds) | 2 |
| expectancy->winRate / lossRate, winRateByPeriod->rates | 4 |
| riskRewardRatio->value, maxDrawdown->percentage, sharpeRatio, sortinoRatio | 4 |
| riskAdjustedReturns meanReturn / standardDeviation / downsideDeviation | 10 |

Each trade’s own numbers are exact: Trade::make(), fromArray() and fromRow() keep every amount at its own decimal places (at least 10), and its P&L and value at entry (size × open price) are computed without truncation, so the run’s scale truncates them only once, into its results. Building trades shows a high-precision example.

## 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](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## 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.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/trading-analytics-for-laravel.md)
