Home

Awesome

<!-- PROJECT SHIELDS -->

Contributors Forks Stargazers Issues MIT License

<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/polymarket/agents"> <img src="docs/images/cli.png" alt="Logo" width="466" height="262"> </a> <h3 align="center">Polymarket Agents</h3> <p align="center"> Trade autonomously on Polymarket using AI Agents <br /> <a href="https://github.com/polymarket/agents"><strong>Explore the docs »</strong></a> <br /> <br /> <a href="https://github.com/polymarket/agents">View Demo</a> · <a href="https://github.com/polymarket/agents/issues/new?labels=bug&template=bug-report---.md">Report Bug</a> · <a href="https://github.com/polymarket/agents/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a> </p> </div> <!-- CONTENT -->

Polymarket Agents

Polymarket Agents is a developer framework and set of utilities for building AI agents for Polymarket.

This code is free and publicly available under MIT License open source license (terms of service)!

Features

Getting started

This repo is inteded for use with Python 3.9

  1. Clone the repository

    git clone https://github.com/{username}/polymarket-agents.git
    cd polymarket-agents
    
  2. Create the virtual environment

    virtualenv --python=python3.9 .venv
    
  3. Activate the virtual environment

    • On Windows:
    .venv\Scripts\activate
    
    • On macOS and Linux:
    source .venv/bin/activate
    
  4. Install the required dependencies:

    pip install -r requirements.txt
    
  5. Set up your environment variables:

    • Create a .env file in the project root directory
    cp .env.example .env
    
    • Add the following environment variables:
    POLYGON_WALLET_PRIVATE_KEY=""
    OPENAI_API_KEY=""
    
  6. Load your wallet with USDC.

  7. Try the command line interface...

    python scripts/python/cli.py
    

    Or just go trade!

    python agents/application/trade.py
    
  8. Note: If running the command outside of docker, please set the following env var:

    export PYTHONPATH="."
    

    If running with docker is preferred, we provide the following scripts:

    ./scripts/bash/build-docker.sh
    ./scripts/bash/run-docker-dev.sh
    

Architecture

The Polymarket Agents architecture features modular components that can be maintained and extended by individual community members.

APIs

Polymarket Agents connectors standardize data sources and order types.

Scripts

Files for managing your local environment, server set-up to run the application remotely, and cli for end-user commands.

cli.py is the primary user interface for the repo. Users can run various commands to interact with the Polymarket API, retrieve relevant news articles, query local data, send data/prompts to LLMs, and execute trades in Polymarkets.

Commands should follow this format:

python scripts/python/cli.py command_name [attribute value] [attribute value]

Example:

get-all-markets Retrieve and display a list of markets from Polymarket, sorted by volume.

python scripts/python/cli.py get-all-markets --limit <LIMIT> --sort-by <SORT_BY>

Contributing

If you would like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Submit a pull request.

Please run pre-commit hooks before making contributions. To initialize them:

pre-commit install

Related Repos

Prediction markets reading

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or inquiries, please contact liam@polymarket.com or reach out at www.greenestreet.xyz

Enjoy using the CLI application! If you encounter any issues, feel free to open an issue on the repository.

Terms of Service

Terms of Service prohibit US persons and persons from certain other jurisdictions from trading on Polymarket (via UI & API and including agents developed by persons in restricted jurisdictions), although data and information is viewable globally.

<!-- LINKS -->