agentleFS
cecewu3cecewu3/agent-trading-skills/skills/binance-spot-trade/SKILL.md

binance-spot-trade

Skill0 starsChanged 15 days agoMITView on GitHub

Place and manage crypto SPOT orders with hard risk caps, exchange filters, and dry-run/testnet support. Reference implementation targets Binance Spot REST; keep adapters swappable for other spot venues. Use when buying/selling spot, checking balances or positions, implementing trade.py, or wiring order flow after a judge decision. Trigger phrases: "spot buy", "spot sell", "place order", "check positions", "dry-run trade", "trade.py".

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Verify symbol status is tradable for spot (Binance: status=TRADING, spot permission).

    line 43
  2. Distinctive:

    Read filters (Binance names.

    line 44
  3. Distinctive:

    Only sell quantity tracked (or available) for that spot position.

    line 63
  4. Very specific:

    If PnL % ≥ risk.take_profit_pct → sell (per rules)

    line 85
  5. Very specific:

    If PnL % ≤ risk.stop_loss_pct → sell

    line 86
  6. Very specific:

    If held ≥ risk.max_hold_hours → sell or alert (per your explicit policy in config comments)

    line 87
  7. Distinctive:

    Prefer marketable spot orders for news-driven flow unless config says otherwise

    line 124

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Spot trade (Binance reference)

Overview

Implement a spot-only trading module that reads keys from keychain/env, enforces risk.* and entry.* from config.yaml, respects venue filters, and records positions/logs. Wording below is venue-agnostic where possible; Binance-specific endpoints and filters are called out as the reference adapter.

When to use

  • Executing a BUY / SELL from news-judge
  • Periodic TP / SL / max-hold checks
  • Implementing or auditing the order path

Instructions

1. Safety gates (before any signed call)

  1. Confirm exchange.testnet / exchange.dry_run per config and AGENTS.md stage rules.
  2. Load API key + secret from OS keychain or env (exchange.keychain / documented env names). Never print them.
  3. Permission check: query API key / account permissions. If withdraw, transfer, futures, or margin are enabled → refuse, notify via notifications, stop.
  4. Allow-list HTTP methods+paths in code. Reference Binance Spot allow-list pattern:
    • GET /api/v3/time
    • GET /api/v3/ticker/price
    • GET /api/v3/exchangeInfo
    • GET /api/v3/account
    • POST /api/v3/order (live)
    • POST /api/v3/order/test (dry-run)
    • Reject everything else (no withdraw, margin, futures, transfer).

2. Symbol + filters

  1. Resolve SYMBOL = base + exchange.quote_asset (e.g. BTC + USDT).
  2. Verify symbol status is tradable for spot (Binance: status=TRADING, spot permission).
  3. Read filters (Binance names; map equivalents on other venues):
    • LOT_SIZE / MARKET_LOT_SIZE — step size, min/max qty
    • MIN_NOTIONAL or NOTIONAL — min quote
    • price tick size if using limit orders
  4. Round quantities down to step size; ensure quote notional ≥ max(config risk.min_buy_quote, venue min).

3. Risk caps (code)

Before buy:

  • Quote amount ≤ risk.max_buy_quote
  • Amount equals entry.probe.size_quote or entry.normal.size_quote for the judge tier (or explicit CLI amount that still respects caps)
  • Judge confidence already met entry.min_confidence and the tier's min_confidence; impact met tier min_impact; risk ≤ tier max_risk (trade module may re-check)
  • Open bot cost basis + new buy ≤ risk.max_total_cost_quote
  • Positions on symbol < risk.max_positions_per_symbol
  • Symbol in universe (include/exclude/stables rules)

Before sell:

  • Only sell quantity tracked (or available) for that spot position; no naked short
  • News-driven sells: confidence ≥ entry.sell_min_confidence when that key is set; entry.allow_sell_existing must be true
  • TP/SL/max-hold exits use risk.* and do not require sell_min_confidence

4. Order flow

judge/CLI intent
  → validate config + permissions + universe
  → compute quote/qty in code
  → apply filters (LOT_SIZE, MIN_NOTIONAL)
  → acquire process lock
  → dry_run ? order-test / simulate : create market (or configured) order
  → update positions file + append trades log
  → release lock → JSON result on stdout
  → optional notification (no secrets)

5. Exit checks

On a schedule (schedule.position_check_minutes) or CLI check:

  • If PnL % ≥ risk.take_profit_pct → sell (per rules)
  • If PnL % ≤ risk.stop_loss_pct → sell
  • If held ≥ risk.max_hold_hours → sell or alert (per your explicit policy in config comments)

Suggested CLI

python trade.py balance
python trade.py price SYMBOL
python trade.py buy SYMBOL --tier probe|normal [--dry-run]
python trade.py sell SYMBOL [all|QTY] [--dry-run]
python trade.py positions
python trade.py check [--dry-run]

Project paths

PathRole
config.yamlexchange, risk, entry
trade.pyorders + checks
data/positions.jsonopen bot positions
data/trades.logappend-only log

Input / output schema

Buy input: symbol, tier or quote amount, dry-run flag.
Output: JSON with ok, symbol, side, qty, quote, order_id (or dry_run), ts.
Refuse: JSON with ok: false, error, non-zero exit.

Failure handling

  • Insufficient balance / filter reject → no retry loop that escalates size
  • Lock busy → exit cleanly
  • Network error mid-order → query open orders / fills before retry; use client order id for idempotency

Guidelines

  • Spot only; refuse futures/margin wording in CLI
  • Prefer marketable spot orders for news-driven flow unless config says otherwise
  • Other venues: keep the same caps and lock/log pattern behind an adapter interface

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.