Trading Calculations
Use this page to convert AlphaInsider’s normalized strategy data into correct user-facing values and API order inputs.- REST API:
https://alphainsider.com/api - WebSocket:
wss://alphainsider.com/ws - OpenAPI: https://api.alphainsider.com/openapi.yaml
- Skill guide: https://api.alphainsider.com/skill.md
Core Model
AlphaInsider strategies use normalized internal values:strategy_valueis a normalized performance score, not dollars.- Position
amountand orderamount/totalare strategy-normalized units. price,bid,ask,last, and stop/limit prices are real market prices.input_multiplierconverts strategy-normalized units into the user’s display units.input_multiplier = input_value / strategy_value_at_input_date.- Fetch
input_multiplierfromGET /getStrategySubscriptions. - Set or update calculation inputs with
POST /updateStrategyCalculation. - API numeric values may arrive as strings. Convert before doing math.
strategy_value, raw position amount, or raw order total as user-facing dollars or shares.
Missing Multiplier
Owners should have aninput_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 forinput_valueandinput_date. - Do not size a fixed
newOrderfrom 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.
amountis strategy-normalized shares or crypto units.totalis 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
newOrderwith user-visible shares/USD wheninput_multiplieris missing.
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_dependenciesin the request. - Allocation-generated increase orders may depend on reduce orders; read returned
order_dependenciesbefore 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 livestrategy_value.wsPositions:<strategy_id>for position changes.wsOrders:<strategy_id>for open order changes andorder_dependencies.
Agent Checklist
- Fetch or confirm
input_multiplierbefore 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.amountornewOrder.totalby dividing byinput_multiplier. - Do not apply multiplier math to prices, stop prices, allocation percents, or webhook signal actions.
- Check
successbefore usingresponse.