ores.trading.structure_template_role
Table of Contents
The roles a structure template allows, each with the number of legs it holds. The table is what makes a template a mould: a straddle allows one role holding exactly two legs, a butterfly allows a body of one and wings of two.
The row is keyed by its template and its role, because a template states each role once. The leg counts are inclusive at both ends, and a role that holds any number of legs states a maximum of zero meaning no upper bound.
Examples: 'Straddle' / 'leg' / 2 to 2, 'Butterfly' / 'wing' / 2 to 2.
1. Flags
2. Columns
2.1. template_code
The template the role belongs to.
std::string("Straddle")
2.2. role
The part the leg plays in the deal, in the template's own words: the body of a butterfly, the wing of a risk reversal, the premium leg.
Examples: 'leg', 'body', 'wing', 'premium'.
std::string("leg")
2.3. min_legs
The fewest legs this role may hold, counting from zero.
1
2.4. max_legs
The most legs this role may hold. Zero means the role states no upper bound, which is what a dynamically typed product needs.
1
2.5. description
What the role is for, when the name alone does not say.
std::string(faker::lorem::sentence())
3. SQL
3.1. Flags
3.2. Checks
A role holds a count, not a negative number of legs, and its bounds are in order.
| expression |
|---|
| "min_legs" >= 0 |
| "max_legs" >= 0 |
| "max_legs" = 0 or "max_legs" >= "min_legs" |
3.3. Extra drops
drop function if exists ores_trading_validate_structure_template_role_fn;
4. Foreign keys
4.1. template_code
The template catalogue is system reference data.
5. C++
5.1. Flags
5.2. Repository
5.3. Domain includes
#include <string>
5.4. Conventions
5.5. Table display
| column | header |
|---|---|
| template_code | Template |
| role | Role |
| min_legs | Min legs |
| max_legs | Max legs |
| modified_by | Modified By |
| version | Version |
5.6. Custom repository methods
6. See also
- ores.trading — component group overview.
- Trade Structures and Deal Composition — the leg roles the templates encode.