Catalog/trade-max-position

Calculators

Max position by leverage API

Maximum position by margin: maxUnits = (account·leverage)/price, plus margin consumed at a target size. Deterministic buying-power math. Answers 'max position I can open at 5x','buying power for my account','margin needed for 300 units'.

Price$0.01per request
MethodPOST
Route/v1/calc/trade-max-position
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
calctradingleveragebuying-powermarginposition-sizemax-sizefutures
API URLhttps://x402.hexl.dev/v1/calc/trade-max-position
Integration docs
Example request
{
  "account": 10000,
  "leverage": 5,
  "price": 100,
  "targetUnits": 300
}
Example response
{
  "account": 10000,
  "leverage": 5,
  "price": 100,
  "buyingPower": 50000,
  "maxUnits": 500,
  "formula": "maxUnits = (account · leverage) / price",
  "targetUnits": 300,
  "targetNotional": 30000,
  "marginRequired": 6000,
  "withinBuyingPower": true
}
Input schema
{
  "type": "object",
  "required": [
    "account",
    "leverage",
    "price"
  ],
  "properties": {
    "account": {
      "type": "number",
      "examples": [
        10000
      ]
    },
    "leverage": {
      "type": "number",
      "examples": [
        5
      ]
    },
    "price": {
      "type": "number",
      "examples": [
        100
      ]
    },
    "targetUnits": {
      "type": "number",
      "description": "Optional desired size to check against buying power.",
      "examples": [
        300
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}