Guides

Sizing Helpers & Variables

Use explicit quantity calculations and the correct execution interface.

Sizing depends on the instrument, execution adapter, and strategy's intended exposure. Do not infer a quantity calculation from an unimplemented helper or a generic SQL expression.

Choose the correct field

SJS order requests use quantity. The configured SQX order primitive uses size; its limit price property is limitPrice. Those interfaces are related but not interchangeable.

For unit, position, and capital checks, follow sizing and placing orders. Validate finite, positive quantities and adapter-specific constraints before submission.

Constants and calculations

Use ordinary JavaScript constants and calculations inside SJS for reusable strategy settings. The first strategy includes a complete settings object and a fixed quantity.

Current SQX text does not provide LET declarations, variable interpolation, array expressions, or general arithmetic evaluation. An identifier used as a parameter value is not automatically resolved to a previously defined variable.

Earlier riskPct and fixedDollar snippets on this page did not establish implemented automatic sizing helpers. They have been replaced with the verified execution and strategy guides. The similarly named riskCap primitive also does not currently enforce a percentage limit.

Check the outcome

Compare intended quantity with the actual request, acceptance, position, and fills. An allowed request is not proof of available capital or broker acceptance. A quantity limit per request is not the same as a limit on accumulated exposure.

Continue with comparing one change to test a quantity change while keeping inputs fixed.

On this page