# Investing Math – Position Size Calculator

> Investing Math – Position Size Calculator is a paid API for AI agents from invest-math.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-29).

Calculates the number of units to buy, dollars at risk, position cost, and R-multiple profit targets from account size, risk percentage, entry price, and stop-loss price.

## Facts

- Endpoint: GET https://invest-math.x402tookit.com/position-size?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/investing-math-position-size-calculator-d01c1382
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-9RoWBxwXbTcu8sWc0A4V

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability investing-math-position-size-calculator-d01c1382
```

Example prompt: I have a $25,000 trading account and I want to risk 1.5% on a trade. My entry is $142.50 and my stop loss is $138.00 — how many shares should I buy, what's my dollar risk, and what are my 1R, 2R, and 3R targets?

## When to prefer this

Use this endpoint when you need a precise, rules-based position size calculation given a specific account size, risk tolerance, entry price, and stop loss — especially when you also want R-multiple profit targets (1R/2R/3R) and a cost breakdown. Prefer this over manual calculation or generic finance APIs when the user is actively planning a trade and needs actionable unit counts and dollar-risk figures in a single call.

## Known failure modes

- Missing required query parameters (account, riskPct, entry, stop) returns an error
- riskPct outside allowed range (0.01–25) may return a validation error or degraded result
- Stop price above entry for a long trade (or below for short) may produce unexpected direction or error
- Very tight stop distances may result in fractional units and a needsLeverage flag
- Non-numeric parameter values return a parsing error

## How this service works

Position size from account size, risk percent, entry and stop: units to buy, dollars at risk, cost and R-multiple targets.

## Output

Returns an object containing: number of units to buy, direction (long/short), stop distance in price and percent, position cost in dollars, budgeted and actual dollar risk, position as a percent of account, whether leverage is needed, 1R/2R/3R profit targets, a plain-language summary, verdict, and optional warnings or reasons if the calculation is degraded or flagged.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "account",
      "riskPct",
      "entry",
      "stop"
     ],
     "properties": {
      "stop": {
       "type": "number",
       "description": "Stop-loss price (below entry for long, above for short)"
      },
      "entry": {
       "type": "number",
       "description": "Entry price"
      },
      "feePct": {
       "type": "number",
       "description": "Round-trip fees as a percent of position value, default 0"
      },
      "account": {
       "type": "number",
       "description": "Account value"
      },
      "riskPct": {
       "type": "number",
       "description": "Percent of the account to risk, 0.01 to 25"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "units": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "targets": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "oneR": {
         "type": [
          "null",
          "number"
         ]
        },
        "twoR": {
         "type": [
          "null",
          "number"
         ]
        },
        "threeR": {
         "type": [
          "null",
          "number"
         ]
        }
       }
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "direction": {
       "type": [
        "null",
        "string"
       ]
      },
      "d
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/investing-math-position-size-calculator-d01c1382/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from invest-math.x402tookit.com](https://www.zero.xyz/host/invest-math.x402tookit.com/llms.txt)
