Average Down
workflow.run_average_downShould-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
| Name | Required | Description | Default |
|---|---|---|---|
| mmr | No | 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 | |
| side | Yes | Trade direction: "long" or "short" | |
| mmBase | No | Value the maintenance margin is taken on: "liquidation" = position value at the liquidation price (default), "entry" = entry value. | |
| add_size | Yes | Additional size being considered, same unit convention as existing_size | |
| leverage | Yes | Leverage multiplier | |
| add_price | Yes | Proposed price to add at - also treated as today's current price for the fresh-entry comparison | |
| stop_loss | Yes | Stop-loss price (must be below add_price for a long, above it for a short - the position should already be closed otherwise) | |
| liqFeeRate | No | Liquidation fee as a fraction of position value, default 0, max 0.05; added to mmr. | |
| contractType | No | linear = USDT-margined (default), inverse = coin-margined. Risk figures come back denominated in the base coin for inverse. | |
| fee_open_pct | No | Open fee rate (default 0.0002) | |
| existing_size | Yes | Size already held: base-asset quantity for linear, USD notional (contracts) for inverse | |
| fee_close_pct | No | Close fee rate (default 0.0005) | |
| existing_entry_price | Yes | Entry price of the position already held |