Skip to main content

Trading Calculations

Use this page to convert AlphaInsider’s normalized strategy data into correct user-facing values and API order inputs.

Core Model

AlphaInsider strategies use normalized internal values:
  • strategy_value is a normalized performance score, not dollars.
  • Position amount and order amount/total are strategy-normalized units.
  • price, bid, ask, last, and stop/limit prices are real market prices.
  • input_multiplier converts strategy-normalized units into the user’s display units.
  • input_multiplier = input_value / strategy_value_at_input_date.
  • Fetch input_multiplier from GET /getStrategySubscriptions.
  • Set or update calculation inputs with POST /updateStrategyCalculation.
  • API numeric values may arrive as strings. Convert before doing math.
Never display raw strategy_value, raw position amount, or raw order total as user-facing dollars or shares.

Missing Multiplier

Owners should have an input_multiplier. If an owner flow appears to lack one, refresh the subscription/calculation context before displaying values or sizing fixed orders. Subscribers may have input_multiplier: null. When it is missing:
  • Do not silently treat it as 1.
  • Display percent fallback values derived from strategy_value, or ask for input_value and input_date.
  • Do not size a fixed newOrder from user-visible shares/USD until a multiplier exists.

Display Formulas

Use these formulas when showing positions, cash, shares, crypto, or portfolio values to a user. Use bid for long assets, ask for short liabilities, and 1 for cash.

Order Endpoint Choice

Call GET /getMaxOrderSize before large, leveraged, or user-risky fixed orders.

newOrder

newOrder accepts exactly one of amount or total.
  • amount is strategy-normalized shares or crypto units.
  • total is strategy-normalized cash.
  • If the user gives a share or crypto count, send amount = user_visible_amount / input_multiplier.
  • If the user gives a USD amount, send total = user_visible_dollars / input_multiplier.
  • Do not use newOrder with user-visible shares/USD when input_multiplier is missing.
Open order responses from getOrders, newOrder, newOrderAllocations, newOrderWebhook, and wsOrders include order_dependencies as prerequisite order IDs. [] means no outstanding prerequisite.

newOrderAllocations

Use newOrderAllocations when the user wants target portfolio percents instead of exact shares/USD. Before submitting allocation-generated orders, this endpoint cancels any existing open orders for the strategy.
  • Send target percents as documented in OpenAPI.
  • Do not apply input_multiplier.
  • Do not send order_dependencies in the request.
  • Allocation-generated increase orders may depend on reduce orders; read returned order_dependencies before assuming an order can fill immediately.

Webhooks And Streams

newOrderWebhook is for signal-style actions and uses api_token in the body. It does not need multiplier math. By default each alert goes fully in or out of the position at leverage; the optional pyramiding integer steps into the position by leverage / pyramiding per same-direction alert. Before submitting a new order, newOrderWebhook cancels any existing open orders for the strategy. For live displays, subscribe to:
  • wsStrategyValue:<strategy_id> for live strategy_value.
  • wsPositions:<strategy_id> for position changes.
  • wsOrders:<strategy_id> for open order changes and order_dependencies.
Refresh subscription/calculation context after strategy resets before displaying normalized values.

Agent Checklist

  • Fetch or confirm input_multiplier before showing user-facing dollars, shares, crypto counts, or fixed-order sizes.
  • Use percent fallback only when multiplier is missing.
  • Convert user-visible shares/USD to newOrder.amount or newOrder.total by dividing by input_multiplier.
  • Do not apply multiplier math to prices, stop prices, allocation percents, or webhook signal actions.
  • Check success before using response.