TWAP execution
hl_twap_orderAccumulate or reduce a position by slicing it into evenly-spaced child orders over a duration (TWAP) to minimize market impact. Use dry-run to preview schedule, then confirm to execute real orders.
Instructions
Accumulate/reduce a position by slicing it into evenly-spaced child orders over a duration (TWAP), minimizing market impact, with the builder code on every child. Dry-run returns the schedule; live schedules it and returns a plan id (poll with hl_execution_status). A live plan keeps the server process alive until every slice has fired; plan state is in-memory, so if the process is killed mid-run the already-submitted slices remain open on the exchange and the remainder is abandoned (logged on shutdown). ⚠️ Executes REAL child orders on your agent wallet when confirm=true & dryRun=false (builder code attached). Dry-run by default. Irreversible; not investment advice. Test on testnet first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | ||
| side | Yes | ||
| dryRun | No | ||
| slices | No | ||
| confirm | No | ||
| totalSize | Yes | ||
| reduceOnly | No | ||
| durationMinutes | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | ||
| mode | Yes | ||
| side | Yes | ||
| planId | No | ||
| children | Yes |