> For the complete documentation index, see [llms.txt](https://docs.insilicoterminal.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.insilicoterminal.com/documentation/terminal-cli/repeat.md).

# Repeat

The repeat command allows to script pseudo-loops of commands or complex command blocks in the CLI. To repeat single or chained commands with parallel (&) and chained (;) and sleep commands apply the following syntax using parentheses (...) :

`repeat <count> (commands...)`<br>

Parentheses create a block. Inside the block, normal `;` and `&` apply and explicit instruments can be used. The block is executed `count` times. Use `sleep` commands inside the block to dictate pacing; no time parameter on `repeat` is needed. You may use nested repeat blocks. The CLI will auto-abort if any sub-command inside a `repeat` or `sleep` chain is not recognised.&#x20;

Examples:

`repeat 5 (buy 1; sleep 1m)`

`repeat 5 (buy 1 btcusdt & buy 1 ethusdt & buy 1 solusdt; sleep 1s)`

This allows you to create custom order types. E.g. you can create a custom swarm command to let the MM refill the books inbetween multiple batches to minimize slippage whithout risking MM widen their quotes while you hit the book:

`repeat 5 (swarm buy 1000000$ into 5; sleep 5s)`

Repeat commands are also bindable:

`bind digit2 "repeat 3 (buy 1; sleep 500ms)"`

#### Task Management

Every repeat task (and chained command using sleep) has an ID assigned which is a session-local rolling counter maintained by the CLI. The IDs are shown via: Console log, `tasks` command and the Activity component.

Inside the CLI the following commands are available for control:

```
tasks               # list active CLI tasks only (IDs + command string)
kill                # kill the most-recent CLI task
kill 3              # kill task ID 3
kill all            # kill every running CLI task
```

#### UI for tasks via Activity component

Use the Activity component to monitor ongoing repeat tasks. You can manually cancel repeat tasks .
