> For the complete documentation index, see [llms.txt](https://docs.vooi.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vooi.io/vooi-ultra-v3/vooi_ultra-automationexamples/market-making-bot-example.md).

# Market-Making Bot Example

## Overview

**Market-Making Bot** is an open-source trading bot designed for delta-neutral market-making across supported perpetual venues.

The bot places passive limit orders on one venue and hedges filled orders on another venue. The goal is to capture spread while keeping net exposure close to zero.

The bot can work with supported venues and market groups available through VOOI Perps API, access available through VOOI Ultra.

{% hint style="warning" %}
This bot example is provided for educational purposes only. It is not financial advice and does not guarantee profit.

This bot was generated with AI-assisted development and tested before publication. It demonstrates how VOOI Ultra users can quickly prototype trading bots and agentic trading workflows using VOOI Perps API access available through VOOI Ultra.

Testing does not make the bot risk-free. Trading bots can place real orders and interact with real funds. Review the code, configuration, strategy, and risk controls before running any bot with live capital.
{% endhint %}

You can also inspect, test, and customize this bot with AI coding agents such as Claude Code, Codex, or Cursor.

## How it works

The bot runs a quote-and-hedge market-making cycle.

You configure two venues and an asset:

* **Primary venue:** where the bot places passive limit orders
* **Hedge venue:** where the bot opens the opposite side after a fill

Each cycle works as follows:

1. The bot places BUY and SELL limit orders around the mid price on the primary venue.
2. The bot waits until one of the limit orders is filled.
3. After a fill, the bot cancels the remaining limit order.
4. The bot opens the opposite side with a market order on the hedge venue.
5. The bot places reduce-only close orders on both venues.
6. If a close order is not filled within the configured timeout, the bot force-closes the remaining position at market.
7. The bot prints the cycle PnL and starts the next cycle.

On startup, the bot checks for leftover positions on the configured markets and refuses to run if any are found. On shutdown, it cancels its orders and force-closes its positions before exiting.

## What this example demonstrates

This bot is useful as a technical example for:

* Passive quoting on a primary venue
* Cross-venue hedging
* Delta-neutral market-making workflows
* Automated order lifecycle management
* Market and symbol resolution across venues
* HIP-3 builder market support
* Position cleanup and shutdown handling
* Risk controls for automated trading
* Agent-assisted customization of trading automation

## Before running this bot

**Trading bots can place real orders and interact with real funds.**

Before running any example with live capital:

1. Read the repository README.
2. Review the strategy, configuration, and risk controls.
3. Inspect the code yourself or ask an AI coding agent to inspect it.
4. Run the read-only preflight checks where available.
5. Start with small balances and conservative settings.
6. Monitor logs, open positions, orders, and bot activity.

Important risks include spread being too tight relative to fees, hedge execution slippage, one leg filling while the other fails, venue outages, force-close losses, liquidation risk, incorrect market configuration, and loss of access to credentials or the runtime environment.

## Requirements

The exact setup requirements are maintained in the repository README.

In general, this bot is intended for users who have:

* **VOOI Ultra account** with access to API token generation
* **VOOI API token** generated in VOOI Ultra <https://ultra.vooi.io/api-tokens>
* balances on at least two supported perpetual venues
* selected primary and hedge venues
* configured asset, spread, leverage, sizing, and timeout settings
* Node.js 18 or later
* a local machine or server where the bot can run
* enough technical experience to review logs and configuration files

VOOI Perps API is not publicly available as a standalone public API. These examples use API access available through VOOI Ultra for registered users.

Check the repository README for the current list of required credentials, environment variables, supported venues, market identifiers, and deployment options.

## Deployment and Repository

The repository README includes the current setup and deployment instructions.

Typical setup flows may include local setup, read-only preflight checks, small-balance testing, and long-running deployment if supported by the repository.

Before running the bot, use the available read-only helpers to validate API access, venue configuration, market resolution, and balances.

**Repository:** <https://github.com/vooi-app/vooi-mm-bot-example>

## Using an AI coding agent (optional)

You can ask Claude Code, Codex, Cursor, or another coding agent to inspect the codebase, explain the market-making cycle, review risk parameters, and help run the bot with conservative settings before any live deployment.

This workflow can be useful for agentic trading and what is often called vibe coding: start from an existing open-source bot, describe what you want to change, and use an AI coding agent to help modify and test the implementation.

**Example prompt:**

> Inspect this repository and explain what the Market-Making Bot does.
>
> Read the README, configuration files, dependency files, and deployment instructions.
>
> Explain the quote, fill, hedge, close, and shutdown logic.
>
> Check whether there are unsafe operations, hard-coded secrets, suspicious dependencies, or anything that should be reviewed before running the bot with real funds.
>
> Explain what credentials and settings are required from me, including venues, asset, spread, leverage, sizing, timeouts, and market identifiers.
>
> Help me run the available preflight checks and start with conservative settings.
>
> Do not enable live trading or place real orders unless I explicitly confirm.

## Next Steps

* Open the repository README for full setup and deployment instructions for **Market-Making Bot**
* Check other bot example:
  * [Funding Arbitrage Bot Example](/vooi-ultra-v3/vooi_ultra-automationexamples/funding-arbitrage-bot-example.md)
  * [Signal Bot Example](/vooi-ultra-v3/vooi_ultra-automationexamples/signal-bot-example.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.vooi.io/vooi-ultra-v3/vooi_ultra-automationexamples/market-making-bot-example.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
