Nested trade sets

Table of Contents

1. Summary

Some trade sets contain others, and a trade sits at a path in that tree. The portfolio tree is the large case, and a structure is the same shape in miniature because a structure's identity is its membership. Where sets nest, membership is part of what the trade is and belongs on the trade. Where they do not, membership is an annotation that the trade outlives.

2. Detail

2.1. The portfolio tree

Books and portfolios gives the large case. A portfolio holds books and other portfolios, a book holds deals, and the tree is written as a path, AP.CHINA.IRS.OPTION.

The sets along that path contain one another. The set for AP contains the set for AP.CHINA, which contains the set for AP.CHINA.IRS. A trade in the innermost set is in all of them, because it is in the innermost set at all.

2.2. Membership is identity

The path is the trade's address. Two systems that agree on the path agree on where the trade is, and a trade that moves to another book has changed a versioned attribute of the trade rather than a row in a membership table.

So the entity and the set are two readings of one thing. The book is the set's extent, and the set is the book's address. Neither is prior to the other, and a model that stores them separately has two facts to keep in step.

2.3. The structure

A structure is the same shape in miniature. Its identity is its membership: a structure whose legs differ is a different structure, and that is why Trade Structures and Deal Composition can say that a change to any leg is a change to the structure. The customer confirms the structure, not the legs, and the confirmation names one deal.

2.4. The test

Ask whether a trade can be in two sets of one kind at the same time.

A trade is in one book, faces one counterparty, sits in one netting set, and belongs to at most one structure. It is in many batches, many selections and many report subjects over its life.

Where the answer is one, the sets nest and membership is part of the trade's identity. Where the answer is many, they do not nest and membership is an annotation.

2.5. The counter-case

A batch. A trade is in many batches over its life, and none of them says what the trade is. Removing the trade from a batch, or the batch from the record, leaves the trade identical in every respect that matters to anyone else.

The same holds for a report subject and for a user's selection. These sets are real, and they can be recorded and referred to, but they are not part of the trade's address.

2.6. What it decides

  • Nested membership is a key on the trade and is versioned with the booking.
  • Flat membership is a row in a trade group and is not versioned with the trade.
  • A question about the trade's book is well formed. A question about the trade's batch is not, because there is no single answer.
  • Putting a trade into a batch is not a trade amendment. Moving it between books is, and Book moves describes the versioned form of the change.

3. Sources

The portfolio tree and its path notation come from Books and portfolios. The reading of membership as identity, and the exclusivity test, are this page's synthesis.

4. See also

Emacs 29.3 (Org mode 9.6.15)