Spot DCA
workflow.run_spot_dcaDollar-cost averaging on a spot coin: the same cash amount bought at each of a list of prices (no leverage, no funding). Returns the coins held, total invested, the average price paid (below the plain average of the prices, because equal cash buys more coins when the price is low), the average cost per coin with the buy fee in it, the break-even sell price and, when currentPrice is given, the value, profit and ROI of selling everything there after the sell fee. amountPerBuy is the cash that leaves the account for one buy, buy fee included. Each fee is a fraction of that fill's trade value (0.001 = 0.1%, at most 0.05). Prices may be in any currency; results are in the same one. The average price is the harmonic mean of the prices; break-even = averageCostPerCoin / (1 - sellFee). Edge cases: 1 to 1000 prices; every price and amountPerBuy must be above zero; a list of one buy is valid; a non-finite result (huge or tiny inputs) is an error; without currentPrice no profit, ROI or proceeds are returned. Not covered: taxes, FIFO/LIFO lots, slippage, withdrawal or network fees, currency conversion, leverage and funding. For buys of unequal size or with sells in between use workflow.run_average_buy_price; for DCA on a perpetual futures position use workflow.run_dca_entry. Use when user asks "I buy $100 of BTC every week at these prices, what is my average and where am I now?". Returns: buys, totalInvested, totalQuantity, averageBuyPrice, averageCostPerCoin, simpleAveragePrice, lowestPrice, highestPrice, totalBuyFees, breakevenSellPrice, and (with currentPrice) currentValue, sellFee, proceeds, profit, roiPct (a fraction).
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": {
"prices": "<prices>",
"amountPerBuy": "<amountPerBuy>"
},
"name": "workflow.run_spot_dca"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prices | Yes | Price paid per coin at each buy, in order (1 to 1000 positive numbers, e.g. [60000, 52000, 48000]) | |
| buyFeePct | No | Buy fee as a fraction of the trade value, 0 to 0.05 (0.001 = 0.1%). Default 0 | |
| sellFeePct | No | Sell fee for the exit, as a fraction of the trade value, 0 to 0.05. Default 0 | |
| amountPerBuy | Yes | Cash spent on each buy, buy fee included (e.g. 100) | |
| currentPrice | No | Optional: the price to value the whole position at, same currency as prices |