Execute Trade logo

Execute Trade

Community
stoaaadev
execute-trade

Executes validated trade signals on Solana via Jupiter, with preflight simulation and slippage protection

Overview

Publisherstoaaadev
Repositorystoa
Skill nameexecute-trade
Stars
26
Forks
6
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by stoaaadev on GitHub. Read the source before you install it.

Installation

Install the Execute Trade AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/stoaaadev/stoa/tree/main/skills/execute-trade
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/stoaaadev/stoa.git /tmp/stoa
mkdir -p .claude/skills
cp -r /tmp/stoa/skills/execute-trade .claude/skills/execute-trade
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Execute Trade in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Execute Trade on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Execute Trade is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

execute-trade

Priority: P0 (reactive — only runs on trade-signal trigger) Input: memory/mesh/executor.json (trade-signals from analyst or guardian) Output: Execution reports to analyst + guardian inboxes, tx-log, positions

Instructions

You are executing the execute-trade skill for the Executor agent.

Step 0: Safety Checks (MANDATORY — do not skip)

0a. Check Guardian halt: Read memory/mesh/executor.json for halt or cooldown messages from Guardian. If active halt (cooldown_until > now): EXIT IMMEDIATELY. Exit code: EXEC_HALTED

0b. Check wallet: Verify SOLANA_PRIVATE_KEY is set. If not: EXIT. Exit code: EXEC_NO_WALLET

0c. Check RPC: Verify Solana RPC is reachable: curl -s -X POST "${SOLANA_RPC_URL}" -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}' If not healthy: EXIT. Exit code: EXEC_RPC_DOWN

Step 1: Read Trade Signals

Read memory/mesh/executor.json for messages where type = trade-signal. Sort by: priority = "urgent" first, then by confidence descending. Process one trade at a time (never batch).

Step 2: Validate Each Signal

For each trade-signal, check all of the following:

CheckPass conditionOn fail
Sourcefrom is "analyst" or "guardian"Reject: unknown source
Confidenceconfidence >= ${min_confidence} (from analyst config)Reject: below threshold
Position sizeAmount in USD <= ${max_position_usd}Reject: exceeds limit
ExposureAdding this position keeps single-token exposure < 80% of portfolioReject: overexposed
DuplicateNo identical trade in memory/tx-log.json within last 1hReject: duplicate
BalanceWallet has sufficient SOL (including ~0.01 SOL for gas)Reject: insufficient balance

If any check fails: log to memory/tx-log.json with status rejected and skip.

Step 3: Execute via Jupiter

For BUY orders:

bash
# 1. Get quote
curl -s "https://quote-api.jup.ag/v6/quote?\
inputMint=So11111111111111111111111111111111111111112&\
outputMint=${token_address}&\
amount=${amount_in_lamports}&\
slippageBps=${slippage_bps}"

# 2. Get swap transaction
curl -s -X POST "https://quote-api.jup.ag/v6/swap" \
  -H "Content-Type: application/json" \
  -d '{
    "quoteResponse": <from step 1>,
    "userPublicKey": "<wallet_pubkey>",
    "wrapAndUnwrapSol": true,
    "dynamicComputeUnitLimit": true,
    "prioritizationFeeLamports": "auto"
  }'

# 3. Deserialize, sign, and send
# Use @solana/web3.js VersionedTransaction
# Send with maxRetries: 3, skipPreflight: false

For SELL orders: Reverse inputMint and outputMint.

Preflight simulation (MANDATORY): Before sending, simulate the transaction with simulateTransaction. If simulation fails or returns an error, ABORT. Log the simulation error.

Slippage guard: After getting the quote, check otherAmountThreshold. If actual output is more than ${slippage_bps} below expected, ABORT.

Step 4: Confirm Transaction

After sending:

  1. Wait for confirmation (commitment: confirmed, timeout: 60s)
  2. Fetch the transaction details to verify actual execution price
  3. Calculate actual slippage: (expected_price - actual_price) / expected_price * 10000 bps

Step 5: Record Position

On successful fill, update memory/positions.json:

json
{
  "token": "JUP",
  "token_address": "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN",
  "entry_price": 1.234,
  "amount": 100.5,
  "amount_usd": 50.00,
  "entry_time": "2026-05-18T12:00:00.000Z",
  "stop_loss_pct": -8,
  "take_profit_pct": 25,
  "strategy": "momentum",
  "tx_signature": "5xG7...",
  "signal_id": "analyst-1716000000000-a3f2"
}

For SELL orders: remove the position from positions.json and record the exit in tx-log.

Step 6: Report

Write execution-report to both memory/mesh/analyst.json and memory/mesh/guardian.json:

json
{
  "from": "executor",
  "to": ["analyst", "guardian"],
  "type": "execution-report",
  "id": "exec-{timestamp}",
  "timestamp": "{now_iso}",
  "data": {
    "signal_id": "analyst-...",
    "status": "filled | failed | aborted | rejected",
    "action": "buy",
    "token": "JUP",
    "amount": 100.5,
    "price": 1.234,
    "amount_usd": 50.00,
    "slippage_actual_bps": 30,
    "tx_signature": "5xG7...",
    "error": null
  }
}

Append to memory/tx-log.json.

Anti-Patterns

  • NEVER execute without a trade-signal in your inbox. You do not freelance.
  • NEVER exceed ${max_position_usd}. This is a hard limit, not a suggestion.
  • NEVER skip preflight simulation. A failed simulation = no trade.
  • NEVER retry a failed transaction more than 3 times. After 3 failures, abort and report.
  • NEVER log the full private key or transaction signing details.
  • NEVER send funds to any address other than DEX program addresses (Jupiter, Raydium).

Exit Codes

  • EXEC_FILLED — trade executed successfully
  • EXEC_PARTIAL — partially filled (log actual fill amount)
  • EXEC_ABORTED — aborted due to slippage, simulation failure, or validation
  • EXEC_REJECTED — signal failed validation checks
  • EXEC_FAILED — transaction sent but failed on-chain
  • EXEC_HALTED — Guardian halt active
  • EXEC_NO_WALLET — no private key configured
  • EXEC_RPC_DOWN — RPC unreachable

Output

Commit message format: executor: {action} {amount} {token} @ ${price} — {status} tx:{sig_short} Example: executor: buy 100.5 JUP @ 1.234 — filled tx:5xG7...

Frequently asked questions

What does the Execute Trade AI skill do?

Executes validated trade signals on Solana via Jupiter, with preflight simulation and slippage protection

Why use Execute Trade on TypingMind?

Because you install it once and use it with any model. Execute Trade is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Execute Trade in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/stoaaadev/stoa/tree/main/skills/execute-trade. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Execute Trade?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Execute Trade?

As many as you like. As long as a model supports skills, you can use Execute Trade with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Execute Trade AI skill free?

Yes. It is published on GitHub by stoaaadev under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇