### Install Required Python Dependencies Source: https://github.com/polymarket/agents/blob/main/README.md This command installs all necessary Python packages listed in the `requirements.txt` file into the active virtual environment. These dependencies are essential for the Polymarket Agents framework to function correctly. ```Bash pip install -r requirements.txt ``` -------------------------------- ### Example Polymarket Trade Order Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md An illustrative example of a valid trade order, demonstrating how numerical values and specific keywords (like BUY) are used within the defined trade format. ```Text price:0.5, size:0.1, side:BUY, ``` -------------------------------- ### Set Up Environment Variables Source: https://github.com/polymarket/agents/blob/main/README.md This command copies the example environment file to create a new `.env` file in the project root. This file is used to store sensitive information like API keys and private keys, which should be configured before running the agents. ```Bash cp .env.example .env ``` -------------------------------- ### Initialize Pre-commit Hooks for Development Source: https://github.com/polymarket/agents/blob/main/README.md This command initializes the pre-commit hooks for the Polymarket Agents project. Running this setup ensures that automated checks are performed on your code before each commit, helping to maintain code quality and consistency across the repository. ```Shell pre-commit install ``` -------------------------------- ### Clone Polymarket Agents Repository Source: https://github.com/polymarket/agents/blob/main/README.md This command clones the Polymarket Agents GitHub repository to your local machine, allowing you to access the project files. After cloning, navigate into the new directory to proceed with setup. ```Bash git clone https://github.com/{username}/polymarket-agents.git cd polymarket-agents ``` -------------------------------- ### Activate Virtual Environment on Windows Source: https://github.com/polymarket/agents/blob/main/README.md This command activates the previously created Python virtual environment on Windows systems. Activation ensures that subsequent Python commands use the packages installed within this specific environment. ```Bash .venv\Scripts\activate ``` -------------------------------- ### Calculated Polymarket Trade Order Result Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md A concrete example of a trade order generated based on a prediction, showing how a likelihood is translated into a specific price, size, and side for a market trade. ```Text price:0.3, size:0.2, side: BUY, ``` -------------------------------- ### Polymarket Agents Python Dependencies List Source: https://github.com/polymarket/agents/blob/main/requirements.txt This snippet provides the complete list of Python packages and their specific versions that the Polymarket agents project relies on. This file is typically used with `pip install -r` to set up the project's Python environment, ensuring all dependencies are met for the application to run correctly. ```Python aiohappyeyeballs==2.3.4 aiohttp==3.10.0 aiosignal==1.3.1 annotated-types==0.7.0 anyio==4.4.0 asgiref==3.8.1 asttokens==2.4.1 async-timeout==4.0.3 attrs==23.2.0 backoff==2.2.1 bcrypt==4.2.0 bitarray==2.9.2 build==1.2.1 cachetools==5.4.0 certifi==2024.7.4 cfgv==3.4.0 charset-normalizer==3.3.2 chroma-hnswlib==0.7.6 chromadb==0.5.5 ckzg==1.0.2 click==8.1.7 coloredlogs==15.0.1 cytoolz==0.12.3 dataclasses-json==0.6.7 Deprecated==1.2.14 devtools==0.12.2 distlib==0.3.8 distro==1.9.0 dnspython==2.6.1 eip712-structs==1.1.0 email_validator==2.2.0 eth-account==0.13.1 eth-hash==0.7.0 eth-keyfile==0.8.1 eth-keys==0.5.1 eth-rlp==2.1.0 eth-typing==4.4.0 eth-utils==4.1.1 eth_abi==5.1.0 exceptiongroup==1.2.2 executing==2.0.1 fastapi==0.111.0 fastapi-cli==0.0.4 filelock==3.15.4 flatbuffers==24.3.25 frozenlist==1.4.1 fsspec==2024.6.1 google-auth==2.32.0 googleapis-common-protos==1.63.2 grpcio==1.65.2 h11==0.14.0 hexbytes==1.2.1 httpcore==1.0.5 httptools==0.6.1 httpx==0.27.0 huggingface-hub==0.24.5 humanfriendly==10.0 identify==2.6.0 idna==3.7 importlib_metadata==8.0.0 importlib_resources==6.4.0 iniconfig==2.0.0 Jinja2==3.1.4 jq==1.7.0 jsonpatch==1.33 jsonpointer==3.0.0 jsonschema==4.23.0 jsonschema-specifications==2023.12.1 kubernetes==30.1.0 langchain==0.2.11 langchain-chroma==0.1.2 langchain-community==0.2.10 langchain-core==0.2.26 langchain-openai==0.1.19 langchain-text-splitters==0.2.2 langchainhub==0.1.20 langgraph==0.1.17 langsmith==0.1.94 lru-dict==1.3.0 markdown-it-py==3.0.0 MarkupSafe==2.1.5 marshmallow==3.21.3 mdurl==0.1.2 mmh3==4.1.0 monotonic==1.6 mpmath==1.3.0 multidict==6.0.5 mypy-extensions==1.0.0 newsapi-python==0.2.7 nodeenv==1.9.1 numpy==1.26.4 oauthlib==3.2.2 onnxruntime==1.18.1 openai==1.37.1 opentelemetry-api==1.26.0 opentelemetry-exporter-otlp-proto-common==1.26.0 opentelemetry-exporter-otlp-proto-grpc==1.26.0 opentelemetry-instrumentation==0.47b0 opentelemetry-instrumentation-asgi==0.47b0 opentelemetry-instrumentation-fastapi==0.47b0 opentelemetry-proto==1.26.0 opentelemetry-sdk==1.26.0 opentelemetry-semantic-conventions==0.47b0 opentelemetry-util-http==0.47b0 orjson==3.10.6 overrides==7.7.0 packaging==24.1 parsimonious==0.10.0 platformdirs==4.2.2 pluggy==1.5.0 poly_eip712_structs==0.0.1 posthog==3.5.0 pre-commit==3.8.0 protobuf==4.25.4 py_clob_client==0.17.5 py_order_utils==0.3.2 pyasn1==0.6.0 pyasn1_modules==0.4.0 pycryptodome==3.20.0 pydantic==2.8.2 pydantic_core==2.20.1 Pygments==2.18.0 PyPika==0.48.9 pyproject_hooks==1.1.0 pysha3==1.0.2 pytest==8.3.2 python-dateutil==2.9.0.post0 python-dotenv==1.0.1 python-multipart==0.0.9 pyunormalize==15.1.0 PyYAML==6.0.1 referencing==0.35.1 regex==2024.7.24 requests==2.32.3 requests-oauthlib==2.0.0 rich==13.7.1 rlp==4.0.1 rpds-py==0.19.1 rsa==4.9 scheduler==0.8.7 shellingham==1.5.4 six==1.16.0 sniffio==1.3.1 SQLAlchemy==2.0.31 starlette==0.37.2 sympy==1.13.1 tavily-python==0.3.5 tenacity==8.5.0 tiktoken==0.7.0 tokenizers==0.19.1 tomli==2.0.1 toolz==0.12.1 tqdm==4.66.4 typeguard==4.3.0 typer==0.12.3 types-requests==2.32.0.20240712 typing-inspect==0.9.0 typing_extensions==4.12.2 ujson==5.10.0 urllib3==2.2.2 uvicorn==0.30.3 uvloop==0.19.0 virtualenv==20.26.3 watchfiles==0.22.0 web3==6.11.0 websocket-client==1.8.0 websockets==12.0 wrapt==1.16.0 yarl==1.9.4 zipp==3.19.2 ``` -------------------------------- ### Polymarket Trade Order Format Template Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md Defines the required structure for submitting a trade order on Polymarket, specifying the keys for price, size, and side. This template guides users on how to format their trade predictions. ```Text price:'price_on_the_orderbook', size:'percentage_of_total_funds', side: BUY or SELL, ``` -------------------------------- ### AI Assistant Prompt: Filter Polymarket Markets Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md Similar to the event filtering prompt, this instruction guides the AI assistant to process Polymarket API data, specifically focusing on filtering markets for profitable trading opportunities. It reinforces the AI's analytical role. ```Natural Language Prompt You are an AI assistant for analyzing prediction markets. You will be provided with json output for api data from Polymarket. Polymarket is an online prediction market that lets users bet on the outcome of future events in a wide range of topics, like sports, politics, and pop culture. Get accurate real-time probabilities of the events that matter most to you. Filter these markets for the ones you will be best at trading on profitably. ``` -------------------------------- ### CLI: General Command Format Source: https://github.com/polymarket/agents/blob/main/README.md This snippet illustrates the general command format for interacting with the Polymarket Agents CLI. Commands are executed via the `cli.py` script, followed by the command name and optional attribute-value pairs. ```Bash python scripts/python/cli.py command_name [attribute value] [attribute value] ``` -------------------------------- ### Configure API Keys in .env File Source: https://github.com/polymarket/agents/blob/main/README.md These lines represent the essential environment variables that need to be set in the `.env` file. `POLYGON_WALLET_PRIVATE_KEY` is required for blockchain interactions, and `OPENAI_API_KEY` is for integrating with OpenAI's language models. ```Bash POLYGON_WALLET_PRIVATE_KEY="" OPENAI_API_KEY="" ``` -------------------------------- ### Build Docker Image for Polymarket Agents Source: https://github.com/polymarket/agents/blob/main/README.md This script builds the Docker image for the Polymarket Agents application. Docker provides a consistent and isolated environment for running the agents, simplifying deployment and dependency management. ```Bash ./scripts/bash/build-docker.sh ``` -------------------------------- ### Run Polymarket Agents CLI Source: https://github.com/polymarket/agents/blob/main/README.md This command executes the main command-line interface script for Polymarket Agents. The CLI allows users to interact with the Polymarket API, retrieve news, query data, and send prompts to LLMs. ```Python python scripts/python/cli.py ``` -------------------------------- ### Superforecaster AI Prompt: Structured Prediction Methodology Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md This comprehensive prompt defines the role of an AI as a 'Superforecaster' and outlines a systematic, five-step process for developing accurate probabilistic predictions. It includes steps like breaking down questions, gathering information, considering base rates, evaluating factors, and thinking probabilistically, along with a specified output format. ```Natural Language Prompt You are a Superforecaster tasked with correctly predicting the likelihood of events. Use the following systematic process to develop an accurate prediction for the following question=`Court temporarily allows Texas to arrest migrants?` and description=`On March 20 a 3-panel judge heard arguments on whether Texas should temporarily be permitted to enforce its immigration law which allows state officials to arrest people they suspect of entering the country illegally. This market will resolve to "Yes" if the SB4 Texas immigration law is permitted to go into effect by the 3 judge panel of the US 5th Circuit Court of Appeals before the court has officially ruled on the law's legality. Otherwise this market will resolve to "No". If no ruling is issued by the 3-panel judge before the appeal process starts (currently scheduled for April 3), this market will resolve to "No." The primary resolution source for this market will be official information from the US government, however a consensus of credible reporting will also be used.` combination. Here are the key steps to use in your analysis: 1. Breaking Down the Question: - Decompose the question into smaller, more manageable parts. - Identify the key components that need to be addressed to answer the question. 2. Gathering Information: - Seek out diverse sources of information. - Look for both quantitative data and qualitative insights. - Stay updated on relevant news and expert analyses. 3. Consider Base Rates: - Use statistical baselines or historical averages as a starting point. - Compare the current situation to similar past events to establish a benchmark probability. 4. Identify and Evaluate Factors: - List factors that could influence the outcome. - Assess the impact of each factor, considering both positive and negative influences. - Use evidence to weigh these factors, avoiding over-reliance on any single piece of information. 5. Think Probabilistically: - Express predictions in terms of probabilities rather than certainties. - Assign likelihoods to different outcomes and avoid binary thinking. - Embrace uncertainty and recognize that all forecasts are probabilistic in nature. Given these steps produce a statement on the probability of outcome=`['Yes', 'No']` occurring. Give your response in the following format: I believe Court temporarily allows Texas to arrest migrants? has a likelihood `` for outcome of ``. ``` -------------------------------- ### Activate Virtual Environment on macOS and Linux Source: https://github.com/polymarket/agents/blob/main/README.md This command activates the Python virtual environment on macOS and Linux systems. Activating the environment is crucial for running project scripts with their specific dependencies. ```Bash source .venv/bin/activate ``` -------------------------------- ### CLI: get-all-markets Command Source: https://github.com/polymarket/agents/blob/main/README.md The `get-all-markets` command retrieves and displays a list of markets from Polymarket. It supports optional parameters to limit the number of results and sort them by criteria like volume. ```Bash python scripts/python/cli.py get-all-markets --limit --sort-by Parameters: limit: The number of markets to retrieve (default: 5). sort_by: The sorting criterion, either volume (default) or another valid attribute. ``` -------------------------------- ### Execute Polymarket Trade Application Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md This snippet shows the command-line execution of the `application/trade.py` script using the Python interpreter in interactive mode. This command initiates the prediction market analysis process by the AI agent. ```Shell (.venv) $ python -i application/trade.py ``` -------------------------------- ### Create Python Virtual Environment for Polymarket Agents Source: https://github.com/polymarket/agents/blob/main/README.md This command creates a new isolated Python virtual environment named `.venv` using Python 3.9. Virtual environments help manage project dependencies without conflicts with system-wide packages. ```Bash virtualenv --python=python3.9 .venv ``` -------------------------------- ### API: Gamma.py - Polymarket Gamma API Client Source: https://github.com/polymarket/agents/blob/main/README.md Gamma.py defines the `GammaMarketClient` class, which interfaces with the Polymarket Gamma API. It provides methods to fetch and parse market and event metadata, including current, tradable, and specific market/event information. ```APIDOC Gamma.py: Class: GammaMarketClient Purpose: Interfaces with Polymarket Gamma API. Methods: - Retrieve current and tradable markets. - Retrieve defined information on specific markets and events. ``` -------------------------------- ### API: Polymarket.py - Polymarket DEX Interaction Source: https://github.com/polymarket/agents/blob/main/README.md Polymarket.py defines a `Polymarket` class for interacting with the Polymarket API to manage market/event data and execute orders on the DEX. It includes functions for API key initialization, data retrieval, trade execution, and order building/signing. ```APIDOC Polymarket.py: Class: Polymarket Purpose: Interacts with Polymarket API for data retrieval and trade execution. Methods: - API key initialization. - Market and event data retrieval. - Trade execution. Utility Functions: - Building and signing orders. Examples: Included for testing API interactions. ``` -------------------------------- ### Run Polymarket Agents Docker Container in Development Mode Source: https://github.com/polymarket/agents/blob/main/README.md This script runs the Docker container in development mode, allowing for easier debugging and iteration. It provides a containerized environment for developing and testing the Polymarket Agents. ```Bash ./scripts/bash/run-docker-dev.sh ``` -------------------------------- ### AI Assistant Prompt: General Prediction Market Analysis Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md A general prompt defining the AI assistant's core role in analyzing prediction markets. It highlights the AI's capability to process JSON API data from Polymarket to provide accurate, real-time probabilities for various events. ```Natural Language Prompt You are an AI assistant for analyzing prediction markets. You will be provided with json output for api data from Polymarket. Polymarket is an online prediction market that lets users bet on the outcome of future events in a wide range of topics, like sports, politics, and pop culture. Get accurate real-time probabilities of the events that matter most to you. ``` -------------------------------- ### API: Chroma.py - Vector Database Integration Source: https://github.com/polymarket/agents/blob/main/README.md Chroma.py defines the integration with Chroma DB, a vector database used for vectorizing news sources and other API data. It allows developers to incorporate their own vector database implementations for RAG capabilities. ```APIDOC Chroma.py: Purpose: Integrates with Chroma DB for vectorizing news and API data. Extensibility: Supports custom vector database implementations. ``` -------------------------------- ### Run Polymarket Agents Autonomous Trading Application Source: https://github.com/polymarket/agents/blob/main/README.md This command directly runs the core trading application script, enabling autonomous trade execution on Polymarket. It's an alternative to using the CLI for direct trading operations. ```Python python agents/application/trade.py ``` -------------------------------- ### Set PYTHONPATH for Local Execution Source: https://github.com/polymarket/agents/blob/main/README.md This command sets the `PYTHONPATH` environment variable to the current directory. This is necessary when running the application outside of a Docker container to ensure Python can locate all modules correctly. ```Bash export PYTHONPATH="." ``` -------------------------------- ### API: Objects.py - Pydantic Data Models Source: https://github.com/polymarket/agents/blob/main/README.md Objects.py contains Pydantic data models that define structured representations for trades, markets, events, and related entities within the Polymarket Agents framework. These models ensure data consistency and validation. ```APIDOC Objects.py: Purpose: Defines Pydantic data models for core entities. Models: Representations for trades, markets, events, and related entities. ``` -------------------------------- ### Polymarket Market API Endpoints Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md A list of specific Polymarket API endpoints for accessing individual market data. These URLs are utilized by the AI agent to retrieve detailed information about various prediction markets for analysis. ```APIDOC https://gamma-api.polymarket.com/markets/500715 https://gamma-api.polymarket.com/markets/500716 https://gamma-api.polymarket.com/markets/500717 https://gamma-api.polymarket.com/markets/500344 https://gamma-api.polymarket.com/markets/500924 https://gamma-api.polymarket.com/markets/500925 ``` -------------------------------- ### AI Assistant Prompt: Filter Polymarket Events Source: https://github.com/polymarket/agents/blob/main/docs/EXAMPLE.md This prompt instructs an AI assistant to act as an analyst for prediction markets. Its primary task is to filter JSON API data from Polymarket for events that are most suitable for profitable trading, defining the AI's role and initial task. ```Natural Language Prompt You are an AI assistant for analyzing prediction markets. You will be provided with json output for api data from Polymarket. Polymarket is an online prediction market that lets users bet on the outcome of future events in a wide range of topics, like sports, politics, and pop culture. Get accurate real-time probabilities of the events that matter most to you. Filter these events for the ones you will be best at trading on profitably. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.