position-journal
The position book is the journal: every confirmed swap writes it, an entry carries its plan, a sell its close reason; P&L read from defi_data.positions and /trade status (average cost, computed by the verb, never by hand), reconcile, retire, unknown is never zero, and never summing books.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 12
- Forks
- 2
01 前言 Front Matter
- name
- position-journal
- license
- MIT
- metadata
- { "polyrob-when": "Recording fills and reading P&L of positions", "polyrob-version": "6", "polyrob-priority": "2", "polyrob-triggers": "{\"tool_ids\":[\"defi_trade\",\"defi_data\"]}" }
- description
- The position book is the journal: every confirmed swap writes it, an entry carries its plan, a sell its close reason; P&L read from defi_data.positions and /trade status (average cost, computed by the verb, never by hand), reconcile, retire, unknown is never zero, and never summing books.
03 SKILL.md 正文
Position Journal — the book is the journal
The money rail keeps ONE position book (open_positions). You do not write
it: every CONFIRMED swap records its position there, sized from the guard's
simulation. The chain is the truth; the book must match it. Every figure the owner
or the public sees is rendered from this book. Do not keep a second record — no
markdown ledger, no trade table in the knowledge base, no running total in a
note. A second record is what disagreed with the chain before.
What the book holds
- Positions. A confirmed
swap(EVM) orsolana_swaprecords the size from the vetted simulation (SIMULATED balance change, final fill not measured) and the cost basis in USD. Each sell books its realized P&L. The cost method is AVERAGE COST: a partial sell reduces the basis in proportion to the size sold. The native coin or the wrapped native bought WITH A STABLE is a position too; the same coin received from an exit is not.defi_data.positions(chain=…)reads the book and does every sum for you: size, basis, price, value, unrealized P&L in USD and %, realized P&L, and the high-water price. The owner sees the same basis as "Entry" in/book. - The plan. Inside a trading mandate every entry carries its
plan(thesis, confidence, invalidation, preset); it is stored beside the book row and the exit runs follow it. Write the WHY there, not in a note. - The close reason. Every sell says why it closes with
close_reason(exitslists the values). It reaches the realized row, and/trade statusshows the reasons beside the realized P&L. - Reconcile.
defi_data.reconcile(chain=…)compares the book with on-chain balances and returns a VERDICT (CLEAN,DISAGREEMENT,UNVERIFIED). Its output is authoritative over your memory and over any earlier summary. - Basis unknown. A position has NO basis when it was inherited or bought by
a swap the rail could not value.
positionsthen says "basis unknown" and gives no P&L. Unknown is not zero: never write $0 as its cost, and never compute a P&L for it yourself. - What the book does not hold: fees per trade (so P&L is gross of gas), and venue positions (Hyperliquid, Polymarket).
The procedure
- Verify every fill (see
post-trade-verify): chain, address, side, measured quantity, gas, tx hash. The quantity is the measured chain delta (portfoliobefore and after) — never the quoted output, never the book's simulated size, and never the "fill" a tool result reports. - Read P&L from the verbs.
defi_data.positionsper chain;/trade statusfor a mandate (allocation used, PROTECTED/UNPROTECTED, realized gross, the mandate's LLM cost). Repeat their figures as written. Do not keep lots by hand, do not use FIFO, and do not compute or convert a money figure yourself. If a verb saysunknownor "at least", say the same. - Reconcile before any claim about the book, before a new entry on the same token, and after anything that looked wrong. A record can say "Open positions: NONE" while the chain holds positions; never publish a book claim you did not reconcile.
- Holdings the book does not explain are either a position bought outside
the money rail or something someone sent you — the rule for those is
"Tokens you did not buy" in
trade-execution. Say which in your report.reconcilenames an unpriced token the book does not hold asunsolicited: it is not an issue. - A book row the chain does not back: if the measured balance is zero or
dust, retire it with
defi_data.retire_row(it refuses unless the chain proves it). A loss to close is the owner's/writeoff. - One symbol, two contracts: if
reconcileprints the collision warning, the book row's address decides which contract is yours — never the symbol. - Never sum books. Each chain, each wallet, and each venue keeps its own rows; a treasury figure names what it includes.
If a tool is missing
Follow harness-manual; do the read steps you can, and never work around a
missing verb with a raw call, a browser dapp or another agent.
Related
post-trade-verify, exits, trading-mandate. To check SOMEONE ELSE's wallet, use
defi_data.wallet_holdings(address=…, chain=…) — positions and portfolio
read only this agent's own book.
04 同仓库更多 Skills
echo-basics
How to use the echo tool from the echo fixture pack.
x-engagement
Operate X account communication on the API rail (the captured-browser rail only where the owner chose it)—read inboxes, post/reply, send DMs, set up the account, with the real write gates and completion evidence
social-discovery
Discover public X/social accounts and conversations with AnySite first (anysite_describe, then anysite_api), using native X account reads where they are authoritative and preserving write gates
polymarket-trading
GATED: place/cancel Polymarket orders. Owner-only, read-first, >$500 confirmation gate; references crypto-trading-safety
polymarket-portfolio-review
Read the configured Polymarket account's positions and trade history from the public Data API (no address parameter); summarize exposure and P&L
polymarket-market-research
Read Polymarket markets (discover, details, price as implied probability, orderbook, spread, volume) with no wallet