Commodity TradingField engagement

As principal the operator carries every position it takes, so the platform does exposure arithmetic and treats the warehouse count as a side detail.

Architecture and delivery lead.
The approach, in four words
positions, not stock levelsallocation as an operationreallocation is recordedexposure projected from the book
supply positions
demand positions
›
Position book
allocation and reallocation recorded
net exposure
projected from the book, not counted by hand
A warehouse model answers how much is held. A position book answers what the operator is exposed to, and records reallocation as a transition rather than an edit, so the book can explain how it reached its current state.
What was at stake

The operator is the counterparty to its suppliers and its buyers, not an intermediary between them. What it has agreed to buy and what it has agreed to sell are positions it carries, and every quote adds to its own exposure. Material has to be allocated to sales and moved between them correctly, because a reallocation changes which sale is covered, which margin is earned and which commitment is still open. It moves real risk, not a number between two columns.

How this works

A position is what you stand to gain or lose, and the warehouse cannot tell you what it is.

Inventory answers a physical question: what is in the yard today. A position answers a financial one: if prices move tomorrow, how much does the business gain or lose. The two can be very different. A trader who has agreed to buy material that has not yet been delivered has an empty yard and a real position. A trader whose yard is full, but every load in it already sold at an agreed price, has plenty of inventory and almost no exposure to the market.

Traders describe this as being long or short. Long means the business has committed to buy more than it has committed to sell, so it loses money if prices fall. Short means it has committed to sell more than it has bought, so it loses if prices rise. The net position adds up every commitment, bought and sold, delivered or not yet delivered. For a principal, who buys and sells in its own name, that net figure is the risk the business is carrying at any given moment.

Allocation is the act of deciding which supply fills which demand: this purchase will be delivered against that sale. It decides the margin on each sale, which deliveries are covered, and which commitments are still open. Reallocation, moving material from one sale to another, is common and legitimate, because loads arrive late or turn out to be a different grade from the one expected. Every reallocation changes the shape of the book. If it is not recorded as an event of its own, the book can no longer explain how it came to look the way it does.

Yard full, all sold forward
Plenty of inventory
every load is already promised to a buyer
Price agreed on each sale
the margin is locked in
Little exposure
a price move barely changes the result
Yard empty, bought ahead
No inventory at all
purchases agreed, nothing delivered yet
Nothing sold against them
the business is long
Real exposure
a price fall is a loss before anything arrives
Inventory and exposure point opposite ways
A stock count would call the left-hand yard the risky one.
FigureTwo yards that a warehouse system would describe in opposite terms, and a position book would describe the other way round. Inventory measures what is on the ground. A position measures what a price move would cost. For a principal, the second number is the one that matters.
The constraint

This is position mathematics with allocation as an operation in its own right. Counting what is in the yard answers a different question. Reallocation has to be consistent and auditable, because it changes what the operator is exposed to. A warehouse model loses the exposure view entirely and turns every reallocation into an edit to a quantity that nobody can reconstruct afterwards.

Where it usually breaks

Stock systems lose the exposure first and the history second.

Teams building tools for physical traders often reach for an inventory model, because the quantities look the same: material in, material out. The exposure view then has to be assembled by hand, usually in a spreadsheet that reads contracts from one place and stock from another. It is out of date the moment it is finished, and it is the number the trader is actually managing.

The history goes next. Reallocation in a stock system is an edit to two quantities. After a few of them, nobody can say which purchase backs which sale, or why the margin on a particular sale changed last week. And when two people reallocate the same material at the same moment, both edits succeed, and the same load is promised to two buyers.

01

The exposure assembled by hand

The real risk number lives in a spreadsheet outside the system, built from exports and correct only as of when it was built.

02

Reallocation as an edit

Moving material between sales overwrites two quantities and leaves no record of the move, its reason or its effect on margin.

03

The double allocation

Two people allocate the same material at the same moment. Each sees it as available, both succeed, and one buyer will be short.

04

The screen that disagrees with the book

The trader's view computes exposure separately from the record, and the two drift whenever either one changes.

05

The side agreement

A position taken directly, outside the platform, never enters the book. The book is internally consistent and wrong about the business.

A load is unallocated
free to fill any open sale
First person allocates it
to the sale they are working on
Second person allocates it too
at the same moment, to a different sale
Both allocations succeed
each one checked availability before the other wrote
The failure point
One load, two buyers
one sale will go short and nobody can see which
The platform flags concurrent reallocation of the same material and lets only one stand.
A stock count would still show the right quantity, which is why the error survives.
Availability checked at read time is not availability guaranteed at write time.
FigureHow one load ends up promised to two buyers. Each person checked that the material was free, and it was, at the moment they looked. Without a single place where allocation is decided, both checks pass and both commitments stand.
The fork

The reflex, and the fix.

Road not taken

Track stock levels like a warehouse

Pull

It is the familiar model, and the quantities being tracked look the same.

Why not

It loses the exposure view, and reallocation becomes an edit to a quantity with no record of the move, so the book cannot explain how it reached its current state.

Road taken

Model positions and allocations explicitly

Accepted

A position ledger and an allocation engine to design, in place of a quantity column to update.

Bought

Net exposure the trader can see directly, and reallocation as a recorded, consistent transition that can be reconstructed at any later date.

Decision

Model the exposure, because exposure is what the operator actually carries. The quantity on the ground follows from it.

How it was built
01Supply positions
›
02Demand positions
›
03Position book
›
04Allocation
›
05Net exposure
01

A position ledger, not a stock count

Supply and demand are recorded as positions, so the book answers what the operator is exposed to. What is physically held is one input to that, and no longer the whole answer.

02

Allocation as an operation with its own record

Matching material to demand is an explicit operation, written down when it happens. It is never a side effect of editing two numbers.

03

Reallocation as a recorded transition

Moving material from one sale to another is written down with consistency guarantees, because it moves exposure and has to be reconstructable after the fact. Two people reallocating the same material at once is flagged, never silently allowed.

04

Net exposure projected for the trader

The trader's workspace shows the net position derived from the book. The number the trader acts on comes from the same record as everything else, so the screen and the book cannot disagree.

Inside the key decisions

What each choice cost, and what it bought.

ARecording positions instead of stock levels

Stock levels are what everyone already understands, and a quantity column is quick to build. A position ledger asked more of the design, because it has to hold commitments that have not been delivered and distinguish what was bought from what was sold. It made the book answer the question the trader actually asks, which is what the business stands to lose, and it made the warehouse count one input among several.

BGiving allocation its own record

Allocation could have been modelled as a field on a sale pointing to a purchase. Making it an operation with its own record cost an extra concept in the system. It meant every allocation has a time, an author and a reason, and the history of which material backed which sale can be read straight from the book.

CGuarding reallocation against concurrency

Most of the time only one person touches a given load, so it is easy to treat concurrent reallocation as an edge case. It is the edge case that creates a short delivery to a real buyer. Enforcing consistency at the point where a reallocation is written, and flagging the conflicting attempt, costs some throughput in the rare busy moment. It guarantees a load is never promised twice.

DProjecting exposure from the book

The trader's screen could have computed exposure its own way, tuned for speed. Deriving it from the same ledger as everything else means the screen is only as fast as that derivation allows. It also means the number the trader acts on is the number the books hold, so the end-of-day reconciliation between screen and record does not exist.

  1. Load allocated to a sale
    recorded as its own operation
  2. Load arrives late or off grade
    the original sale can no longer be filled by it
  3. Reallocation written as an event
    with consistency checks against concurrent moves
  4. Net exposure re-derived
    the trader's view updates from the same book
  5. History explains the book
    every move, its time and its reason
Nothing in this sequence is an edit. Every step is an addition to the record.
FigureThe life of a reallocation in the position book. A load arrives late or off grade, the material is moved to a different sale, and the move is recorded as an event. The trader's exposure is then re-derived from the book, and the history can explain every step.
How it was measured

A single headline number hides where a system fails. This work was scored on the dimensions that actually decide whether it holds in production, measured on real, held-out cases rather than the demo path.

Consistency of the book under reallocationAuditability of an allocation's historyAgreement between the book and the trader viewBehaviour under concurrent allocation
Consistent under reallocationthe book balances after every move
Allocation history reconstructablewhich material backed which sale, and when
Book and trader view agreeone record, one number
Concurrent allocation handledthe same load is never promised twice
Outcomes are described qualitatively. No figures are claimed.
FigureThe properties the platform was evaluated on. No measured figures are published for this engagement. Each property is one the warehouse model would have failed by construction, which is what made them the right tests.
figures

No measured figures are published for this engagement. Outcomes are described qualitatively.

What it produces
Without this discipline

A warehouse-style stock count where reallocation is an edit, the exposure view is assembled by hand in a spreadsheet, and nobody can reconstruct why the book says what it says.

This system

An explicit position ledger with allocation and reallocation as recorded, consistent transitions, and net exposure projected for the trader from that same record.

positions, not stock levelsallocation as an operationreallocation is recordedexposure projected from the book
The operating envelope

What it owns, and what it hands to a person.

Handled with confidence
Positions entered through the platform
Allocation and reallocation with consistency guarantees
Net exposure projection
Flagged for review
Concurrent reallocation of the same material
Out of scope by design
Positions agreed outside the platform and never recorded
The honest limit

The book reflects what has been entered into it. A position taken outside the platform, such as a side agreement made directly with a buyer, is invisible to it until someone records it, and no amount of internal consistency changes that. A ledger can be perfectly coherent and still incomplete.

What it generalizes to

Principal-side trading, and any stock that carries exposure as well as quantity, wants the same shape: model positions explicitly, make reallocation a recorded transition, and project net exposure from the ledger. Airline seat inventory, energy supply contracts and reinsurance books all work this way.

What to take from this

Inventory is what is physically held. A position is what a price move would cost. A business can have lots of one and none of the other.

Long means committed to buy more than sold, and exposed to falling prices. Short means the reverse. The net of all commitments is the risk being carried.

Allocation decides which supply fills which demand, and every reallocation changes margin and exposure. Record it as an event, never as an edit.

Checking availability when reading does not protect against two people writing at once. Enforce the constraint where the write happens.

A ledger can be internally consistent and still miss the commitments made outside it. Completeness is a process question as much as a software one.

How we engage

You have a system like this one.
Tell us where it stands.

Whether it is failing, not yet built, or about to meet a scale it has never seen, we can tell you what we see.

Start a conversation
mostafa@opulion.dev · Response within 24 hours · By inquiry