Skip to main content
Glama

TradingCalc MCP: Options, Forex, Risk Stats, Prediction Markets, On-Chain & Crypto Futures

Average Down

workflow.run_average_down
Read-only

Should-I-average-down check: for an already-open position, compares adding more at a worse price against the always-available alternative of buying the same final total size fresh at today's price. Returns the new blended average entry, liquidation price and breakeven (before vs. after), margin_added (the actual cash/margin required for the add at this leverage, not the full notional), and three risk figures at your stop-loss: existing_risk (what you already risk, before adding), pyramid_risk (what you'd risk after adding), and clean_entry_risk (what a fresh entry at add_price for the same total size would risk). risk_penalty_pct is how much MORE than that fresh-entry alternative you're risking - for any genuine average-down (add_price worse than existing_entry_price) pyramid_risk is provably always greater than clean_entry_risk. liquidation_before_stop is true when the new liquidation price sits at or beyond your own stop-loss, meaning the exchange would force-close the position before the stop-loss ever triggers. Edge cases: all prices, sizes, stop_loss and leverage above zero; fee_open_pct and fee_close_pct are fractions from 0 to 0.05 (defaults 0.0002 and 0.0005); mmr 0 to 0.2; for a long the stop must be below the add price and for a short above it, otherwise an error (a stop that price already reached means the position should be closed). The risk comparison is meaningful only when the add is at a worse price than the existing entry. Not covered: funding, slippage, a stop that gaps through, and whether the market will recover. Use when user asks "should I add to this losing position?" or "what does averaging down actually cost me here?". liquidation_price and the liquidation distance are null when the position cannot be liquidated (an inverse short at 1x or less): check for null before using them.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "side": "<side>",
      "existing_entry_price": "<existing_entry_price>",
      "existing_size": "<existing_size>",
      "add_price": "<add_price>",
      "add_size": "<add_size>",
      "stop_loss": "<stop_loss>",
      "leverage": "<leverage>"
    },
    "name": "workflow.run_average_down"
  }
}

Input Schema

NameRequiredDescriptionDefault
mmrNoMaintenance margin rate as a fraction, 0 to 0.2 (default 0.005 = 0.5%); not a percent: 0.5% is 0.005, not 0.5
sideYesTrade direction: "long" or "short"
mmBaseNoValue the maintenance margin is taken on: "liquidation" = position value at the liquidation price (default), "entry" = entry value.
add_sizeYesAdditional size being considered, same unit convention as existing_size
leverageYesLeverage multiplier
add_priceYesProposed price to add at - also treated as today's current price for the fresh-entry comparison
stop_lossYesStop-loss price (must be below add_price for a long, above it for a short - the position should already be closed otherwise)
liqFeeRateNoLiquidation fee as a fraction of position value, default 0, max 0.05; added to mmr.
contractTypeNolinear = USDT-margined (default), inverse = coin-margined. Risk figures come back denominated in the base coin for inverse.
fee_open_pctNoOpen fee rate (default 0.0002)
existing_sizeYesSize already held: base-asset quantity for linear, USD notional (contracts) for inverse
fee_close_pctNoClose fee rate (default 0.0005)
existing_entry_priceYesEntry price of the position already held

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / mmr / description
      Previous value: -"Maintenance margin rate (default 0.005)"New value: +"Maintenance margin rate as a fraction, 0 to 0.2 (default 0.005 = 0.5%); not a percent: 0.5% is 0.005, not 0.5"
    • addedInput schema / properties / mmr / maximum
      Added value: +0.2
    • addedInput schema / properties / mmr / minimum
      Added value: +0
  2. Changed2 schema fields changed
    • addedInput schema / properties / liqFeeRate
      Added value: +{
      +  "description": "Liquidation fee as a fraction of position value, default 0, max 0.05; added to mmr.",
      +  "type": "number"
      +}
    • addedInput schema / properties / mmBase
      Added value: +{
      +  "description": "Value the maintenance margin is taken on: \"liquidation\" = position value at the liquidation price (default), \"entry\" = entry value.",
      +  "enum": [
      +    "liquidation",
      +    "entry"
      +  ],
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedInput schema / properties / side / description
      Added value: +"Trade direction: \"long\" or \"short\""
  4. Added

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish a safe read-only, closed-world operation, and the description goes well beyond that: what each returned field means, that liquidation_price is null for positions that cannot be liquidated, that an invalid stop side raises an error, and the exact input ranges and defaults. It even flags the provable inequality (pyramid_risk > clean_entry_risk for genuine adds) so the agent can sanity-check results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is long but front-loaded, opening with the core comparison before enumerating outputs and edge cases. A few clauses repeat schema constraints (fee ranges, stop-side rule) that could have been trimmed, but nothing is filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 13 parameters and no output schema, the description carries the full burden of explaining return values, and it does so field by field, including the null liquidation case and the interpretation of risk_penalty_pct. An agent has everything needed to call it and read the result correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description adds meaning by explaining that add_price doubles as today's current price for the fresh-entry comparison and by framing margin_added as cash/margin at this leverage rather than notional. Most other parameter detail (fee defaults, mmr range, stop-side constraint, contract type) merely restates the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific decision-support verb and resource: an 'already-open position' comparison of adding at a worse price versus a fresh entry for the same final size. It is clearly distinguishable from siblings such as run_average_buy_price or primitive.average_entry because the fresh-entry counterfactual and risk_penalty_pct are named up front.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit trigger phrases ('should I add to this losing position?', 'what does averaging down actually cost me here?') and states non-coverage (funding, slippage, gap risk, recovery). It does not name sibling tools or say when to prefer them instead, so routing against the many average/breakeven/planning siblings is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.