Systems and executionIntermediate25 min read

Gross and net exposure: what your robots are adding up

Reconstruct exposure by robot, instrument and currency to distinguish gross quantities, net offsets and scenarios in a Forex portfolio.

Two robots hold opposite EUR/USD positions. Someone looks at the combined balance and concludes that they almost cancel. Later, one closes its trade while the other remains open. The number of positions falls, but the remaining exposure may increase or reverse direction. Counting robots cannot anticipate that change.

A portfolio needs several simultaneous views. The robot view preserves each system’s decisions and commitments. The instrument view identifies offsets within the same pair. The currency view shows how trading different pairs can concentrate a shared monetary exposure.

This article builds an original teaching portfolio of four fictional robots. Positions, quotes, equity and scenarios are invented. They describe neither Atlas robots nor a recommended allocation. The purpose is to define reviewable measures and recognise when an aggregate number answers a different question from the one you thought you asked.

We will use linear positions and a common initial snapshot, without commissions, financing or execution differences. That simplification makes the arithmetic easier to follow. We will then identify information needed when robots operate across different accounts, times or conditions.

Before adding exposure, decide which unit and grouping you are adding. The word “net” does not explain what has been offset or which risks remain.

Establish a coherent snapshot

Exposure describes a state at a particular time. Mixing one robot’s position before closing with another’s after opening can construct a portfolio that never existed. The first requirement is a snapshot with a cutoff time and a clear policy for pending events.

For the example, suppose four positions open at reference quotes: EUR/USD at 1.1000, GBP/USD at 1.2500 and USD/JPY at 150.00. Dollars are the report’s common currency. All prices are hypothetical and belong to the same illustrative moment.

Robot A buys 100,000 EUR of EUR/USD. B sells 60,000 EUR of the same pair. C buys 40,000 GBP of GBP/USD. D buys 100,000 USD of USD/JPY. We will hold these quantities until introducing explicit changes.

Robot Position Signed base quantity One-leg notional in USD
A Buy EUR/USD +100,000 EUR 110,000
B Sell EUR/USD −60,000 EUR 66,000
C Buy GBP/USD +40,000 GBP 50,000
D Buy USD/JPY +100,000 USD 100,000

The last column expresses the absolute value of base quantity converted into dollars. It is not yet a loss measure or an estimate of required capital. It is the unit chosen to compare positions of different scales without directly adding euros, pounds and dollars.

An operational record should add account, position identifier, execution state and quote provenance. A pending order is not an open position. You can study it as potential exposure, but it should appear in a separate view or with an explicit execution condition.

OANDA’s position documentation distinguishes instrument, signed units, long and short sides, results and margin used. It provides an example of separate fields worth preserving before aggregation; it does not require every intermediary to represent positions identically. Public position definitions.

The snapshot should be reconstructable from identified events or records. If a provider has already aggregated an amount, establish what it contains before adding it again. An account total and its individual positions may represent the same exposure and create double counting.

Define gross exposure by robot

For this portfolio, gross exposure by robot means the sum of the absolute values of one base leg of each position, converted into USD. The calculation is 110,000 plus 66,000 plus 50,000 plus 100,000: 326,000 USD.

This is an explicit working definition for following the example. It should not be confused with a universal regulatory formula or any platform field called “gross exposure”. Definitions may include other instruments, offsets or conversions.

The advantage of this view is that it preserves opposing activity. A’s 110,000 USD and B’s 66,000 do not disappear because they share a pair. There are two decisions, two exit paths and potentially two sets of costs. The gross sum keeps that scale visible.

Gross preserves quantities that net can cancel. It therefore helps ask how much open activity depends on systems continuing to behave as expected. However, it does not say how much the portfolio would lose under a particular movement: it ignores position signs.

With assumed equity of 20,000 USD, the ratio between this gross exposure and equity would be 16.3. That number describes our definition and denominator. It is not a recommendation, an allowed limit or a guarantee about available margin.

The denominator needs a date and scope. If you use equity across multiple accounts, do not assume funds can move instantly between them. Mixing realised balance with equity that includes position valuations can change the ratio through an accounting difference rather than a robot decision.

A simple test reverses one position’s sign while preserving quantity and quote. Gross exposure as defined here does not change. If your function returns another amount, it may use a different definition or offset positions before applying absolute values.

Preserve individual contributions too. A 326,000 USD total provides little information if you cannot identify which robots form it. Decomposition makes it possible to locate changes, check duplicates and connect each quantity to the rule that generated it.

Offset only within the same pair

A and B trade EUR/USD. Their signed quantities total 40,000 EUR: 100,000 minus 60,000. At the reference quote, this net position equals 44,000 USD of one-leg notional. The offset is arithmetic and occurs within the same instrument.

Now group by pair first, then add the converted absolute values. EUR/USD contributes 44,000 USD, GBP/USD contributes 50,000 and USD/JPY contributes 100,000. The result is 194,000 USD. We will call it the sum of net notionals by pair, avoiding confusion with gross exposure by robot of 326,000.

The 132,000 USD difference does not represent recovered money or profit. It is twice the smaller 66,000 USD position offset when grouping EUR/USD: a long and a short amount of equal size disappear from that view.

Gross EUR/USD exposure is one hundred and seventy-six thousand dollars and its net position equals forty-four thousand; the portfolio's net notionals by pair total one hundred and ninety-four thousand.
Signed quantities are added within each pair first; the absolute value of each result is taken afterwards.

Taking absolute values before or after grouping changes the question. The first preserves both sides. The second observes the balance of a defined group. Neither order is automatically correct for every purpose.

Offsetting does not erase history either. If robots entered at different prices, their realised or unrealised results must preserve those prices. Equal and opposite quantities can offset immediate directional sensitivity while still carrying an earlier result or different costs.

Net by pair does not mean a risk-free portfolio. Three pairs remain open in our example. Even within EUR/USD, matching quantities does not guarantee both exits execute together, at the same price or in the same account.

To check aggregation, artificially split A into two 50,000 EUR records with the same provenance and preserve the sum. Net position by pair should remain 40,000 EUR. This property reveals aggregators that improperly depend on the number of rows.

Also test an exact identifier duplicate. There should be a policy recognising it as repetition of the same event, rather than a new position. Exposure inflated by duplicates may appear conservative because it is larger, but it remains an incorrect representation.

Decompose pairs into currencies

Buying EUR/USD creates positive sensitivity to the euro against the dollar. In our initial model, A can be represented by a +100,000 EUR leg and a −110,000 USD leg. B contributes −60,000 EUR and +66,000 USD. C contributes +40,000 GBP and −50,000 USD.

D contributes +100,000 USD and −15,000,000 JPY. Adding by currency gives +40,000 EUR, +40,000 GBP, +6,000 USD and −15,000,000 JPY. That is the example’s currency snapshot before movements, costs or new decisions.

This decomposition is an illustrative economic representation of linear positions opened at the stated rates. It does not claim that a CFD literally creates those cash balances in an account. Real contracts require a distinction between positions, flows, valuation and actual balances.

If positions had opened earlier at other prices, replacing their historical legs with current quotes and forgetting accumulated profit or loss would be insufficient. For a sensitivity snapshot, you can construct equivalents at the current price, while separately preserving the valuation already generated and relevant conversions. Reconstructing flows requires the original contracted quantities. These representations answer different questions; mixing them can create or remove money in the report without a trade occurring.

The historical Basel framework published by the BIS separates measurement by currency from aggregation of a mixture of long and short positions. We use that conceptual distinction without applying bank capital requirements to a robot portfolio. Currency measurement and aggregation in MAR20.

Converted into USD, our net legs are worth +44,000, +50,000, +6,000 and −100,000. Their sum is zero in this initial construction. This reflects each exchange being represented by two legs of equal initial value and opposite signs; it does not demonstrate an absence of sensitivity to relative movements.

Net currency-leg map: forty thousand euros, forty thousand pounds, six thousand dollars and minus fifteen million yen.
A hypothetical economic representation when positions open. Zero initial net value does not eliminate exchange-rate risk.

A common currency enables valuation; it does not turn different currencies into one factor. The 44,000 USD equivalent of euros and the 50,000 equivalent of pounds respond to different movements. Adding them without preserving currency identity removes relevant information.

The decomposition also reveals why “three buys and one sell” is insufficient. D buys dollars while A and C sell dollars as the counterpart of their purchases. The word buy refers to each pair’s first currency, rather than a common direction for the whole portfolio.

Avoid a net that always equals zero

Adding every currency leg valued at inception would give zero, potentially leading you to mislabel the portfolio as neutral. Cancellation follows from representing an exchange: a positive asset and a negative obligation have equal values at that instant. Their future prices need not move together.

The sum of absolute values of net currency legs is 200,000 USD: 44,000 plus 50,000 plus 6,000 plus 100,000. In this balanced construction, dividing by two gives 100,000 USD. This is another descriptive measure, different from both 326,000 and 194,000.

There is no need to choose a winning figure. Preserve its complete name and method. Gross by robot shows commitments before systems offset. The sum of net notionals by pair preserves instruments after internal offsetting. Net currency legs reveal currency concentrations after looking across pairs.

A total can be arithmetically correct while answering the wrong question. A useful report lets you open its components and check which offsets were applied. Decimal precision does not correct an unsuitable definition.

Half the absolute sum should not be copied to every portfolio either. We included the reporting currency as a residual leg and defined an initially balanced example. If you incorporate cash, equity, accumulated results or other contracts, declare the set being measured before interpreting the total.

For studying robots, displaying the currency vector beside instrument totals is often more transparent. The table occupies a few rows and makes exposures visible that one number conceals. Scenario measures can then be added for a specific question.

Another check changes the presentation currency. Numerical amounts change when converted, but economic quantities and their signs should not disappear. If a portfolio seems neutral only because you selected another reporting currency, review what you are adding.

The most dangerous conceptual error here is treating “net” as synonymous with safe. The word describes subtraction within a grouping. The economic consequence depends on what can vary next and which positions remain open.

Construct coherent monetary scenarios

A scenario must specify compatible movements across quotes. To avoid contradictions, we will fix changes in each currency against the dollar and derive the required pairs. We will not move EUR/USD, USD/JPY and EUR/JPY arbitrarily at the same time while claiming they describe one state.

In the first invented scenario, the euro and pound lose one percent of their dollar value, while the yen gains one percent in dollars. EUR/USD becomes 1.0890 and GBP/USD becomes 1.2375. USD/JPY changes from 150 to 150 divided by 1.01, approximately 148.5149.

The net euro leg loses 440 USD: one percent of 44,000. The pound leg loses 500 USD. The yen obligation, initially valued at 100,000 USD, becomes worth 101,000; its contribution is a 1,000 USD loss. The 6,000 USD does not change in the reporting currency.

The model’s combined result is −1,940 USD. We can check it by robot: A loses 1,100, B gains 660, C loses 500 and D loses 1,000. Both routes agree because they represent the same positions under the same movements and assumptions.

Reciprocity matters for the yen. A one-percent increase in JPY’s dollar value is not exactly a one-percent fall in USD/JPY. The inverse quote is obtained by dividing by 1.01. Choosing 148.50 directly for USD/JPY would define another scenario and change D’s result. This difference checks whether a scenario generator preserves a coherent conversion network, particularly when a report combines direct and inverse pairs.

Component Scenario change Result in USD
Net EUR −1% against USD −440
Net GBP −1% against USD −500
USD Reporting currency 0
Negative JPY JPY gains 1% in USD −1,000
Total Combined scenario −1,940

An offset against one currency does not guarantee an offset against every currency. The +6,000 USD balance may look small while euro, pound and yen sensitivities remain substantial.

The scenario assigns consequences, not probabilities. We have not said that this movement is frequent or likely. Studying frequencies or statistical dependence requires data and a different analysis. Here we check that a market hypothesis can be translated into a coherent monetary result.

In a second scenario, the euro loses one percent, the pound gains one percent and the yen is unchanged. The result is −440 plus 500, or +60 USD. Initial gross exposure remains 326,000 USD. That contrast shows why gross alone does not determine a scenario’s loss.

See how an exit changes the portfolio

Return to the initial snapshot and suppose A closes completely at the same quotes, without costs to isolate the quantity effect. B, C and D remain open. Gross exposure by robot falls from 326,000 to 216,000 USD because A’s 110,000 notional disappears.

However, EUR/USD stops being a net long position of 40,000 EUR and becomes a short position of 60,000 EUR. Its absolute net notional rises from 44,000 to 66,000 USD. The sum of net notionals by pair increases from 194,000 to 216,000 USD.

Closing a position can increase a residual exposure. There is no contradiction: A contributed to gross, but also offset part of B. Removing it removes both contributions. Reviewing an exit therefore requires considering the combined state it leaves behind.

Closing A reduces gross exposure from three hundred and twenty-six thousand to two hundred and sixteen thousand dollars, while net notionals by pair rise from one hundred and ninety-four thousand to two hundred and sixteen thousand.
A hypothetical exit at fixed prices. A fall in gross does not determine the direction of the change in net exposure by pair.

Currency decomposition changes too. Remaining legs are −60,000 EUR, +40,000 GBP, +116,000 USD and −15,000,000 JPY. At initial rates, their values are −66,000, +50,000, +116,000 and −100,000 USD. The initial sum remains zero, but the vector is clearly different.

For an isolated one-percent euro fall, the initial portfolio lost 440 USD; after closing A, it would gain 660 USD in this model. The same movement changes economic sign because the remaining position has changed.

An exposure record therefore needs events, rather than only daily summaries. If two exits are expected simultaneously but execute separately, an intermediate state exists. Even if brief, it may be the relevant state during an execution difference or interruption.

To study it, replay opening, reduction, closing and rejection in order. After each event, recalculate quantities by robot, pair and currency. If the system updates its total only after a batch, it may omit precisely the transient exposure you are trying to understand.

The coordination policy between robots is an additional specification. Do not assume two independent rules will close together because their positions offset today. Document who determines each exit and what happens if only one executes.

Separate economic offsets from margin

Subtraction in a spreadsheet does not automatically change account conditions. A and B may sit with different intermediaries, in separate accounts or under rules that do not permit collateral offsetting. Combined economic exposure and funding requirements need separate records.

OANDA’s account documentation describes aggregation modes for position value or margin, including one that uses the net sum of units. The existence of multiple modes illustrates why the specific configuration must be checked rather than inferred from the economic balance. Account and aggregation definitions.

Offsetting quantities does not establish that operational obligations can be offset. Profit in one account does not necessarily fund an immediate requirement in another. Nor should you assume a closing order in one system affects a position managed by another.

As an original exercise, add an account column to the four robots. Put them together first, then separate A and B. Economic exposure defined from the same positions does not change. What changes is the information required to study collateral, transfers, liquidation and ability to act.

There is no need to invent a universal margin formula. Preserve the amount reported for each account, its time and its method where documented. If you construct an estimate, clearly label it as a model and check differences from the corresponding record.

Offsetting within one account can also alter representation. A system may preserve separate long and short positions; another may show only the net balance. In the latter case, an internal attribution record is needed to reconstruct which robot originated each change.

That record does not create two economic positions if the account holds only one. Separate strategy accounting from the effective position. Otherwise, you may add the actual balance and internal allocations as though they were independent quantities.

When reviewing a portfolio, ask what you can close, who can close it and what state remains afterwards. Those operational questions complement the currency map. Perfectly calculated exposure may still be difficult to change if orders or funds are unavailable where needed.

Distinguish exposure from diversification

Four robot names do not equal four independent sources of returns. Two systems may use different signals and coincide in buying euros against dollars. Others may trade different pairs and respond to the same movement in a shared currency.

Exposure describes the current state. Dependence between results describes how their paths relate under particular observations or assumptions. A portfolio can show little net exposure now while having maintained large aligned positions during other periods.

Diversification requires a question about how results vary. The currency map helps formulate it but does not answer it completely. By itself, it contains neither entry frequencies nor duration, exit conditions or changes in dependence during particular episodes.

Suppose A and B usually offset, but B remains inactive precisely when A increases its quantity. A snapshot during a quiet hour may show an offset absent from the highest-exposure states. Studying it requires the temporal distribution of states and the events producing them.

You can compare maximum observed gross exposure, the maximum of each currency exposure and the time spent in each state. These measures must be calculated over a complete sequence with a defined observation frequency. Sparse sampling can omit peaks between snapshots.

Distinguish concurrency from correlation too. Robots never open simultaneously may have related daily results because of a shared factor. Robots open at the same time may hold opposite exposures but have different exits that break the offset later.

Duration adds another dimension. An exposure maximum lasting one observation does not describe the same path as a similar quantity held for hours. Preserve both views: maximum and time-weighted exposure, explaining how intervals between events are calculated. The temporal average does not replace the maximum, because it can smooth a brief episode. The maximum does not summarise how long the portfolio was committed either. Choosing one measure without declaring that information loss can change the story of a comparison.

To avoid excessive conclusions, accompany each claim with its scope: “in this snapshot”, “during these observations” or “under this scenario”. Those expressions do not weaken a correct analysis; they identify the evidence supporting it.

The next useful exercise might compare periods of different activity or construct scenarios where an offset disappears. There is no need to seek an optimal combination to begin. First check whether the diversification story matches the positions actually observed.

Include pending orders and partial failures

So far we have counted only executed positions. Pending orders add possible futures, rather than a single realised exposure. If two robots have buy requests that have not yet filled, adding them to the current portfolio without a label mixes distinct states.

One review proposal preserves three views: executed, pending and execution scenarios. The first contains open quantities. The second contains requests with states and conditions. The third calculates what would happen if particular combinations executed.

Imagine B requests closure of 60,000 EUR, but only 20,000 executes. Its remaining position is short 40,000. With A still long 100,000, net EUR/USD becomes long 60,000 EUR, equivalent to 66,000 USD at the initial rate.

If the report treats the requested quantity as already closed, it will show a net long of 100,000 EUR. The 40,000 EUR difference is not an accounting nuance: it represents a position still open that can respond to the next movement.

Confirmed state takes precedence over an order’s intention. A request helps project scenarios; confirmed execution updates current exposure. Cancelling the remainder does not undo what has already executed either.

Another case is a repeated execution message. Processing it twice can change aggregate quantity without a new trade existing. Preserve identifiers and an explicit rule for repeated messages, alongside the temporal processing order.

Linked orders require studying which combinations are possible. Two exit requests may be alternatives for the same position, with a rule cancelling one when the other fills. Adding them as independent future reductions can project a position reversal forbidden by the contract. Conversely, assuming cancellation has already happened without confirmation can hide a pending state. Scenarios should represent those dependencies, with permitted and forbidden states defined before aggregation.

Unknown states need a separate policy. When you do not know whether an order executed, an invented zero does not remove uncertainty. You can preserve confirmed exposure and display a range or multiple possible states, explaining the origin of that ambiguity.

Reconstructing these situations matters when studying code. Entry rules may be clear while exposure calculation fails during transitions. A small partial-fill and cancellation example often reveals more about that behaviour than a final profit table.

Build tests for the aggregator

The portfolio aggregator deserves manual references. Preserve the four-robot snapshot as a small case: gross 326,000 USD, net notionals by pair 194,000 and currency legs +40,000 EUR, +40,000 GBP, +6,000 USD and −15,000,000 JPY.

Check the sum through two routes. One first aggregates positions within the same pair and then decomposes them. The other decomposes each position and then groups by currency. Under our initial conditions, both should produce the same vector. If they differ, locate the first divergent component.

The same portfolio should preserve its exposure when row order changes. It should also preserve exposure if a position is split into equivalent parts without duplicating identifiers. These properties are useful because they do not depend on a return figure.

Two aggregation routes reach the same currency vector and are checked with order, partition and duplicate tests.
Reconciliation compares distinct paths using the same positions and quotes.

Add a complete sign-reversal test. Gross by robot remains unchanged and each currency leg reverses sign. Under the same price scenario, the linear result without costs reverses sign. If costs or restrictions are included, separate their effects before requiring that property.

Also test a missing or stale quote. The aggregator should not treat missing conversion as zero, artificially reducing the total. It may reject the snapshot or mark the component pending; the policy should remain visible in the report.

Precision needs a shared convention. Aggregating amounts rounded row by row may differ from rounding the total. Preserve sufficient internal precision and declare presentation policy. In reconciliation, compare against a justified monetary tolerance, rather than a number chosen to hide differences.

To review an exit, use A’s closure as a regression case: gross falls to 216,000, net by pair rises to 216,000 and euros change from +40,000 to −60,000. This example prevents simplifications such as “fewer positions always mean less exposure”.

The article on independent tests for AI-generated code develops ways to build these references without copying the algorithm being checked.

Deliver a report that preserves the questions

An exposure report should begin with its cutoff time, presentation currency and set of positions. It can then show gross by robot, net by pair and the currency vector. Names should explain aggregation order rather than merely saying “total”, “gross” and “net”.

Add contributions and changes since the previous snapshot. If a total changes, another person should be able to distinguish a new position, partial fill, closure or conversion-rate movement. That separation turns a numerical alert into an investigable question.

Offsets need temporal and operational context. State whether positions live in the same account, whether exits are independent and whether orders are pending. A small net balance deserves more explanation when it depends on several systems remaining open simultaneously.

An exposure report contract containing snapshot, units, aggregations, scenarios and interpretation limits.
A reporting proposal: preserve definition, components and limits alongside the number.

The report can include the two original scenarios: −1,940 USD with weaker euro and pound and a stronger yen, and +60 USD with a weaker euro and stronger pound while the yen is unchanged. Identify them as exercises, not forecasts or probabilities. Their purpose is to check consistency between exposure and consequence.

If you need to review how an individual position produces sensitivity, the article on Forex position size develops units, conversion and restrictions. The portfolio begins with correctly interpreted quantities; aggregation does not correct source errors.

When working with robot rules and code, preserve small examples you can explain without relying on the private generator. If using data associated with the demo, limit references to the CSV to that demo. The task here is to understand observable exposures, rather than attribute capabilities or results to an offer.

A useful review ends with open discrepancies: unreconciled positions, pending quotes or differing conventions across accounts. Showing those limits prevents a clean chart from communicating certainty the record does not support.

The aim is to explain what changes when a robot opens, reduces or closes. If one of your systems stopped offsetting the others right now, which currencies would remain exposed, and how would you check that against the available records?

Three distinct portfolio views: positions by robot, net positions by pair and exposures by currency.
Each grouping answers a different question; a total without a definition can conceal offsets.
Back to the Blog