read
Checks proposed changes, as shares added or removed, against a scenario’s bands and size ranges (a short against the class’s short size range), using prices you supply for every holding and every traded symbol. With Allow shorts on, a
SELL can take a holding below zero and shares_after is negative for a short.The result:- Lists each rule outside its range before or after the change (newly, further or still outside, or back inside), the symbols no rule looked at, and when your positions were last updated.
- Opens with a
summaryof those counts. - Sets
within_rulestrue only when no rule is outside its range after the change, one was judged and cash stays at 0 or more; false is not confirmed and blocks nothing. - Also returns
exposure_after, how much of the portfolio gains if prices rise once the change is applied, with options at their premium. That is a reading beside the rules, not part of the status.
- A held option with a mark needs no price from you, and a trade in an expired option is refused in words, because it counts 0.
- A SELL of a symbol you don’t hold, with Allow shorts off, says there is nothing to sell.
portfolio_idtrades(1 to 50, each withsymbol,sideand eithersharesornotional)prices- optional
scenario_id(defaults to the active scenario)
symbol, side, shares or notional and asset_class; a price on a trade is refused, because prices go in prices.read
Checks a mix you give as percentages instead of shares (a short is negative, a long can pass 100) against a scenario’s bands and size ranges (a short against the class’s short size range, by its size without the minus sign). Writes nothing. Recording a short still needs Allow shorts on and never an option holding. Each percentage must be between -1000000 and 1000000, and a
CASH entry can’t be negative because cash is never held below zero. A symbol at 0 is an exit, and a class left with nothing in it counts as 0% against its band. A symbol you don’t hold counts in no class until you name its class in asset_classes, and the result’s hint names any you left out. Violations carry band_min_pct and band_max_pct. Key arguments: portfolio_id, allocations, optional scenario_id (defaults to the active scenario), optional asset_classes.read
The share count that sits inside the size range you set for one holding, and what that does to cash. Writes nothing.
directionislong(the default) orshort. For a short, pass the short size range of the asset class assize_min_pctandsize_max_pct, a negativecurrent_sharesfor a short you hold, and a positivemanual_shares.- For a short, the share count, value and percent come back negative, and the status compares the absolute size with the range.
- When
basis_pointstakes the count outside the size range, the count stays andcompliance_statussaysBELOW_MINorABOVE_MAX. - Percentages are 0 to 100, and
portfolio_valueis thetotal_valuefrom a priced snapshot. - The result opens with a
summary: shares now, shares at target, the signed change, and where the target sits against the size range. Withoutcash,can_affordandcash_after_tradeare left out. MINIMUMneedssize_min_pct,MAXIMUMneedssize_max_pctandBALANCEDneeds both; without its bound the call is refused.
current_shares,price,portfolio_value- optional
size_min_pct,size_max_pct,sizing_mode,manual_shares,cash,direction - optional
basis_points(either sign, added to the target of every mode; with nosizing_modeand nomanual_sharesthe target is the current size, so it moves the holding; a positive adjustment makes a short larger; ignored whenmanual_sharesis given)
Next steps
Check result
Every field a check returns and how to read it.
Check a change
Who can call it, what to send and how to handle a failed call.
Size a position
Work out a share count that fits a size range.