Products Market risk and margin
SIMM
ISDA Standard Initial Margin Model
Initial margin you can reproduce and attribute to every trade, and a file that shows where a counterparty differs.
SIMM turns trade sensitivities into initial margin for uncleared derivatives. GraphAtlas reads a risk data file, works the delta margin of the six risk classes and the four product classes, attributes it to every risk factor and trade with an exact decomposition, and sets your file beside a counterparty file to rank the lines where the two differ.
Try the calculation Request a walkthrough
- Verification
- 18 statements. 6 proved, 1 certified, 11 tested.
- Regime
- ISDA SIMM Methodology
- Set by
-
- International Swaps and Derivatives Association
- Basel Committee on Banking Supervision
- Built for
-
- Margin and collateral operations
- Quantitative risk
- Prime brokers and clearing members
- Version
- 4.4
Try it
Run it on sample data
Choose a book, or paste a risk data file of your own, and read the initial margin as you type. The bands show each product class and the risk classes in it, and a click opens how a risk class is built from its buckets. The factors and the trades show where the margin comes from. The second plate sets two files of one book against each other and ranks the lines that explain the difference.
Fig. 1 The initial margin of a book, from its risk data file to the trades and factors that carry it
Verifying receipt
The book
Rates, FX, credit, equity and commodity, with a payer swap and its hedge. Every trade, name and amount is illustrative. Amounts are in US dollars.
Initial margin 38,053,403 US dollars, from 19 risk factors in 13 trades. Concentration adds 1,392,352. Diversification between risk classes takes off 2,472,800.
One risk factor to a line. The fields are TradeID, ProductClass, RiskType, Qualifier, Bucket, Label1, Label2 and AmountUSD, with a tab, a semicolon or a comma between them. A header row is read if there is one. The amount is in US dollars for one basis point of a rate or a credit spread, and for one per cent of an equity price, a commodity price or an exchange rate.
21 lines read, with tabs between the fields and a header row.
The margin by product class and risk class
Rates and FX
6,479,275
The 2 risk classes add to 8,611,592. Their correlation takes off 2,132,317.
Credit
2,828,285
The 2 risk classes add to 3,168,768. Their correlation takes off 340,483.
Equity
15,121,303
Commodity
13,624,540
Initial margin 38,053,403
The four product classes are added, and nothing is diversified between them. Concentration adds 1,392,352 to the margin. The correlation between the risk classes of a product class takes 2,472,800 off it.
Equity, in the Equity product class
A bucket is a size, a region and a sector, with a bucket each for indexes and for volatility indexes. Its K correlates two names by one number for the bucket, and scales a pair by the smaller concentration factor over the larger. The buckets are put together with the table of the sketch, and the residual bucket is added after the root.
| Bucket | Weighted | K | S |
|---|---|---|---|
| Large cap, developed markets, group 1 | 9,083,607 | 12,949,761 | 9,083,607 |
| ISIN: | 13,043,607 | ||
| ISIN: | −3,960,000 | ||
| Large cap, developed markets, group 2 | 5,720,000 | 5,720,000 | 5,720,000 |
| ISIN: | 5,720,000 | ||
| Indexes, funds and ETFs | −5,740,000 | 5,740,000 | −5,740,000 |
| ISIN: | −5,740,000 | ||
| Root over the buckets | 15,121,303 | ||
| Delta margin of the risk class | 15,121,303 |
A weighted sensitivity is the net sensitivity times its risk weight and, where the name is above its threshold, times its concentration factor. A bucket row adds them. K is the root of the form over the factors of the bucket, and S is the sum of the bucket cut to the range from minus K to K.
It is the whole of the Equity margin, 15,121,303.
Checks
Both hold
The parts of 19 risk factors, 13 trades and the risk classes of the four product classes each add up to the margin, to 7.5×10−9 US dollars before rounding.
The second program takes the same lines and the same table of the sketch, and works at sixty digits. Its margins for this book are set beside the ones here. They agree to 2.0×10−16 of the margin.
| Margin | Here | Second program | Difference |
|---|---|---|---|
| Initial margin | 38,053,403.3100 | 38,053,403.3100 | 0 |
| With no concentration | 36,661,050.8403 | 36,661,050.8403 | 2.0×10−16 |
| With no diversification | 40,526,202.5434 | 40,526,202.5434 | 0 |
| Rates and FX | 6,479,274.8324 | 6,479,274.8324 | 0 |
| Credit | 2,828,285.2154 | 2,828,285.2154 | 1.6×10−16 |
| Equity | 15,121,302.9030 | 15,121,302.9030 | 0 |
| Commodity | 13,624,540.3592 | 13,624,540.3592 | 0 |
Fig. 2 Two files of one book set against each other, from the lines that differ to the margin they explain
Verifying receipt
The pair
One sign, one bucket and one unit are different on the other side. Every trade, name and amount is illustrative. Amounts are in US dollars.
Our margin is 38,053,403.31 and theirs is 30,775,572.89. Ours is 7,277,830.42 higher. 3 lines differ. The largest is ISIN:US0000000012, and making it the same as theirs takes 6,805,472.93 off ours.
Each file is a risk data file, read as in Fig. 1. The two are compared on their net risk factors, so the order of the lines, and the trade numbers, do not matter.
21 lines read, with tabs between the fields and a header row.
21 lines read, with tabs between the fields and a header row.
The lines that differ
Our margin is 38,053,403.31 and theirs is 30,775,572.89. Ours is 7,277,830.42 higher. 3 lines differ. The largest is ISIN:US0000000012, and making it the same as theirs takes 6,805,472.93 off ours.
| Line | Ours | Theirs | Narrows by | Size of what it narrows by |
|---|---|---|---|---|
| ISIN:US0000000012Other scale Equity, Equity. Ours is 100 times theirs. One file may have a basis point where the other has a per cent.Ours 520,000, theirs 5,200.The gap would be +472,357.49. | 520,000 | 5,200 | +6,805,472.93 | |
| ISIN:XS2100000037 3yOther bucket Credit, Credit qualifying. Our file has it in bucket 9 and theirs in bucket 3.Ours 9,000, theirs 9,000.The gap would be +6,866,400.76. | 9,000 | 9,000 | +411,429.66 | |
| JPY 10y OISOther sign Rates and FX, Interest rate. The same size with the other sign.Ours −52,000, theirs 52,000.The gap would be +7,216,902.59. | −52,000 | 52,000 | +60,927.83 |
A line is valued by making it, and only it, the same as theirs and working our margin again. Narrows by is how much that takes off the gap between the two margins, and under each line is the gap that would be left. A figure below zero would widen the gap. The lines overlap, so what they narrow by need not add up to the gap. The name of a kind of difference is a guess from the two figures, and the figures are what is certain.
Where the two margins differ
| Class | Ours | Theirs | Difference |
|---|---|---|---|
| Rates and FXOurs 6,479,274.83, theirs 6,418,347.01 | 6,479,274.83 | 6,418,347.01 | +60,927.82 |
| Interest rateOurs 3,491,591.68, theirs 3,392,218.53 | 3,491,591.68 | 3,392,218.53 | +99,373.15 |
| FXOurs 5,120,000.00, theirs 5,120,000.00 | 5,120,000.00 | 5,120,000.00 | – |
| CreditOurs 2,828,285.22, theirs 2,416,855.55 | 2,828,285.22 | 2,416,855.55 | +411,429.67 |
| Credit qualifyingOurs 2,268,767.60, theirs 1,837,726.11 | 2,268,767.60 | 1,837,726.11 | +431,041.49 |
| Credit non-qualifyingOurs 900,000.00, theirs 900,000.00 | 900,000.00 | 900,000.00 | – |
| EquityOurs 15,121,302.90, theirs 8,315,829.97 | 15,121,302.90 | 8,315,829.97 | +6,805,472.93 |
| EquityOurs 15,121,302.90, theirs 8,315,829.97 | 15,121,302.90 | 8,315,829.97 | +6,805,472.93 |
| CommodityOurs 13,624,540.36, theirs 13,624,540.36 | 13,624,540.36 | 13,624,540.36 | – |
| CommodityOurs 13,624,540.36, theirs 13,624,540.36 | 13,624,540.36 | 13,624,540.36 | – |
| Initial marginOurs 38,053,403.31, theirs 30,775,572.89 | 38,053,403.31 | 30,775,572.89 | +7,277,830.42 |
A difference is ours less theirs. The product classes are added, so their differences add up to the one of the margin as it is printed.
Inputs and outputs
What goes in. What comes out
The plate runs a slice of the engine. This is the whole shape of it.
What goes in
- Risk data file
- Up to 400 lines, one risk factor on each, with the trade, the product class, the risk type, the qualifier, the bucket, two labels and the amount. A header row is read if there is one, and a tab, a semicolon or a comma may separate the fields. The six delta risk types are read, and a line that asks for another is refused with its place.
- Amounts
- In US dollars for one basis point of a rate or a credit spread, or for one per cent of an equity price, a commodity price or an exchange rate. An amount is finite and at most 1,000,000,000,000, and a name is at most 40 characters.
- Second file
- For a reconciliation, the file of the other side. It is read in the same way, and each side is named in a message as ours or theirs.
What comes out
- Initial margin
- The delta margin of each of the four product classes, and their sum, which is the margin of the book.
- Margin of each risk class
- The six risk classes of each product class, with the margin of each bucket, the sum of the bucket held between minus and plus its margin, and the residual bucket that is added after the root.
- Concentration and diversification
- What concentration adds, from a second margin with every concentration factor set to one, and what the correlation between the risk classes takes off.
- Parts of the margin
- The part that rests on each risk factor and on each trade, and what the margin falls by without each trade. The parts add up to the margin, and a hedge has a part below zero.
- Reconciliation
- The margin of each side, the difference, the margins of the product classes and risk classes on both sides, and the lines that differ, each named and valued at what our margin falls by when that line alone is made the same.
- Receipt
- A hash of the calibration, the factors as the calculation took them and every figure that came out. Anyone can recompute it.
What the plate covers
In the plate above
- The delta margin of the six risk classes in the four product classes, with the weighted sensitivity, the concentration factor, the margin and the clipped sum of a bucket, the correlation between buckets and the residual buckets.
- The part of the margin that rests on each risk factor and on each trade, the margin without each trade, and the exact check that the parts add up.
- A reconciliation of two files, with each difference named as only ours, only theirs, a bucket, a sign, a scale or an amount, and valued by running our margin again.
- The correlation tables of the sketch, each checked in exact fractions to be positive definite, and a second program that agrees on 92 portfolios.
In the licensed engine, not the plate
- The calibration of ISDA. The risk weights, thresholds, correlations and groups of currencies are ISDA’s to license, so the engine has numbers of its own and says so in every receipt.
- Vega, curvature and base correlation margin, the add-ons and scales of the Annex, the Schedule, inflation and cross-currency basis risk, the payment currency of a credit spread, and indexes, funds and ETFs. A line that asks for any of them is refused.
- The sensitivities. The plate takes them as given. The trade, the valuation and the bumping that give a sensitivity belong to the pricing system of the firm.
- The margin call. The threshold, the minimum transfer amount, eligible collateral and haircuts, and the timing of a call, are in the credit support annex and not in the methodology.
- The governance framework of ISDA, its back-testing and its procedures for remediation.
Clause map
Every rule has an address
Each row names the clause, the function that carries it and the statements that check it. A test opens each file and confirms the function exists.
| Reference | Rule | Carried by | Checked by |
|---|---|---|---|
| Paragraph 5 | There are six risk classes, which are interest rate, credit qualifying, credit non-qualifying, equity, commodity and FX. Each risk type of a line belongs to one of them, and the margin of a class is its delta, vega, curvature and base correlation margins added. The engine has the delta margin, and refuses a line of any other risk. | RISK_ src/ | Tested SM-08 Tested SM-12 |
| Paragraph 6 | The margin of a product class is the root of the sum of the squares of the margins of its six risk classes plus, over each pair, the correlation of the two classes times both margins. The four product classes are added and nothing is diversified between them, so a factor in two of them does not net. The margin is never below the root of the sum of the squares and never above the sum of the six. | simm src/ | Proved SM-01 Tested SM-10 |
| Paragraph 88, Section K | The six risk classes are put together with one table of correlations. The table of the sketch is symmetric with ones on its diagonal and every entry from zero to one. It is positive definite, which an exact factorisation shows, so that the quantity under the root is never below zero. | PSI_ src/ | Certified SM-07 |
| Paragraph 7 (a) and (b), the weighted sensitivity of a rate | The net sensitivity of each tenor and sub-curve of a currency is weighted by a risk weight that depends on the tenor and on the volatility group of the currency, and by the concentration factor of the currency. A rate has its bucket from its currency, and the volatility group of the currency gives the number that the file carries, which is 1 for regular, 2 for low and 3 for high volatility. | weight src/ | Tested SM-08 Tested SM-09 |
| Paragraphs 7 (b) and 8 (b), the concentration factor | The concentration factor is the larger of one and the root of the absolute exposure over the threshold. For rates the exposure is the sum over a currency, for credit the sum over an issuer whatever the tenor, and for equity, commodity and FX the sensitivity itself. A factor is one up to the threshold, it never falls when the exposure rises, and above the threshold the margin of a lone factor grows with the exposure to the power three halves. | concentration src/ | Proved SM-02 Tested SM-11 |
| Paragraphs 7 (c) and 8 (c), the margin of a bucket | The margin of a bucket, K, is the root of the form of its weighted sensitivities, with the correlation of two vertices and of two sub-curves for a rate, and the correlation of two names for the other classes, scaled by the smaller concentration factor over the larger. The sum of the weighted sensitivities, S, is held between minus K and K, and keeps its sign. A book with every sign changed has the same margin. | simm src/ | Proved SM-03 Proved SM-06 Tested SM-09 |
| Paragraph 7 (d), the margin across the currencies of a rate | The currencies are put together with the root of the sum of the squares of their margins plus, over each pair, one correlation times the smaller concentration factor of the two over the larger, times the two clipped sums. For up to three currencies the quantity under the root is at most the square of the sum of the margins and at least two fifths of the sum of the squares, so the floor in the engine is never reached. | IR_ src/ | Proved SM-05 Tested SM-09 |
| Paragraph 8 (d), the margin across the buckets of the other classes | The buckets of credit, equity and commodity are put together with the table of their class. The ratio of concentration factors lowers the correlation of two names inside a bucket and not between buckets. The residual bucket of credit and of equity is not aggregated with the others. Its margin is added after the root. | CQ_ src/ | Tested SM-09 Tested SM-11 |
| Paragraph 69, the calculation currency | There is no FX risk factor for the calculation currency, which is the US dollar. A line in FX of the dollar is counted and has no part of the margin, and its amount is not read. | CALCULATION_ src/ | Tested SM-14 Tested SM-18 |
| Rule of this product, the calibration | Every weight, threshold, correlation and group of currencies is a number of our own with the structure of the methodology, and every receipt names it as sketch-1. The tables are symmetric, have ones on the diagonal and nothing above one or below zero, and the correlation of two vertices of a rate falls by a tenth for each vertex between them, to a floor of a fifth. | CALIBRATION src/ | Tested SM-08 |
| Rule of this product, what a file may say | A line that breaks a rule is refused, the first one, with a message that names it by its place in the file and says what to do. A product class or risk type that is not read, an amount that is not finite or is above 1,000,000,000,000, a name over 40 characters, a rate with no tenor or sub-curve, a bucket that does not exist, a trade in two product classes and a name in two buckets are refused. So are no lines, and more than 400. | line src/ | Tested SM-12 |
| Rule of this product, where the margin comes from | The part of a factor is its size times what one more unit of it costs, which is the Euler allocation with the concentration factors held where they are. The parts of the factors add up to the margin, and so do those of the trades, the risk classes and the product classes. A hedge has a part below zero. Without a trade the margin is worked again, and it does not fall by the part of the trade. | trade src/ | Proved SM-04 Tested SM-13 Tested SM-14 |
| Rule of this product, the reconciliation | Two files are compared on their net factors. A difference is valued at what our margin falls by when that line alone is made the same as theirs, which is checked by running our margin again, and the one that closes the most comes first. Each is named as only ours, only theirs, a bucket, a sign, a scale of a hundred or ten thousand, or an amount. A difference of half a cent or less is not listed, and the result says so when the margins still differ. | reconcile src/ | Tested SM-17 |
| Rule of this product, a second program | A program that shares no code with the engine works 92 portfolios in decimals of sixty digits and finds the part of each factor by a difference quotient. They take both sides of the cut of S, the residual buckets, every risk class and product class, concentration in each risk class and every rule of correlation. The two agree to 3e-14, and the parts to 1e-9. | simm src/ | Tested SM-15 |
| Rule of this product, what the margin does | The margin is zero or more, finite, and never above the margin with no diversification. It does not change when a line of nothing is added, and it changes by less than a part in a trillion when every sign changes, when the order of the lines changes or when a line is split in two. It scales with the amounts when nothing is above its threshold, and it is the sum of the margins of the product classes when a book is split among them, to the same part. | simm src/ | Tested SM-16 |
| Receipt of a calculation | The receipt covers the calibration, the factors as the calculation took them and every figure that came out, in a fixed order. It is the same for a copy of the lines and for a factor whose lines are written as one or as two, and it changes when any line that the calculation reads changes. The trades are listed as they first appear, so the same lines in another order can give another receipt. The receipt of a reconciliation holds both calculations and every difference. | simm src/ | Tested SM-18 Tested KE-03 |
Verification
What we claim, and how it is checked
Every statement is registered, and each says which level of assurance it has earned. The ladder is explained on the verification page.
Proved
True for every input.
- SM-01
For margins of the six risk classes that are not below zero, the quantity under the root of the margin of a product class is at least the sum of the squares of the margins and at most the square of their sum. So the margin is at least the root of the sum of squares, which is what independent risk classes give, and at most the sum of the six margins.
17 checks, decided by Z3 5.3.3.0 (WebAssembly) and rerun from the emitted file by Z3 5.3.3 (native) and cvc5 1.4.2 (native, nl-cov). 3 broken variants are refuted. proofs/smt2/SM-01.smt2
- SM-02
The concentration factor is never below one and is one up to the threshold. Above it, its square times the threshold is the exposure, so the margin of a lone factor grows with the exposure to the power 3/2. It rises with the exposure, so more exposure never lowers a weighted sensitivity, and it depends only on the exposure over the threshold, so the unit of both does not matter.
6 checks, decided by Z3 5.3.3.0 (WebAssembly) and rerun from the emitted file by Z3 5.3.3 (native) and cvc5 1.4.2 (native, nl-cov). 5 broken variants are refuted. proofs/smt2/SM-02.smt2
- SM-03
In a bucket, the parts that rest on the factors add up to K² + S × C, where K² is the quantity under the root of the bucket margin, S is the clipped sum of the weighted sensitivities and C is what the other buckets put in the cross term. It holds when the sum is inside the clip, above it or below it, or when K is zero, and for any number of factors, because each step of the sum keeps the invariant.
8 checks, decided by Z3 5.3.3.0 (WebAssembly) and rerun from the emitted file by Z3 5.3.3 (native) and cvc5 1.4.2 (native, nl-cov). 9 broken variants are refuted. proofs/smt2/SM-03.smt2
Show the other 3 Show fewer
- SM-04
The parts of a product class add up to its margin. In a risk class, the parts of the regular buckets add up to the quantity under the root over the root, which is the core margin, and the residual bucket gives its own margin. The parts of the six risk classes, each the margin times the weighted margin over the total, add up to the total, which is the Euler identity of the table between risk classes.
6 checks, decided by Z3 5.3.3.0 (WebAssembly) and rerun from the emitted file by Z3 5.3.3 (native) and cvc5 1.4.2 (native, nl-cov). 5 broken variants are refuted. proofs/smt2/SM-04.smt2
- SM-05
For three buckets with the cross-bucket correlation of 3/10, any clipped sums within their K and any ratios of the concentration factors between 0 and 1, the quantity under the root of a risk class is at most the square of the sum of the bucket margins and at least 2/5 of the sum of their squares. So the cross-bucket aggregation never adds to the plain sum, the quantity is never below zero, and the floor in the engine is not reached.
23 checks, decided by Z3 5.3.3.0 (WebAssembly) and rerun from the emitted file by Z3 5.3.3 (native) and cvc5 1.4.2 (native, nl-cov). 4 broken variants are refuted. proofs/smt2/SM-05.smt2
- SM-06
The clipped sum of a bucket is never beyond K and has the sign of the sum. It is the sum inside the clip and K with the sign of the sum outside it. It rises with the sum, and a book with every sign changed has the clipped sum with its sign changed, so that the margin does not depend on which side of the market the book is on.
7 checks, decided by Z3 5.3.3.0 (WebAssembly) and rerun from the emitted file by Z3 5.3.3 (native) and cvc5 1.4.2 (native, nl-cov). 4 broken variants are refuted. proofs/smt2/SM-06.smt2
Certified
True for the case in hand, with evidence anyone can recheck.
- SM-07
The correlation tables of the sketch are positive definite. They are the tables between the six risk classes, between the vertices of a rate, between the buckets of qualifying credit, equity and commodity, and between FX rates for any mix of currencies. An exact LDL factorisation shows it, a separate checker accepts it, and a certificate with one pivot or one entry changed is refused. The engine finds no certificate for a table with one pair correlated beyond what the others allow.
tests/kernel/simm.test.tssrc/kernel/certify.tssrc/kernel/rational.ts
Tested
True on every input we tried.
- SM-08
The tables and weights are those of the sketch calibration, which is illustrative and is not the calibration of ISDA. Every correlation table is symmetric with ones on its diagonal and no entry above one or below zero. The vertices of a rate fall by a tenth for each vertex between them to a floor of a fifth. Credit, equity and commodity buckets have the structure of the methodology with numbers of our own. Every bucket has a weight, a threshold and a label.
tests/kernel/simm.test.ts
- SM-09
Each risk class is worked by hand in the tests. A rate has its weight times its size. Two vertices that offset in part give the root of the form and keep their sum inside the range of K, and two with one sign are cut to K with the side named. Sub-curves correlate at 0.95. Currencies, issuers, names and commodities take the correlation of their rule, and the residual bucket of credit and of equity is added after the root.
tests/kernel/simm.test.ts
- SM-10
The six risk classes of a product class are put together with the table, and the four product classes are added, so that one factor in two of them does not net. An empty risk class or product class has a margin of zero. The part of a factor that nets to exactly zero comes from the others that it correlates with. Amounts of ten digits and amounts of cents both work.
tests/kernel/simm.test.ts
Show the other 8 Show fewer
- SM-11
Concentration is judged on the sum for a currency or an issuer and not on each vertex. Exposure at the threshold is not concentrated, and above it the factor is the root of exposure over threshold. For rates the ratio of the factors of two currencies lowers their correlation, and for the other classes the ratio of two names lowers theirs inside a bucket. A book of large names costs about a third more than its plain margin, which sets every factor to one.
tests/kernel/simm.test.ts
- SM-12
A line that breaks a rule is refused, the first one, with a message that names it by its place and says what to do. Refused are a product class or risk type that is not one of those read, an amount that is not finite or is above 1,000,000,000,000, a name over 40 characters, a rate with no tenor or sub-curve, a bucket that does not exist, a trade in two product classes, a name in two buckets, no lines and more than 400.
tests/kernel/simm.test.ts
- SM-13
The part of each factor is its size times what one more unit of it costs, which is its coefficient. The parts of the factors add up to the margin for every portfolio of the tests and every case of the second program, and the same parts give those of trades, risk classes and product classes. A hedge has a negative part. With concentration the coefficient holds the factors where they are, so for one large name it is two thirds of the whole, and a difference quotient confirms it elsewhere.
tests/kernel/simm.test.ts
- SM-14
Each trade has the part of the margin that rests on it, in the order the trades first appear, and the lines with no trade count as one. Next to the part is what the margin falls by without the trade, and the two are not the same. A line of the calculation currency in FX has no part and is counted. A portfolio of one trade can be taken down to nothing, and nothing has a margin of zero.
tests/kernel/simm.test.ts
- SM-15
A second program in Python that shares no code with the engine works 92 cases in decimals of 60 digits and finds the part of each factor by a difference quotient. The cases take both sides of the cut of S, the residual buckets, every risk class and product class, concentration in each risk class and every rule of correlation. Every figure agrees with the engine to 3e-14, and the parts to 1e-9. The saved answers are what the program says now.
tests/kernel/simm.test.tsscripts/verify/simm_oracle.pytests/support/simm-oracle.json
- SM-16
Over generated portfolios the margin is zero or more, finite, and no more than the margin with no diversification, and the parts of the factors, the trades and the risk classes add up to it to a part in a hundred billion. It does not change when a line of nothing is added. It changes by less than a part in a trillion when every sign changes, when the order of the lines changes or when a line is split in two, and a book split among its product classes has the sum of their margins to the same part. It scales with the amounts when nothing is above its threshold.
tests/kernel/simm.test.ts
- SM-17
Two portfolios are compared on their net factors, and the result gives the margin of each side, the difference and the classes that have a margin on either side. A line is valued at what ours falls by when that line alone is made like theirs, which is checked by running ours again, and the one that closes the most comes first. Each break is named as only ours, only theirs, a bucket, a sign, a scale of a hundred or ten thousand, or an amount. A difference of half a cent or less is not listed, and the result says so when the margins still differ.
tests/kernel/simm.test.ts
- SM-18
The receipt of a margin holds the calibration, the kind, the factors as the calculation took them and the figures that came out. It is the same for a copy of the lines and for a factor whose lines are written as one or as two, and another for any change to a line that the calculation reads. The trades are listed as they first appear, so the same lines in another order can give another receipt. It does not read what it does not use, and it never carries a minus zero. The receipt of a reconciliation holds both calculations and every difference, and is another when a figure on either side moves by one unit or the sides change places.
tests/kernel/simm.test.ts
Use it
The same call, anywhere
This sample is written from the input the plate starts with, so the code and the numbers cannot drift apart.
import { reconcile, simm, simmReceiptPayload } from '@graphatlas/kernel/simm';
import type { SimmInput } from '@graphatlas/kernel/simm';
import { receipt } from '@graphatlas/kernel/receipt';
// The book of the plate with single names above their thresholds. Seven lines. The amount of a line is
// what the trade is worth for one basis point of a rate or a credit spread, or for one per cent of an equity,
// a commodity or an FX rate, in US dollars.
const input: SimmInput = {
lines: [
{ trade: 'SWP-2301', productClass: 'RatesFX', riskType: 'Risk_IRCurve', qualifier: 'USD',
bucket: '1', label1: '5y', label2: 'OIS', amount: 260000 },
{ trade: 'CDS-2310', productClass: 'Credit', riskType: 'Risk_CreditQ', qualifier: 'ISIN:XS2100000052',
bucket: '8', label1: '5y', label2: '', amount: 70000 },
{ trade: 'CDS-2310', productClass: 'Credit', riskType: 'Risk_CreditQ', qualifier: 'ISIN:XS2100000052',
bucket: '8', label1: '10y', label2: '', amount: 30000 },
{ trade: 'TRS-2320', productClass: 'Equity', riskType: 'Risk_Equity', qualifier: 'ISIN:US0000000038',
bucket: '5', label1: '', label2: '', amount: 1300000 },
{ trade: 'TRS-2321', productClass: 'Equity', riskType: 'Risk_Equity', qualifier: 'ISIN:DE0000000046',
bucket: '6', label1: '', label2: '', amount: 900000 },
{ trade: 'TRS-2322', productClass: 'Equity', riskType: 'Risk_Equity', qualifier: 'ISIN:BR0000000053',
bucket: '9', label1: '', label2: '', amount: 140000 },
{ trade: 'FXF-2340', productClass: 'RatesFX', riskType: 'Risk_FX', qualifier: 'ARS',
bucket: '', label1: '', label2: '', amount: 1100000 },
],
};
const run = simm(input);
const hash = await receipt(simmReceiptPayload(input, run));
// The same book as a counterparty sends it, with the sign of the first line the other way.
const theirs: SimmInput = {
lines: input.lines.map((l, i) => (i === 0 ? { ...l, amount: -l.amount } : l)),
};
const gap = reconcile(input, theirs); const out = {
total: 119773781.1155,
plain: 88537289.8787,
undiversified: 130875799.7154,
products: { RatesFX: 34373271.6233, Credit: 19697461.7654, Equity: 65703047.7267, Commodity: 0 },
trades: 6,
receipt: 'c27acb253165839b43675bc17f9ddd29b5be3ace8b77bf245cd56dc9b5fba0cb',
gap: {
ours: 119773781.1155,
theirs: 119773781.1155,
difference: 0,
differences: [{ hint: 'sign', qualifier: 'USD', closes: 0 }],
},
}; The call and the numbers come from the engine that built this page, run on the same input as the plate above. The sample is the third book of the plate, which is short enough to read. The plate compares its own receipt with the one printed here. The gap is the second plate on a book of seven lines, and it finds the one line that differs and says what making it the same would take off our margin. The amounts are those of the illustrative calibration of the sketch. Values are rounded to four places for display. The receipt hashes the unrounded numbers.
Runs on
- Browser
- Edge
- Node.js
- Python
- JVM
- .NET
- Excel
- Command line
- Container
Green surfaces are measured on every build of this site. Each must return the same receipt, bit for bit. The others are packaged targets that the build does not measure. How the platform works
Changes
When the rule moves, so does the engine
Publications that touch this regime, and the release that answered each.
-
Annual SIMM recalibration of risk weights and correlations
Shipped as SIMM 4.3, 5 days later