### Install Dependencies Source: https://rekko.ai/docs/guides/build-trading-bot-python Commands to install the required httpx library for API communication. ```bash pip install httpx ``` ```bash uv add httpx ``` -------------------------------- ### Installation Source: https://rekko.ai/docs/integrations/openclaw/python-client Instructions for installing the required packages via pip. ```APIDOC ## Installation ### Description Install the necessary dependencies to use the Rekko AI client. ### Command ```bash pip install httpx # For x402 autopay (optional) pip install "x402[fastapi]" eth-account ``` ``` -------------------------------- ### Claude Code Setup (Plugin) Source: https://rekko.ai/llms-full.txt Install the Rekko plugin for Claude. This is an alternative setup method for Claude. ```bash claude plugin install rekko ``` -------------------------------- ### Install RekkoClient dependencies Source: https://rekko.ai/docs/integrations/openclaw/python-client Install the required HTTP client and optional x402 payment libraries. ```bash pip install httpx # For x402 autopay (optional) pip install "x402[fastapi]" eth-account ``` -------------------------------- ### Python SSE Streaming Example Source: https://rekko.ai/docs/guides/prediction-market-arbitrage This snippet demonstrates how to subscribe to the price shift stream using httpx for real-time updates. Ensure you have the httpx library installed. ```python import httpx with httpx.stream("GET", "https://api.rekko.ai/v1/stream", params={"events": "price_shift"}, headers={"Authorization": "Bearer YOUR_API_KEY"}) as stream: for chunk in stream.iter_lines(): print(chunk) ``` -------------------------------- ### RekkoClient Installation Source: https://rekko.ai/docs/integrations/openclaw/python-client Instructions for installing the RekkoClient Python library, including optional dependencies for x402 autopay. ```APIDOC ## Installation pip install httpx # For x402 autopay (optional) pip install "x402[fastapi]" eth-account ``` -------------------------------- ### Get positions (CLOB API) Source: https://rekko.ai/docs/guides/polymarket-api-guide Example of setting up headers for a request to the CLOB API. ```python headers = ``` -------------------------------- ### Install py-clob-client SDK Source: https://rekko.ai/docs/guides/polymarket-api-guide Install the official Python SDK for interacting with the Polymarket CLOB API using pip. ```bash pip install py-clob-client ``` -------------------------------- ### Kalshi API Request and Authentication Source: https://rekko.ai/docs/guides/kalshi-api-guide Examples of setting up authentication headers and performing a GET request to list open markets. ```python "KALSHI-ACCESS-SIGNATURE": base64.b64encode(signature).decode(), "Content-Type": "application/json", } # Example: list open markets path = "/trade-api/v2/markets" resp = httpx.get( f"{BASE_URL}{path}", headers=kalshi_auth_headers("GET", path), ``` -------------------------------- ### Python Example for Kalshi API Signing Source: https://rekko.ai/docs/guides/kalshi-api-guide This Python code demonstrates how to generate the necessary headers for Kalshi API requests, including the signature. Ensure you have the required libraries installed. ```python import time import base64 import httpx from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.backends import default_backend # Load your private key with open("kalshi_private_key.pem", "rb") as key_file: private_key = serialization.load_pem_private_key( key_file.read(), password=None, backend=default_backend() ) def sign_message(message): signature = private_key.sign( message.encode("utf-8"), padding.PSS( mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.MAX_LENGTH, ), hashes.SHA256(), ) return base64.b64encode(signature).decode("utf-8") def get_auth_headers(api_key_id, method, path): timestamp = int(time.time() * 1000) message = f"{timestamp}{method}{path}" signature = sign_message(message) return { "KALSHI-ACCESS-KEY": api_key_id, "KALSHI-ACCESS-TIMESTAMP": str(timestamp), "KALSHI-ACCESS-SIGNATURE": signature, } # Example usage: api_key_id = "YOUR_API_KEY_ID" # Replace with your API Key ID from Step 2 method = "GET" # Or "POST", "DELETE", etc. path = "/v2/markets" headers = get_auth_headers(api_key_id, method, path) # You can now use these headers with httpx or any other HTTP client # For example: # response = httpx.get(f"https://api.kalshi.com{path}", headers=headers) # print(response.json()) print("Generated Headers:") for key, value in headers.items(): print(f" {key}: {value}") ``` -------------------------------- ### Fetch Market Data from Kalshi API Source: https://rekko.ai/docs/guides/prediction-market-api-comparison This example demonstrates how to make a GET request to the Kalshi trading API to retrieve market data. It includes setting query parameters like 'limit' and requires an HTTP client library such as httpx. ```python kalshi_markets = httpx.get( "https://trading-api.kalshi.com/trade-api/v2/markets", params={ "limit": } ) ``` -------------------------------- ### Initialize and Use KalshiClient Source: https://rekko.ai/docs/guides/kalshi-api-guide Demonstrates how to instantiate the client with credentials and iterate through market listings. ```python client = KalshiClient("YOUR_KALSHI_API_KEY_ID", "kalshi_private_key.pem") for m in client.list_markets(limit=5): print(f"{m['ticker']}") ``` -------------------------------- ### Get Order Book (CLOB API) - Python Source: https://rekko.ai/docs/guides/polymarket-api-guide Python example for fetching the order book. Ensure you have the httpx library installed and your authentication headers correctly set. ```python import httpx # See authentication section for $HEADERS response = httpx.get( "https://clob.polymarket.com/book?token_id=YOUR_TOKEN_ID", headers={ "POLY-API-KEY": "$POLYMARKET_API_KEY", "POLY-TIMESTAMP": "$TIMESTAMP", "POLY-SIGNATURE": "$SIGNATURE", }, ) print(response.json()) ``` -------------------------------- ### Fetch Open Markets from Kalshi Source: https://rekko.ai/docs/guides/kalshi-api-guide This Python code snippet demonstrates how to fetch open markets from the Kalshi API. It's a basic example for getting started with market data. ```python from kalshi import Kalshi client = Kalshi() markets = client.get_markets() print(markets) ``` -------------------------------- ### Initialize Kalshi Client Source: https://rekko.ai/docs/guides/kalshi-api-guide Example of initializing the Kalshi client with your API credentials. Replace placeholders with your actual API key ID and private key file path. ```python client = KalshiClient("YOUR_KALSHI_API_KEY_ID", "kalshi_private_key.pem") ``` -------------------------------- ### Sign Up a Customer with cURL Source: https://rekko.ai/docs/guides/prediction-market-api-comparison Use this cURL command to sign up a new customer. Ensure you replace 'you@example.com' and 'Your Name' with actual values. ```bash curl -X POST https://api.rekko.ai/v1/customers/signup \ -H "Content-Type: application/json" \ -d '{"email": "you@example.com", "name": "Your Name"}' ``` -------------------------------- ### Python HTTP Client Setup Source: https://rekko.ai/docs/guides/prediction-market-api-comparison Shows how to initialize an httpx client with a base URL and headers, including authorization. This is essential for making authenticated API calls. ```python client = httpx.Client( base_url="https://api.rekko.ai/v1", headers={ "Authori ``` -------------------------------- ### HTTP GET Request with Headers Source: https://rekko.ai/docs/guides/kalshi-api-guide Example of making an HTTP GET request using self.http.get. This snippet demonstrates how to specify the path and headers for the request. ```python sName: \ ``` -------------------------------- ### Python HTTP GET Request with Headers Source: https://rekko.ai/docs/guides/polymarket-api-guide Demonstrates making a GET request to an API endpoint and passing custom headers. Ensure the 'httpx' library is installed. ```python resp = httpx.get("https://clob.polymarket.com/positions", headers=headers) ``` -------------------------------- ### JavaScript Fetch API GET Request Source: https://rekko.ai/docs/guides/polymarket-api-guide Demonstrates a basic GET request using the JavaScript fetch API. This example is a placeholder and requires further implementation for handling the response. ```javascript const resp = await fetch("https://gamma-api.polymarket.com/markets?limit=5&active=true"); ``` -------------------------------- ### Initialize Client and Fetch Arbitrage Opportunities Source: https://rekko.ai/docs/guides/prediction-market-api-comparison This snippet demonstrates how to configure an httpx client with a base URL and authorization header, then retrieve and iterate over arbitrage opportunities. ```python client = httpx.Client( base_url="https://api.rekko.ai/v1", headers={"Authorization": "Bearer YOUR_API_KEY"} ) arb = client.get("/arbitrage").json() for opp in arb["opportunities"]: print(f"{op ``` -------------------------------- ### Environment and Configuration Setup Source: https://rekko.ai/docs/guides/build-trading-bot-python Initializes required environment variables and trading constants for the Rekko AI platform. ```python API_KEY print("Set REKKO_API_KEY environment variable first.") print("Sign up free at https://rekko.ai/dashboard") sys.exit(1) BANKROLL = 10_000 # Starting bankroll in dollars MIN_SCORE = 50 # Minimum screening score to analyze MIN_EDGE = 0.05 # Minimum edge (5%) to trade PLATFORM = "kalshi" # "kalshi" or "polymarket" ``` -------------------------------- ### Get Single Market (Python) Source: https://rekko.ai/docs/guides/kalshi-api-guide Example code snippet for fetching a single market's data using the Kalshi API. This requires authentication headers similar to the 'Fetch Open Markets' example. ```python ... ``` -------------------------------- ### Initialize RekkoClient Source: https://rekko.ai/docs/integrations/openclaw/python-client Configure the client using environment variables, explicit API keys, or an Ethereum signer for x402 micropayments. ```python from rekko_tools import RekkoClient # API key auth (reads REKKO_API_KEY from env) client = RekkoClient() # Explicit API key client = RekkoClient(api_key="rk_free_...") # x402 autopay with a signer from eth_account import Account signer = Account.from_key("0x...") client = RekkoClient(signer=signer) # x402 autopay (reads X402_PRIVATE_KEY from env) client = RekkoClient() # auto-detects if X402_PRIVATE_KEY is set ``` -------------------------------- ### Make GET Request to Kalshi API Source: https://rekko.ai/docs/guides/prediction-market-api-comparison Use the `httpx` library to make a GET request to the Kalshi trading API. This example demonstrates setting the API endpoint, request parameters, and authentication headers. ```python resp = httpx.get("https://trading-api.kalshi.com", params={ "limit": 5 }, headers={ "KALSHI-ACCESS-KEY": "your-api-key-id" } ) ``` -------------------------------- ### Signing API Requests Source: https://rekko.ai/docs/guides/polymarket-api-guide Example of using the signRequest helper to generate headers for an authenticated GET request. ```javascript // Using the signRequest helper from the authentication section const headers = signRequest("GET") ``` -------------------------------- ### Fetch Data from Kalshi API Source: https://rekko.ai/docs/guides/kalshi-api-guide Example of performing an authenticated GET request and parsing the JSON response. ```javascript headers: kalshiAuthHeaders("GET", path), }); const data = await resp.json(); console.log(data); ``` -------------------------------- ### RekkoClient Constructor Source: https://rekko.ai/docs/integrations/openclaw/python-client Examples of how to instantiate the RekkoClient, demonstrating API key authentication and x402 autopay configuration. The client can be used as an async context manager. ```APIDOC ## Constructor from rekko_tools import RekkoClient # API key auth (reads REKKO_API_KEY from env) client = RekkoClient() # Explicit API key client = RekkoClient(api_key="rk_free_...") # x402 autopay with a signer from eth_account import Account signer = Account.from_key("0x...") client = RekkoClient(signer=signer) # x402 autopay (reads X402_PRIVATE_KEY from env) client = RekkoClient() # auto-detects if X402_PRIVATE_KEY is set Use as an async context manager: async with RekkoClient() as client: markets = await client.list_markets() ``` -------------------------------- ### Make HTTP GET Request with Headers and Params Source: https://rekko.ai/docs/guides/polymarket-api-guide This snippet demonstrates how to make an HTTP GET request using httpx.get, including custom headers and parameters. Ensure you have the httpx library installed and any necessary authentication tokens configured in the headers. ```python book = httpx.get("https://clob.polymarket.com/book", headers=headers, params=params).json() ``` -------------------------------- ### POST /v1/customers/signup Source: https://rekko.ai/llms-full.txt Creates a free-tier account and returns a one-time API key. ```APIDOC ## POST /v1/customers/signup ### Description Create a free-tier account. Returns a one-time API key. ### Method POST ### Endpoint /v1/customers/signup ### Request Body - **email** (string) - Required - **name** (string) - Required ### Response #### Success Response (200) - **customer_id** (string) - Unique customer ID - **email** (string) - Customer email - **plan** (string) - Account plan - **api_key** (string) - One-time API key ``` -------------------------------- ### API Request and Order Placement Source: https://rekko.ai/docs/guides/kalshi-api-guide Examples of performing authenticated GET requests to the trade API and defining a function for placing orders. ```python path = "/trade-api/v2/markets" return self.http.get(path, headers=self._sign("GET", path)) params = {"status": status, "limit": limit}.json()["markets"] ``` ```python def place_order(self, ticker: str, side, ``` -------------------------------- ### Initialize Rekko AI Client Source: https://rekko.ai/docs/guides/prediction-market-arbitrage Demonstrates how to set up an httpx client with the base URL and authorization headers to interact with the Rekko AI API. ```python import httpx client = httpx.Client(base_url="https://api.rekko.ai/v1", headers={"Authorization": "Bearer YOUR_API_KEY"}) arbs = client.get("/arbitrage", params= ``` -------------------------------- ### Get a Single Market Source: https://rekko.ai/docs/guides/kalshi-api-guide This example shows how to fetch data for a specific market using its ID. Replace 'MARKET_ID' with the actual market identifier. ```text curl \"https://trading-api.kalshi.com/trade-api/v2/markets/MARKET_ID\" \ -H \"KALSHI-ACCESS-KEY: YOUR_KALSHI_API_KEY_ID\" \ -H \"KALSHI-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \ -H \"KALSHI-ACCESS-SIGNATURE: ${SIGNATURE}\" ``` -------------------------------- ### Initialize HTTP Client and Sign Method Source: https://rekko.ai/docs/guides/kalshi-api-guide Configures an httpx.Client instance and defines a signature method for API requests. ```python _components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \")\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#0550AE\",\n \"--shiki-dark\": \"#569CD6\"\n },\n children: \" self\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \".http \"\n }), _jsx(_components.span, {\n style: {\n color: \"#CF222E\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"=\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \" httpx.Client(\"\n }), _jsx(_components.span, {\n style: {\n color: \"#953800\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \"base_url\"\n }), _jsx(_components.span, {\n style: {\n color: \"#CF222E\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"=\"\n }), _jsx(_components.span, {\n style: {\n color: \"#0550AE\",\n \"--shiki-dark\": \"#569CD6\"\n },\n children: \"self\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \".\"\n }), _jsx(_components.span, {\n style: {\n color: \"#0550AE\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"BASE_URL\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \", \"\n }), _jsx(_components.span, {\n style: {\n color: \"#953800\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \"timeout\"\n }), _jsx(_components.span, {\n style: {\n color: \"#CF222E\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"=\"\n }), _jsx(_components.span, {\n style: {\n color: \"#0550AE\",\n \"--shiki-dark\": \"#B5CEA8\"\n },\n children: \"30\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \")\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"line\"\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#CF222E\",\n \"--shiki-dark\": \"#569CD6\"\n },\n children: \" def\"\n }), _jsx(_components.span, {\n style: {\n color: \"#8250DF\",\n \"--shiki-dark\": \"#DCDCAA\"\n },\n children: \" _sign\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \ ``` -------------------------------- ### List Webhooks with cURL Source: https://rekko.ai/docs/guides/webhooks-streaming Use this cURL command to list webhooks. This is a basic example and may require authentication headers depending on your setup. ```shellscript # List curl \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ "https://api.example.com/v1/webhooks" ``` -------------------------------- ### Initialize Kalshi API Client Source: https://rekko.ai/docs/guides/kalshi-api-guide This snippet shows the initialization of the Kalshi API client, setting up API key ID and private key path. Ensure the private key is loaded securely. ```python def __init__(self, api_key_id: str, private_key_path: str): self.api_key_id = api_key_id with open(private_key_path, "rb") as f: self.private_key = serialization.load_pem_private_key( f.read(), password=None ) ``` -------------------------------- ### Rekko Signals API Source: https://rekko.ai/docs/guides/kelly-criterion-position-sizing This section details how to use the Rekko signals API to get automated sizing recommendations. It includes cURL and JavaScript examples. ```APIDOC ## POST /v1/signals ### Description This endpoint is used to retrieve automated sizing recommendations. It can be used with the `wait=true` query parameter to wait for the results. ### Method POST ### Endpoint `https://api.rekko.ai/v1/signals?wait=true` ### Parameters #### Query Parameters - **wait** (boolean) - Optional - If true, the API will wait for the results before returning. #### Request Body - **market** (string) - Required - The market identifier for which to get signals. ### Request Example ```json { "market": "kalshi/KXFED-26MAR19" } ``` ### Response #### Success Response (200) - **recommendation** (string) - The recommended action (e.g., BUY_YES). - **edge** (float) - The calculated edge. - **full_kelly** (float) - The full Kelly criterion value. - **adjusted_kelly** (float) - The adjusted Kelly criterion value. - **size_usd** (float) - The recommended position size in USD. #### Response Example ```json { "recommendation": "BUY_YES", "edge": 0.12, "full_kelly": 0.3, "adjusted_kelly": 0.15, "size_usd": 1500.0 } ``` ``` -------------------------------- ### Initialize Rekko Client Source: https://rekko.ai/docs/guides/build-trading-bot-python Basic setup for the authenticated client using the Rekko API key. ```python import httpx API_KEY = "YOUR_API_KEY" # Replace with your key from https://rekko.ai/dashboard ``` -------------------------------- ### Cross-Platform Integration Setup Source: https://rekko.ai/docs/guides/prediction-market-api-comparison Initial imports for a Python-based cross-platform prediction market integration system. ```python import httpx import time import base64 from cryptography.hazmat.primitives ``` -------------------------------- ### Fetch Polymarket Markets Source: https://rekko.ai/docs/guides/polymarket-api-guide Retrieve market data from Polymarket using the Rekko API. This example shows how to specify parameters like 'source' and 'limit' for the GET request. ```python # 1. Browse Polymarket markets (normalized format, no HMAC needed) markets = rekko.get( "/markets", params={ "source": "polymarket", "limit": ``` -------------------------------- ### Initialize API Authentication Source: https://rekko.ai/docs/guides/kalshi-api-guide This snippet demonstrates how to assign an API key and load a private key from a file path for secure authentication. ```python def __init__(self, api_key_id: str, private_key_path: str): self.api_key_id = api_key_id with open(private_key_path, "rb") as f: self.private_key = serialization.load_pem_private_key(f.read(), password=None) self.http = ``` -------------------------------- ### Register Webhook for Arbitrage Events Source: https://rekko.ai/docs/guides/prediction-market-arbitrage Register a webhook to receive notifications when new arbitrage opportunities become available. This example demonstrates the basic setup for a Python webhook. ```python # Register a webhook for arbitrage events webhook = ``` -------------------------------- ### Initialize HTTPX Client Source: https://rekko.ai/docs/guides/bayesian-analysis-prediction-markets Example of initializing an httpx client for the Rekko AI API. ```python import httpx client = httpx.Client(base_url="https://api.rekko.ai/v1") ``` -------------------------------- ### Initialize Rekko API Client in Python Source: https://rekko.ai/docs/guides/polymarket-api-guide Basic setup for importing necessary libraries to interact with the Rekko API. ```python import time import httpx ``` -------------------------------- ### Python HTTP Client Setup for Rekko API Source: https://rekko.ai/docs/guides/bayesian-analysis-prediction-markets Sets up an HTTP client using httpx to interact with the Rekko API. Ensure you have the httpx library installed. The base URL is configured for the Rekko API. ```python import httpx client = httpx.Client( base_url="https://api.rekko.ai/v1", headers={ "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer YOUR_API_KEY" } ) ``` -------------------------------- ### Python Request for Causal Decomposition Source: https://rekko.ai/docs/guides/bayesian-analysis-prediction-markets Example of making a request to the Rekko API to get causal decomposition data. The `?expand=causal` query parameter is used to retrieve the full factor breakdown. Replace `YOUR_API_KEY` with your actual API key. ```python response = client.get("/your/endpoint?expand=causal") print(response.json()) ``` -------------------------------- ### Initialize Rekko Client in Python Source: https://rekko.ai/docs/guides/polymarket-api-guide Setup a persistent HTTP client using the httpx library to communicate with the Rekko API. ```python import time import httpx rekko = httpx.Client( base_url="https://api.rekko.ai/v1", headers={ ``` -------------------------------- ### Main Event Loop Implementation Source: https://rekko.ai/docs/guides/webhooks-streaming This snippet demonstrates the setup of an event loop using httpx.stream to monitor price shift events. ```python # Main event loop print("Listening for price shifts...") with httpx.stream( "GET", f"{client.base_url}/stream", params={"events": "price_shift"}, headers=client.headers, timeout= ``` -------------------------------- ### Python HTTP Client Setup for Rekko API Source: https://rekko.ai/docs/guides/prediction-market-arbitrage Sets up an HTTP client using httpx to interact with the Rekko API. Ensure you have the httpx library installed. This client is configured with the base URL for the Rekko API and requires authentication headers to be provided separately. ```python import httpx client = httpx.Client( base_url="https://api.rekko.ai/v1", headers={"Authorization": "Bearer YOUR_API_KEY"} ) ``` -------------------------------- ### Initialize RekkoClient with Signer Source: https://rekko.ai/docs/integrations/openclaw/python-client Create a signer from a private key and use it to initialize RekkoClient for authenticated requests. The private key should be securely managed. ```python # x402 autopay with a signer from eth_account import Account signer = Account.from_key("0x...") client = RekkoClient(signer=signer) ``` -------------------------------- ### Customer Signup Request Source: https://rekko.ai/docs/guides/prediction-market-api-comparison Example of performing a POST request to the signup endpoint. ```javascript // Sign up const signup = await fetch("https://api.rekko.ai/v1/customers/signup", { method: "POST", headers: { ``` -------------------------------- ### List Webhooks with Python Source: https://rekko.ai/docs/guides/webhooks-streaming Use this Python snippet to list all configured webhooks. Ensure you have a client object initialized. ```python # List your webhooks hooks = client.get("/webhooks").json() ``` -------------------------------- ### Get Consensus Source: https://rekko.ai/docs/guides/webhooks-streaming Get consensus probability from aggregated agent trades. ```APIDOC ## GET /v1/markets/{platform}/{market_id}/consensus ### Description Get consensus probability from aggregated agent trades. ### Method GET ### Endpoint /v1/markets/{platform}/{market_id}/consensus ### Parameters #### Path Parameters - **platform** (string) - Required - The platform of the market. - **market_id** (string) - Required - The unique identifier for the market. ### Response #### Success Response (200) - **consensus_probability** (number) - The aggregated consensus probability for the market. #### Response Example { "consensus_probability": 0.72 } ``` -------------------------------- ### Configure and Register Webhook Source: https://rekko.ai/docs/guides/webhooks-streaming Example of using the client to post a new webhook configuration with specific events and a secret. ```python client.post("/webhooks", json={ "url": "https://your-server.com/webhook", "events": ["price_shift", "whale_alert"], "secret": "your_hmac_secret_here", }).json() print(f"Webhook ID: {webhook['webhook_id']}") ``` -------------------------------- ### Get Market Source: https://rekko.ai/docs/guides/predictit-alternatives Get a single market listing by platform and ID. ```APIDOC ## GET /v1/markets/{platform}/{market_id} ### Description Get a single market listing by platform and ID. ### Method GET ### Endpoint /v1/markets/{platform}/{market_id} ### Parameters #### Path Parameters - **platform** (string) - Required - The platform where the market is listed. - **market_id** (string) - Required - The unique identifier for the market on the platform. ``` -------------------------------- ### Initialize Rekko AI Client Source: https://rekko.ai/docs/guides/build-trading-bot-python Set up the Rekko AI client with your API key and base URL. Ensure your API key is correctly formatted. ```python client = httpx.Client( base_url="https://api.rekko.ai/v1", headers={ "Authorization": f"Bearer \"YOUR_API_KEY\"" # Replace with your key from https://rekko.ai/dashboard }, timeout=120.0 # Analysis can take 30-90 seconds ) ``` -------------------------------- ### cURL Example Source: https://rekko.ai/docs/guides/prediction-market-arbitrage Example of how to call the Arbitrage API using cURL. ```APIDOC ## cURL Request Example ### Description This example demonstrates how to make a request to the Arbitrage API using cURL, including authentication. ### Method GET ### Endpoint https://api.rekko.ai/v1/arbitrage?min_spread=0.02 ### Headers - **Authorization**: Bearer YOUR_API_KEY ### Request Example ```bash curl "https://api.rekko.ai/v1/arbitrage?min_spread=0.02" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ``` -------------------------------- ### RekkoClient Initialization and Usage Source: https://rekko.ai/docs/integrations/openclaw/python-client Demonstrates the initialization of the RekkoClient, which is an async HTTP client wrapping Rekko API endpoints. It supports API key authentication and x402 USDC micropayments on Base L2. No manual header parsing is needed. ```javascript function MDXContent(props = {}) { const {wrapper: MDXLayout} = { ..._provideComponents(), ...props.components }; return MDXLayout ? _jsx(MDXLayout, { ...props, children: _jsx(_createMdxContent, { ...props }) }) : _createMdxContent(props); } return { default: MDXContent }; function _missingMdxReference(id, component) { throw new Error("Expected " + (component ? "component" : "object") + " `" + id + "` to be defined: you likely forgot to import, pass, or provide it."); } ``` -------------------------------- ### Get Consensus API Source: https://rekko.ai/docs/integrations/openclaw/python-client Get consensus probability from aggregated agent trades. ```APIDOC ## GET /v1/markets/{platform}/{market_id}/consensus ### Description Get consensus probability from aggregated agent trades. ### Method GET ### Endpoint /v1/markets/{platform}/{market_id}/consensus ### Parameters #### Path Parameters - **platform** (string) - Required - The platform identifier. - **market_id** (string) - Required - The market identifier. ### Response #### Success Response (200) - **consensus_data** (object) - Consensus probability and related information. #### Response Example { "consensus_data": { "symbol": "BTC/USD", "consensus_probability": 0.70, "agent_trades_count": 150 } } ``` -------------------------------- ### cURL Request Example Source: https://rekko.ai/docs/guides/prediction-market-arbitrage Example of how to call the Arbitrage API using cURL. ```APIDOC ## cURL Example ### Description This example demonstrates how to make a request to the Arbitrage API using cURL. ### Method GET ### Endpoint https://api.rekko.ai/v1/arbitrage?min_spread=0.02 ### Headers - Authorization: Bearer YOUR_API_KEY ### Request Example ```bash curl "https://api.rekko.ai/v1/arbitrage?min_spread=0.02" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ``` -------------------------------- ### Python Example for Placing an Order Source: https://rekko.ai/docs/guides/kalshi-api-guide This Python code demonstrates how to construct and send an order to the trade API. Ensure the 'path' and 'order' variables are correctly defined before execution. ```python path = "/trade-api/v2/portfolio/orders" order = {"ticker": "KXFED-26MAR19", "action": "buy", "side": "yes", "type": " ``` ```python "limit", "price": 100, "quantity": 100, "time_in_force": "GTC"} ``` -------------------------------- ### Configure API Parameters and Print Results Source: https://rekko.ai/docs/guides/prediction-market-api-comparison Demonstrates setting expansion parameters for the API and printing market price and probability analysis from the response. ```python params = {"expand": "causal,scenarios"} ).json() print(f"Market price: {top_market['yes_price']}") print(f"Estimated probability: {analysis['probability']}") print( ``` -------------------------------- ### Market Identifier Example Source: https://rekko.ai/docs/guides/prediction-market-api-comparison Example of a human-readable event slug used by Robinhood. ```text fed-rate-cut-march-2026 ``` -------------------------------- ### Initialize Rekko API Client Source: https://rekko.ai/docs/guides/polymarket-api-guide Set up an httpx.Client instance for the Rekko API. Ensure you replace 'YOUR_REKKO_API_KEY' with your actual API key. This client is used for all subsequent API requests. ```python import httpx rekko = httpx.Client( base_url="https://api.rekko.ai/v1", headers={ "Authorization": "Bearer YOUR_REKKO_API_KEY", }, ) ``` -------------------------------- ### GET /v1/markets/{platform}/{market_id} Source: https://rekko.ai/docs/guides/bayesian-analysis-prediction-markets Get a single market listing by platform and ID. ```APIDOC ## GET /v1/markets/{platform}/{market_id} ### Description Get a single market listing by platform and ID. ### Method GET ### Endpoint /v1/markets/{platform}/{market_id} ### Parameters #### Path Parameters - **platform** (string) - Required - The platform name - **market_id** (string) - Required - The unique market identifier ``` -------------------------------- ### Deep Analysis Output Example Source: https://rekko.ai/docs/guides/mcp-trading-workflow Example output indicating the completion of a market analysis. ```text Analysis complete for KXFED-26APR30: ```