agentleFS
MendurimMendurim/strikegrok-trading-desk/skills/strike-positions/SKILL.md

strike-positions

Skill0 starsChanged 2 months agoMITView on GitHub

Managing Strike Finance positions through the signed REST API - leverage per symbol, cross and isolated margin mode, reading margin usage and distance to liquidation, attaching protection to an existing position, and closing with reduce-only orders. Use when setting up a market before a first trade, when a position needs protecting or closing, or when checking liquidation risk. Leverage, protection and closes write; reads are open to the Risk Manager.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    If desk.md records a standing approval for protective stops, a reduce-only stop on an unprotected position may be placed without waiting.

    line 65
  2. Very specific:

    Always set slippage on a market close.

    line 79
  3. Very specific:

    After any close, read GET /v2/positions again.

    line 81
  4. Distinctive:

    No leverage raised to make a ticket fit.

    line 87
  5. Distinctive:

    No margin-mode change attempted on an open position and then reported as done.

    line 88
  6. Distinctive:

    No position left without a resting stop.

    line 89
  7. Distinctive:

    No close without confirming afterwards that the position is gone and its protection is cancelled.

    line 90

≈ “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

Strike positions

Reads here are open to the Risk Manager and Trade Reviewer. The write paths - leverage, margin mode, protection, closing - belong to the Execution Trader alone, under strike-orders rules. Signing is in strike-auth.

1. Leverage

cd /workspace/strikegrok
python3 scripts/strike_request.py POST /v2/leverage --body-file lev.json   # {"symbol":"ADA-USD","leverage":5}
  • Applies to new positions only. An open position keeps the leverage it opened at, so leverage is set before an entry, never as a repair afterwards.
  • The response carries the resulting maximum notional at that leverage. Size against that figure, not against the headline number: a size that fits at the headline may not fit at the notional the position actually reaches.
  • High leverage is not the desk's default. The Risk Manager sizes from stop distance and risk budget; leverage is whatever falls out of that arithmetic, and risk-limits.md may only tighten it.
  • Raising leverage needs the user's approval. Lowering it to comply with a limit does not.

2. Margin mode

python3 scripts/strike_request.py POST /v2/marginMode --body-file mode.json  # {"symbol":"ADA-USD","marginMode":"isolated"}

Strike rejects a margin-mode change while a position is open on that symbol. Read the response rather than assuming it applied. Adjusting isolated margin on a live position is strike-advanced.

3. Reading the risk

python3 scripts/strike_request.py GET /v2/positions
python3 scripts/strike_request.py GET /v2/account
curl -sS "https://api.strikefinance.org/price/v2/markPrice?symbol=ADA-USD"

Report, per position: side, size, entry, current mark, unrealised PnL, effective leverage, margin used and mode, and distance to liquidation in both price and percent.

Distance to liquidation is measured against the mark price - that is what liquidation settles against, not the last trade and not the book mid. liquidationFee per market comes from /v2/exchangeInfo and is part of what a liquidation actually costs; include it in any honest worst case.

4. Protecting a position that already exists

A position with no resting stop is the desk's most urgent state.

# Stop on an open long: sell on trigger, reduce-only, off the mark price.
cat > sl.json <<'JSON'
{"client_order_id":"SG-20260910-01-sl","symbol":"ADA-USD","side":"sell","type":"stop",
 "size":"4800","stop_price":"0.1995","reduce_only":true,
 "working_type":"mark_price","close_position":true,"price_protect":true}
JSON
python3 scripts/strike_request.py POST /v2/order --body-file sl.json
python3 scripts/strike_request.py GET /v2/openOrders     # confirm it is resting (status 5, untriggered)

sell protects a long; buy protects a short. close_position: true flattens the whole position on trigger whatever the size field says, which keeps protection correct after a partial fill or an add - prefer it for a stop meant to flatten.

If desk.md records a standing approval for protective stops, a reduce-only stop on an unprotected position may be placed without waiting; it can only reduce exposure. Everything else waits for approval by ticket id. Record what was placed and why.

5. Closing

cat > close.json <<'JSON'
{"client_order_id":"SG-20260910-01-close","symbol":"ADA-USD","side":"sell","type":"market",
 "size":"4800","reduce_only":true,"slippage":"0.005"}
JSON
python3 scripts/strike_request.py POST /v2/order --body-file close.json
  • reduce_only: true means the order cannot flip you into the opposite side. It is what makes this the safe way out.
  • side is the side of the closing order: close a long by selling.
  • Always set slippage on a market close.
  • A partial close is a smaller size; the remainder stays open and still needs its stop, so resize protection before cancelling anything.
  • After any close, read GET /v2/positions again. If the position is gone, cancel the now-orphaned protective orders - a stop left resting can open a new position if it triggers. Report which case it was.

Closing is a trade: new ticket under the same proposal id, Risk PASS, approval by id, one send, reconciliation.

6. What this desk does not do

  • No leverage raised to make a ticket fit.
  • No margin-mode change attempted on an open position and then reported as done.
  • No position left without a resting stop.
  • No close without confirming afterwards that the position is gone and its protection is cancelled.
  • No vault_id; the desk trades the user's own account only.

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.