Skip to content

Repository files navigation

API LLM Trader

A skill that lets LLM agents trade on Aftermath V2 perpetuals through the native API. Install it into Claude Code, Cursor, Codex, or any agent that supports skills, then interact in natural language.

"What's the funding rate on BTC right now?"

"Place a limit buy for 0.01 BTC at $50 under the current mid."

"Show me all open positions and their PnL."

Install

git clone https://github.com/clawd-aftermath/api-llm-trader.git
cd api-llm-trader
pip install -r requirements.txt

Then copy/symlink to your agent's skill directory:

ln -s "$(pwd)" ~/.claude/skills/api-llm-trader

Configure

./aftermath-config

Or set environment variables:

export AFTERMATH_PRIVATE_KEY=suiprivkey1...
export AFTERMATH_WALLET_ADDRESS=0x...
export AFTERMATH_ACCOUNT_ID=123

Scripts

Script Role
scripts/query.py Market data, account reads
scripts/trade.py Signed writes (orders, leverage, deposits)
scripts/paper.py Local paper trading simulation

All emit JSON. Errors are {"error": "..."}.

Capabilities

  • Orderbooks, candles, funding rates, market metadata
  • Paper trading against live orderbooks
  • Account positions, open orders, order history
  • Limit/market orders, cancel, cancel-and-place (atomic)
  • Leverage, deposit/withdraw USDC collateral

Command Index

See SKILL.md for the full command reference.

Architecture

  • Reads: Native Aftermath API (/api/perpetuals/*), with no CCXT dependency for core market/account reads
  • Writes: Native transaction builders → Sui Ed25519 signing → Sui JSON-RPC submission
  • No SDK vendoring: Pure HTTP via requests + PyNaCl for signing

Integration References

License

MIT — see LICENSE. Review DISCLAIMER.md before using a funded account.

Attribution

Forked from elliottech/lighter-agent-kit. See ATTRIBUTION.md.

About

LLM skill for trading Aftermath Finance perpetuals via native APIs

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages