# 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 .


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.insilicoterminal.com/documentation/terminal-cli/repeat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
