@dawnai/cli
v1.2.5
Published
User-facing Dawn CLI
Readme
@dawnai/cli
The Dawn CLI — build and run autonomous prediction market trading strategies from your terminal.
Requirements
- Node.js 20+
- Python 3.12+ (managed automatically via the bundled SDK)
- OpenWallet (ows) for live trading
Install
npm install -g @dawnai/cliVerify:
dawn --versionQuick Start
Option 1 — Run a template strategy (recommended)
No wallet needed. Runs with simulated funds in paper mode.
# 1. Authenticate
dawn auth login
# 2. Browse available templates
dawn template list
# 3. Launch a template in paper mode
dawn template launch <name> --name "my-run"
# 4. Monitor
dawn strategy logs <run_id> --tail 50
# 5. Stop
dawn strategy stop <run_id>Option 2 — Build a strategy from scratch
# 1. Authenticate
dawn auth login
# 2. Explore SDK tools and docs
dawn tool docs polymarket
dawn tool run polymarket_event_search --input '{"query": "NBA finals", "limit": 5}'
# 3. Write a strategy and launch it
dawn strategy launch strategy.py --name "my-strategy" # paper mode
dawn strategy launch strategy.py --name "my-strategy" --live # live mode
# 4. Monitor
dawn strategy logs <run_id> --tail 50
# 5. Stop
dawn strategy stop <run_id>Commands
Auth
dawn auth login # authenticate via browser (Google OAuth)
dawn auth status # check current auth state
dawn auth logout # clear stored credentials
dawn auth url [<url>] # view or set the API base URLWallet
Wallets are managed by OpenWallet (ows). Dawn stores your active wallet selection locally.
dawn wallet list # list all ows wallets
dawn wallet use <address-or-name> # select active wallet
dawn wallet current # show active wallet + Polygon balancesTemplates
Pre-built strategies ready to run. Downloaded to ~/.dawn-cli/templates/<name>.py — fully editable after download.
dawn template list # browse available templates
dawn template launch <name> --name <run-name> # download and run in paper mode
dawn template launch <name> --name <run-name> --live # run live (requires funded wallet)Modifying a template:
dawn template launch <name> --name <run-name> # 1. download + launch
dawn strategy stop <run_id> # 2. stop
# edit ~/.dawn-cli/templates/<name>.py # 3. change BUDGET_USD, logic, etc.
dawn strategy launch ~/.dawn-cli/templates/<name>.py --name <run-name> # 4. relaunchStrategy
Strategies are plain Python files with a time loop. They run as local background processes.
dawn strategy launch <strategy.py> --name <name> [--live]
dawn strategy list
dawn strategy logs <run_id> [--tail N]
dawn strategy stop <run_id>
dawn strategy positions <run_id>- Without
--live, strategies run in paper mode — trades are simulated, no real funds used. --liverequires a wallet selected viadawn wallet use.- Each run gets a unique
run_id. Multiple strategies can run simultaneously. - Budget is set in the strategy code via
BUDGET_USD— the strategy enforces it, there is no CLI flag.
Portfolio
View and manage live on-chain positions.
dawn portfolio current # show active wallet balances + positions
dawn portfolio <wallet-address> # show positions for a specific address
dawn portfolio sell <token_id> [--amount <n>] # sell a position (prompts for confirmation)
dawn portfolio redeem <token_id> # redeem a resolved winning positionTools
Browse and call Dawn SDK tools directly without writing a strategy.
dawn tool list # list all available tools
dawn tool run <tool_name> --input <json> # call a tool with JSON input
dawn tool docs # list available doc modules
dawn tool docs <module> # print full reference for a moduleAvailable doc modules: overview, directive, polymarket, portfolio, crypto, social, sports, web, utils
Skills
Install Dawn skills for AI assistants (Claude Code, Gemini CLI, Codex CLI).
dawn skill list
dawn skill install [--force] [--dir <path>]Update
dawn update # install the latest version from npm + refresh SDK and skillsWriting Strategies
Strategies are plain Python files. The recommended pattern is a simple time loop:
import time
from decimal import Decimal
from dawnai.strategy.tools import polymarket_buy_token, read_portfolio, get_state, set_state
BUDGET_USD = Decimal("100") # hard limit — strategy never spends more than this
ITERATIONS = 12 # run for ~1 hour
INTERVAL_SECONDS = 300 # 5 minutes between iterations
def run_once():
# Budget guard — always check before buying
total_invested = Decimal(str(get_state("total_invested") or "0"))
remaining = BUDGET_USD - total_invested
if remaining < Decimal("1"):
print(f"Budget exhausted (${total_invested}/${BUDGET_USD}). Holding.")
return
# your strategy logic here
def main():
print(f"Strategy starting | Budget: ${BUDGET_USD} (hard limit)")
for i in range(ITERATIONS):
print(f"[{i+1}/{ITERATIONS}] Running...")
try:
run_once()
except Exception as e:
print(f"Error: {e}")
if i < ITERATIONS - 1:
time.sleep(INTERVAL_SECONDS)
if __name__ == "__main__":
main()Run dawn tool docs directive for the full strategy coding guidelines, and dawn tool docs polymarket for the complete Polymarket tool reference.
Live Trading
Live trading uses OpenWallet (ows) for local key management — your private keys never leave your machine.
- Install ows and create a wallet:
ows wallet create --name main - Fund the wallet on Polygon:
- USDC.e — the stablecoin used for trades. ⚠️ This is not the same as regular USDC. When funding, select the Polygon network and specifically USDC.e. Sending regular USDC will not work for trading.
- POL — small amount needed for gas fees (~$1–2 is enough)
- Select the wallet in Dawn:
dawn wallet use main dawn wallet current # confirm balances - Launch with
--live:dawn strategy launch strategy.py --name "my-strategy" --live
When a trade executes, the API returns an unsigned EIP-1559 transaction. The CLI signs it locally via ows sign tx and broadcasts it directly to Polygon via RPC — no private keys are sent to the Dawn backend.
Environment Variables
| Variable | Description |
|---|---|
| DAWNAI_API_KEY | Auth token. Set automatically on dawn auth login. Can be set manually for headless/CI use. |
| DAWN_LOCAL_WALLET_NAME | ows wallet name for live trading. Set automatically from dawn wallet use. |
| DAWN_LOCAL_WALLET_ADDRESS | EOA address for the active wallet. Set automatically from dawn wallet use. |
| DAWN_CLI_HOME | Override config directory (default: ~/.dawn-cli). |
File Locations
| Path | Description |
|---|---|
| ~/.dawn-cli/config.json | Auth token and active wallet selection |
| ~/.dawn-cli/runs.json | Strategy run metadata (run_id, pid, mode, logs path) |
| ~/.dawn-cli/logs/<run_id>.log | Per-run strategy output logs |
| ~/.dawn-cli/templates/<name>.py | Downloaded template strategies |
| ~/.dawn-cli/.venv/ | Python virtual environment with the Dawn SDK |
| ~/.ows/bin/ows | OpenWallet CLI binary |
