octopus-strategy
OCTOPUS v1.0 โ Market-Neutral Hedge Fund. Two single-direction books on two wallets, one producer. The LONG book ranks the live liquid main-DEX crypto cross-section by 24h relative strength and LONGS the strongest, trend-confirmed names; the SHORT book mirror-images it and SHORTS the weakest, trend-confirmed laggards. The two books net to ~beta-neutral โ the edge is DISPERSION (leaders minus laggards), not market direction. NOT a copy-trader: each book scores its own universe and pushes signals; the runtime owns the LLM gate (pass-through), DSL exits, and all risk.guard_rails. OCTOPUS_LEG env selects the book.
What this skill does
# ๐ OCTOPUS v1.0 โ Market-Neutral Hedge Fund Octopus runs **two concurrent strategy wallets** whose net market exposure is ~zero. **One producer script** (`octopus-producer.py`) serves both; the `OCTOPUS_LEG` env var selects which book a given daemon is. Each book binds to its own wallet, runtime YAML, DSL, and risk envelope. > **The edge is dispersion, not direction.** Octopus longs the relative > leaders and shorts the relative laggards of the same liquid crypto > cross-section. Long-book gains + short-book gains capture the **spread** > between strong and weak names while the long and short notionals offset > market beta. In a HYPE-dominates / alts-crushed regime the long book > gravitates to the leaders and the short book to the carnage โ market-neutrally. | Book | Style | Wallet env | Runtime | Scanner | |---|---|---|---|---| | `long` | Cross-sectional relative-strength LONG | `OCTOPUS_LONG_WALLET` | `runtime-long.yaml` | `octopus_long_signals` | | `short` | Cross-sectional relative-weakness SHORT | `OCTOPUS_SHORT_WALLET` | `runtime-short.yaml` | `octopus_short_signals` | ## How market-neutral is achieved Octopus does **not** emit atomic pairs. Neutrality emerges at the **fund level**: two equally-funded single-direction books. The long book holds a basket of leaders; the short book holds a basket of laggards. With balanced funding (50/50) and balanced sizing (both `margin_pct 20`, `slots 4`), the long and short notionals roughly offset, so the portfolio's net beta โ 0 and its return is driven by the **dispersion** between the two baskets. Each book has its own wallet + DSL, so a position exiting on one side does not force the other โ the books re-balance continuously as leadership rotates. ## The relative-strength rank (shared by both books) Each tick the producer pulls the live instrument board **once** and computes, for every liquid main-DEX perp (`dayNtlVlm โฅ volFloorUsd`, default $20M), its **24h return** from `markPx` vs `prevDayPx`. The **universe mean** of those returns is "the market." Each asset's **excess = own 24h โ universe mean** is its cross-sectional relative strength. This rank costs **zero candle fetches**. Only the top (long) / bottom (short) `rankPoolSize` names by excess (default 12) then get 1h+4h candles pulled for absolute-trend confirmation โ bounding per-tick fetches. ## LONG book โ long the leaders (trend-confirmed) ### Scoring (raw integer; `minScore` 5) | Component | Pts | Source | |---|---|---| | Relative strength (excess) | +3 (โฅ2ร`rsThresholdPct`) / +2 (โฅ1ร) / +1 (โฅ0) / **disqualify** (<0) | 24h excess vs cross-section | | 4h trend structure | +2 BULLISH / **disqualify** BEARISH | 4h candles | | 1h trend confirmation | +1 BULLISH / โ1 BEARISH | 1h candles | | Own absolute momentum | +1 (24h โฅ 0) / โ1 (< 0) | instrument ctx | | RSI blow-off guard | โ2 (RSI > `rsiOverbought` 80) | 1h RSI | Disqualifies any name that is a relative *under*performer or in a 4h downtrend โ it never longs a "least-bad" laggard in a crash. ## SHORT book โ short the laggards (trend-confirmed) ### Scoring (raw integer; `minScore` 5) | Component | Pts | Source | |---|---|---| | Relative weakness (excess) | +3 (โคโ2ร`rsThresholdPct`) / +2 (โคโ1ร) / +1 (โค0) / **disqualify** (>0) | 24h excess vs cross-section | | 4h trend structure | +2 BEARISH / **disqualify** BULLISH | 4h candles | | 1h trend confirmation | +1 BEARISH / โ1 BULLISH | 1h candles | | Own absolute momentum | +1 (24h โค 0) / โ1 (> 0) | instrument ctx | | RSI capitulation guard | โ2 (RSI < `rsiOversold` 20) | 1h RSI | Disqualifies any name that is a relative *out*performer or in a 4h uptrend โ it never shorts a rising leader. ## Execution & exit (both books) - slots **4**, `margin_pct` **20%** (4 ร 20 = 80% max committed), tick **300s** - **strict 5x** leverage clamp, then to each asset's Hyperliquid venue max - DSL **moderate dispersion management**: phase1 max_loss **14%** / retrace 8 / 1 breach; `weak_peak_cut` **ON** (6h @ 2.0), `dead_weight_cut` **ON** (12h), `hard_timeout` **4d**; phase2 ladder `8%โlock0 / 18%โ40 / 35%โ60 / 60%โ78 / 100%โ88` - stall-cuts are **ON** by design: a position whose relative trend mean-reverts should be recycled into a fresher leader/laggard, not ridden indefinitely. ## Leverage clamping (both books) Desired leverage = the book cap (`maxLeverage` 5). The producer clamps to each asset's **Hyperliquid venue max** from `market_list_instruments`. The runtime decision gate also rejects any leverage above 5 as a clamp-breach defense. ## XYZ handling Octopus ranks the **main-DEX crypto** cross-section only โ XYZ equities are excluded (no clean cross-sectional peer group, and they're Spider's domain). The `main` and `xyz` clearinghouse sections are two VIEWS of ONE cross-margined wallet, so `get_positions()` takes `accountValue` ONCE via `max()` across the two โ never sums it (summing double-counts and sizes 2x too large). ## Race-window dedup Each `push_signal(coin)` is recorded in `state/recent-signals-<leg>.json` (per-book). The producer skips any coin seen within 180s before scoring โ covering the gap between a push returning OK and the position appearing in the next-tick clearinghouse pull. On-chain held-asset filtering is the safety floor. ## Risk gates (`risk.guard_rails`) | Gate | long | short | |---|---|---| | daily_loss_limit_pct | 12 | 12 | | max_entries_per_day | 6 | 6 | | max_consecutive_losses | 4 | 4 | | cooldown_minutes | 60 | 60 | | drawdown_halt_pct | 20 | 20 | | per_asset_cooldown_minutes | 180 | 180 | | data_retention_hours | 120 | 120 | | drawdown_reset_on_day_rollover | true | true | Entries and exits both use `FEE_OPTIMIZED_LIMIT` (`ensure_execution_as_taker` true; 45s maker-first window). ## Files | File | Purpose | |---|---| | `runtime-long.yaml` | Long-book runtime spec (wallet, DSL, risk, LLM gate) | | `runtime-short.yaml` | Short-book runtime spec | | `scripts/octopus-producer.py` | Book-aware producer daemon (one script, both books) | | `scripts/octopus_config.py` | Leg resolution + SenpiClient wrapper + helpers | | `config/octopus-long-config.json` | Long-book tunables (universe floor, RS threshold) | | `config/octopus-short-config.json` | Short-book tunables | ## Operator install See [README.md](README.md) โ the two books are two daemons (`OCTOPUS_LEG=long` and `OCTOPUS_LEG=short`) on two **equally-funded** wallets, each with its own runtime YAML. Equal funding is what keeps the fund neutral. ## Hard rule for user-conversation Claude sessions User-conversation Claude sessions MUST NOT call any of: `create_position`, `close_position`, `edit_position`, `ratchet_stop_add`, `ratchet_stop_edit`, `ratchet_stop_delete`, `cancel_order`, `strategy_close`, `strategy_close_positions`. These tools are reserved for the **producer daemon** (entry path) and the **DSL ratchet engine** (exit path). User-conversation sessions are **read-only**. Each producer daemon handles real signals on its next tick. ## License Apache-2.0 โ Copyright 2026 Senpi (https://senpi.ai)
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts โ single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score โฅ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.