DCA Entry
workflow.run_dca_entryDCA entry planner: weighted average entry price, breakeven, and per-level contribution from multiple fill prices and sizes. Each fill is { price, size } here (primitive.average_entry calls the same field quantity). Compared with primitive.average_entry, this one adds output for the case where breakeven or the per-level breakdown is also wanted, not just the bare average. Edge cases: 2 to 20 fills (size also accepted as quantity), each price and size above zero; fee_open_pct and fee_close_pct are fractions from 0 to 0.05 (defaults 0.0002 and 0.0005); every fill is on the same side and the same contract type. Not covered: fills at different times with different fees, partial closes, funding paid while the position was open, and liquidation (use workflow.run_liquidation_safety). Use when user bought at several prices and asks "what's my average entry?" or "where is my DCA breakeven?". Returns: averageEntry, breakeven, per-level summary.
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>",
"entries": "<entries>"
},
"name": "workflow.run_dca_entry"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | Trade direction: "long" or "short" | |
| entries | Yes | Fills to average (2 to 20). Each: { price, size }, e.g. [{ "price": 60000, "size": 0.5 }, { "price": 58000, "size": 1 }]. Size is base-asset quantity for linear, USD notional (contracts) for inverse. | |
| contractType | No | linear = USDT-margined (default), inverse = coin-margined. Each fill's size is USD notional (contracts) for inverse; averageEntry is then the harmonic mean of fill prices, not the arithmetic mean. | |
| fee_open_pct | No | Open fee rate (default 0.0002) | |
| fee_close_pct | No | Close fee rate (default 0.0005) |