Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.miramarket.org/llms.txt

Use this file to discover all available pages before exploring further.

Miramarket exposes validation behavior through three public concepts: shape checking, semantic validation, and fee-aware sizing. This page describes behavior without requiring internal implementation details.

Shape check

Use the shape check when input may not be a strategy object yet. It verifies that the top-level value is an object and that required top-level fields have the expected primitive shape.

Input

Any unknown value.

Success

The value can be treated as strategy JSON for deeper validation.

Failure

The shape check throws a domain error with a message that starts with Strategy shape:. Common messages include:
MessageMeaning
Strategy shape: expected an object.The input is not an object.
Strategy shape: nodes must be an array.nodes is missing or not an array.
Strategy shape: edges must be an array.edges is missing or not an array.
Strategy shape: decision_groups must be an array.decision_groups is missing or not an array.
Strategy shape: initial_principal_usd must be a finite number.initial_principal_usd is missing, non-numeric, or not finite.

Semantic validation

Use semantic validation after shape checking. Semantic validation returns an array of error strings. An empty array means the strategy passed public validation.

Input

A strategy JSON object.

Options

OptionMeaning
skipFeeAwareCheckWhen true, skip the fee-aware principal check.
The fee-aware check is also skipped when strategy JSON has is_demo: true.

Output

[]
or:
[
  "root_node_id does not reference an existing node.",
  "Decision group entry_group split allocation is 90, expected 100."
]

Fee-aware sizing

Fee-aware sizing estimates the minimum initial_principal_usd needed for every reachable leaf market action. It accounts for:
  • Allocation splits.
  • Action depth.
  • Conservative fee assumptions.
  • Minimum dollar order size.
  • Minimum share order size.
  • Current price when provided.
  • A fallback price when no current price is provided.

Result fields

FieldMeaning
requiredPrincipalUsdMinimum required starting principal.
worstLeafIdnode_id of the limiting leaf action.
worstLeafLabelLabel used in the validation message.
worstLeafRawMinUsdRaw minimum order size for that leaf before fee scaling.
worstLeafPricePrice used in the calculation.
worstLeafPriceIsDefaultWhether the fallback price was used.
If no reachable market leaf requires sizing, the result is null.

Public constants

NameValueMeaning
CLOB_MIN_USD1Minimum order size in USD.
CLOB_MIN_SHARES5Minimum shares per order.
DEFAULT_LEAF_PRICE0.50Fallback price used when current_price is absent.
MAX_TRADING_FEE_RATE0.06Conservative fee rate used for design-time sizing.
  1. Parse JSON.
  2. Run the shape check.
  3. Run semantic validation.
  4. If errors are returned, show every error to the user or agent.
  5. Treat an empty error array as valid.

Agent guidance

When generating or repairing strategy JSON:
  • Do not suppress semantic errors.
  • Preserve exact field names from the JSON format.
  • If fee-aware sizing fails, increase initial_principal_usd instead of removing market actions.
  • Use is_demo: true only when the strategy is explicitly a demo.