Manic Agent Skill
Trade event contracts on Manic, deployed on Solana. All trading operations are fully server-side — no client-side wallet signing required.
Environment Setup
Before using any command, ensure the API key is set:
MANIC_API_KEY=sk-<your-api-key>
Available Commands
All commands are executed via:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py <command> [options]
Market Data
Get all trading pair prices:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py get-prices
Get single trading pair price:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py get-price --asset btc
Assets: btc, eth, sol, gold, silver, spy, xmr, pyth, layer, drift
Account
Get account info, balance, and trading stats:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py get-account
Trading
Open a position:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py open-position \
--asset btc --side call --amount 10000000 --duration 60
| Parameter | Required | Description |
|---|---|---|
--asset |
Yes | btc, eth, sol, gold, silver, spy, xmr, pyth, layer, drift |
--side |
Yes | call (price goes up) or put (price goes down) |
--amount |
Yes | Stake in base units (10000000 = 10 USDC) |
--duration |
No | Seconds: 30, 60, 120, 180, 240, 300 (default: 60) |
--target-multiplier |
No | 1.0-100.0 (default: 1.0). Higher = harder to win, higher payout |
--mode |
No | single (default) or batch |
--end-time |
No | Unix timestamp for batch mode settlement |
Close a position early:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py close-position \
--position-id <position_id> --asset btc
History
Paginated history:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py position-history --page 1 --limit 10
Cursor-based history:
python3 ${CLAUDE_SKILL_DIR}/scripts/manic_agent_api.py position-history-cursor --limit 10
Optional: --before-time <unix_ts> or --after-time <unix_ts>
Trading Workflow
Follow this sequence for safe trading:
- Check balance —
get-accountto verify sufficient funds - Open position —
open-positionwith desired parameters (price check and tradability verification are done automatically) - Monitor —
position-historyto track position status - Close early (optional) —
close-positionbefore settlement
Key Rules
- No need to check price before trading.
open-positionautomatically verifies the asset is active and tradable, and returns the price at open. - Asset naming is flexible. The script auto-converts to lowercase, so
BTC,Btc,btcall work. - Amount is in base units. USDC has 6 decimals: 1000000 = 1 USDC, 10000000 = 10 USDC.
- Respect trading hours. GOLD, SILVER, SPY have restricted hours — check
trading_schedule. - Price conversion. Response
priceis raw. UI price =pricex 10^price_exponent. - Side meaning.
call= bullish (up),put= bearish (down). - Durations. Single mode only: 30, 60, 120, 180, 240, 300 seconds.
Supported Assets
| Asset | Type | Hours |
|---|---|---|
| BTC, ETH, SOL, XMR, PYTH, LAYER, DRIFT | Crypto | 24/7 |
| GOLD, SILVER | Commodities | Exchange hours |
| SPY | Equity | Exchange hours |
Error Handling
If an API call returns an error:
401— API key is invalid or missing400— Invalid parameters (check asset name, duration, amount)404— Asset or position not found500— Server error (retry after a moment)503— Signing service unavailable (retry later)
References
See references/trading-api.md for the complete API documentation with request/response examples.