Measured Behaviour

Does obfuscation break margin call thresholds?

A margin requirement is a number a firm chooses to be stricter than the rule book. That is the whole point of a house requirement - and it is also why losing the name that carries it does not produce a missing value or an error. It produces the regulator's number, which is real, published, defensible, and not the one the firm decided to enforce.

A house number, a floor under it, and nine accounts

The fixture is a margin run over nine accounts on one business day. The rule book's maintenance requirement is 25 per cent. This firm holds its clients to 30, and floors its own number at 28 so that a configuration slip cannot take it below that. Positions in two symbols carry no loan value and must be held outright; one account is concentrated enough to attract a 15 point add-on; clients get three days to meet a call before stock is sold, and the sale clears the requirement plus a 10 per cent buffer.

On the correct run, five accounts are under the house requirement, five calls go out, the total deficit is 114,120.00, and 35,376.00 of stock is sold from the accounts that have already had their three days. Every one of those five accounts is comfortably above the regulator's 25 per cent. They are in breach of this firm's rule and of nothing else - which is the ordinary state of a margin book, not an exotic case.

Protection alone, on all five profiles, produced byte-identical output. As on every other page in this series, the failures require member renaming.

The vendor default is the regulator's number

Rename maintenanceMarginPct and the library substitutes its own 25. The firm's 28 per cent floor then applies, so the effective requirement lands at 28 rather than 30.

That floor is doing exactly what it was built for, and it is worth seeing how much it buys and how much it does not. Four of the five calls survive. The fifth account - the one sitting between 28 and 30 - is no longer called at all. The total deficit reported falls from 114,120.00 to 46,168.00, and the stock actually sold falls from 35,376.00 to 3,080.00.

So a control that is designed to catch precisely this failure caught most of it. The account that got away is not a rounding error either: it is a real breach of the firm's own credit policy, and the risk desk's own review passed the run, because what that review compares is derived from the requirement that moved.

The floor cannot floor a number it lost with

Renaming regulatoryMinimumPct on its own does nothing. The requirement stays at 30, because a floor of 28 under a house number of 30 is inert by design. An arm like that is the kind a reviewer closes as cosmetic.

Rename both - which is what a single broad pattern over an options object does, and what a careless MemberRegexp reaches - and the effective requirement is 25 per cent with nothing beneath it. Breaches went from five to zero. No call was issued, the deficit total read 0.00 against 114,120.00, nothing was liquidated, and the risk desk own rule passed a margin run in which five accounts were in breach of the firm credit policy.

Neither half predicts that. One half is partly protective - four of five calls survive - and the other half is completely inert. The union is the entire margin run going quiet.

The general form is one this site has measured repeatedly. Test the halves and the union separately; a clean reading on each half is not evidence about the pair, and the dangerous cells are not always at the wide end of the pattern.

Two renames that left the call report untouched

^(callGraceDays)$ reverts three days to the library's five. Every account that was breaching still breaches, all five calls still go out, and the deficit total is identical to the cent. The only figure that moves is the stock sold: 35,376.00 becomes 12,892.00, because two accounts fall inside the longer grace and are left alone.

The record-field version is quieter still. Renaming daysUnderCall means no account can be established as having had its days, and nothing is sold at all - LIQUIDATED=0.00 - while the report continues to show five calls issued against a 114,120.00 deficit.

A margin report that shows five calls and a correct deficit is a margin report that looks right. What is missing from it is the action, and the action is the part that protects the firm's capital.

Collateral that is not collateral

Two symbols on this book carry no loan value, so their full value is required rather than 30 per cent of it. That is expressed as a list on the options object.

Renaming nonMarginable empties the list, and every position becomes ordinary collateral. The account holding them stops breaching: calls fall from five to four and the deficit from 114,120.00 to 93,300.00. Renaming the symbol field on the position records reaches the identical answer by the other route, because a position whose symbol cannot be read cannot match the list either.

The concentration add-on behaves the same way. Renaming either concentrationThresholdPct or concentrationAddOnPct takes the concentrated account out of breach, with the deficit falling to 52,980.00 in both cases. The account still holds two thirds of its value in one name; nothing about it changed except the requirement applied to it.

What failed closed

Five arms refused loudly. Renaming cashUsd, loanUsd or markUsd makes equity non-finite and the run stops at the first account. Renaming accountId or owner breaks the join between accounts and positions, so every account appears to hold nothing against a real debit balance, and the risk desk's rule refuses nine equity-negative accounts.

That is the same contrast as everywhere else: the arms that destroy a number are loud, and the arms that change what a correct number is compared against are silent. Nobody has to be told about the loud ones.

The quiet run sees none of it

The fixture also runs the same nine accounts on a day when the market has been kind and every one of them is far above both numbers. On that run every arm on this page is inert - the requirement, the add-on, the no-loan-value list and the grace decide nothing when nobody is close to a call.

Most margin runs in a year are that run. Whether a margin error is observable is a property of the day, not of the engine.

What to do about it

Obfuscate the risk service if you need to; the base measurement here is clean on every profile. The care goes into RenameMembers: exclude the keys of any options object that crosses into an installed library, and the field names of the records it reads. Protect Members documents how the pattern is applied.

In the code itself, two things are worth having whatever you do about obfuscation. Assert the requirement you intend to enforce rather than accepting whatever the library returns - a house number that silently equals the regulator's minimum is a configuration failure worth refusing outright. And check the liquidation actually performed against the calls issued, because the two arms above that sold nothing left the call report perfect.

The related pages below reach the same shape from risk scoring, from coverage limits and from guard bands: a threshold's failure direction is decided by where the vendor's default points, not by how important the threshold sounds. If you operate in the EU, DORA and your JavaScript front end covers the resilience-testing obligations that sit around a risk engine.

Frequently asked questions

Can obfuscation stop a margin call from being issued?

Protection with default settings did not, on any of the five profiles measured. Member renaming did: renaming the house maintenance requirement reverted it to the library's 25 per cent default, and one account that was genuinely in breach of the firm's policy was no longer called.

Why is the library's default the regulator's number?

Because that is the only number a library can reasonably ship. It cannot know a particular firm's credit appetite, so it uses the published minimum. That makes the failure especially hard to spot: the value substituted is real, defensible and correct for somebody, just not the value the firm chose.

Did the firm's own floor protect it?

Partly. With a floor of 28 per cent under a house number of 30, renaming the house number alone left four of the five calls intact and cut the stock sold from 35,376.00 to 3,080.00. Renaming the house number and the floor together - which one broad pattern does - took the requirement to 25 with nothing beneath it.

Which rename was the quietest?

Renaming the days-under-call field on the account records. Every call was still issued and the deficit total was identical to the cent, but nothing was liquidated at all. The report a supervisor reads was unchanged; only the action it was supposed to trigger disappeared.

Does the concentration add-on survive renaming?

No, and by either of two routes. Renaming the concentration threshold or the add-on percentage both took the concentrated account out of breach, with the reported deficit falling from 114,120.00 to 52,980.00. The account's holdings did not change.

What is safe to rename in a risk engine?

Names your own bundle owns on both sides - local variables, functions, and object properties that are written and read entirely within the protected code. Option keys handed to an installed library and field names that library reads are part of an external contract and should be excluded from the regexp.

Were the ES5 and modern targets different?

No. Both were measured on every arm and agreed throughout, and the base column with no member renaming was byte-identical to the unprotected run on both targets plus the two emit-gate profiles and the string-encoding profile.

Related reading