Market maker keeper for the Polymarket CLOB.
This software is experimental and in active development. Use at your own risk.
The keeper is an automated market maker for CLOB markets. Places and cancels orders to keep open orders near the midpoint price according to one of two strategies.
- Python 3.10
-
Run
./install.sh
to set up the virtual environment and install depedencies. -
Create a
.env
file. See.env.example
. -
Modify the entries in
config.env
. -
Modify the corresponding strategy config in
./config
, if desired.
- Start the keeper with
./run-local.sh
.
- To start the keeper with docker, run
docker compose up
.
The config.env
file defines 3 environment variables:
CONDITION_ID
, the condition id of the market in hex string format.STRATEGY
, the strategy to use, either "Bands" or "AMM" (case insensitive)CONFIG
, the path to the strategy config file.
Every sync_interval
(the default is 30s), the strategies do the following:
- Fetch the current midpoint price from the CLOB
- Compute expected orders.
- Compare expected orders to open orders.
- Compute open orders to cancel and new orders to place to achieve or approximate the expected orders.
- Cancel orders.
- Place new orders.
When the app receives a SIGTERM, all orders are cancelled and the app exits gracefully.