Skip to main content
This script asks which of your rules a change would put outside range, and prints the facts. A result inside every range does not say a change is advisable. Allocait cannot approve, stop or place an order. Your own code decides what happens next. Illustrative example. The figures are hypothetical, not a recommendation. Save the script as check.mjs and run it with Node 18 or later. Set ALLOCAIT_API_KEY and ALLOCAIT_PORTFOLIO_ID first. Create a Read only key under Settings > API keys, and get the portfolio id from GET /portfolios.
A Read only key is enough, because the check only reads. result.rules lists each rule outside its range before or after the change. change is newly_outside, further_outside, still_outside or back_inside. A class band has a null symbol. Send several planned orders as one trades list (up to 50) to check them together; trades in one symbol net. Separate calls each start from the holdings Allocait has recorded, so they don’t see each other. Each trade takes shares or notional, and a symbol you don’t hold needs asset_class. The check uses the portfolio’s active scenario; if the portfolio has none, pass scenario_id. Each call needs a price for every held symbol and every changed symbol (a held option with a mark needs none), or it fails with PRICES_INCOMPLETE and missing_symbols. newly_or_further_outside_count is the number of rules the change puts outside range or leaves further outside. 0 means neither. within_rules answers a different question: whether the whole book is inside every rule afterward. See Check result for every field and Check a change for the job.

Next steps