Agent Skillskrakenfx/kraken-cli › kraken-basis-trading

kraken-basis-trading

GitHub

用于执行Kraken现货与期货的基差交易,通过构建Delta中性头寸捕捉正向基差收益。涵盖价格计算、入场、监控及退出流程,强调风险控制与人工审批。

skills/kraken-basis-trading/SKILL.md krakenfx/kraken-cli

Trigger Scenarios

识别并执行现货期货基差套利 监控基差收敛情况 关闭对冲仓位

Install

npx skills add krakenfx/kraken-cli --skill kraken-basis-trading -g -y
More Options

Use without installing

npx skills use krakenfx/kraken-cli@kraken-basis-trading

指定 Agent (Claude Code)

npx skills add krakenfx/kraken-cli --skill kraken-basis-trading -a claude-code -g -y

安装 repo 全部 skill

npx skills add krakenfx/kraken-cli --all -g -y

预览 repo 内 skill

npx skills add krakenfx/kraken-cli --list

SKILL.md

Frontmatter
{
    "name": "kraken-basis-trading",
    "version": "1.0.0",
    "metadata": {
        "openclaw": {
            "category": "finance"
        },
        "requires": {
            "bins": [
                "kraken"
            ],
            "skills": [
                "kraken-spot-execution",
                "kraken-futures-trading"
            ]
        }
    },
    "description": "Capture the spot-futures price spread with delta-neutral basis trades."
}

kraken-basis-trading

Use this skill for:

  • identifying positive basis (futures premium over spot)
  • entering delta-neutral positions (long spot, short futures)
  • monitoring basis convergence
  • closing both legs when basis narrows or contracts expire

Core Concept

When futures trade at a premium to spot (positive basis), you can buy spot and sell futures for the same notional amount. The profit comes from basis convergence as the contract approaches expiry, or from collecting funding on perpetuals. The position is market-neutral: price movement does not affect P&L, only the spread does.

Basis Calculation

SPOT=$(kraken ticker BTCUSD -o json 2>/dev/null | jq -r '.[].last_price')
FUTURES=$(kraken futures ticker PF_XBTUSD -o json 2>/dev/null | jq -r '.ticker.last')
BASIS=$(echo "scale=4; ($FUTURES - $SPOT) / $SPOT * 100" | bc)
echo "Basis: ${BASIS}%"

A positive basis means futures are more expensive than spot (contango). A negative basis means futures are cheaper (backwardation).

Entry (Long Spot + Short Futures)

  1. Check spot price and futures price.
  2. Ensure the basis is attractive (e.g., > 0.5% annualized).
  3. Calculate matched position sizes.
  4. Execute both legs (requires human approval):
# Long spot
kraken order buy BTCUSD 0.01 --type limit --price $SPOT -o json 2>/dev/null

# Short futures (matched notional)
kraken futures order sell PF_XBTUSD 1 --type limit --price $FUTURES -o json 2>/dev/null

Monitoring

Watch basis convergence:

# Periodic check
kraken ticker BTCUSD -o json 2>/dev/null
kraken futures ticker PF_XBTUSD -o json 2>/dev/null

Check positions:

kraken balance -o json 2>/dev/null
kraken futures positions -o json 2>/dev/null

Exit

Close both legs when basis narrows to target:

# Sell spot
kraken order sell BTCUSD 0.01 --type market -o json 2>/dev/null

# Close futures short
kraken futures order buy PF_XBTUSD 1 --reduce-only -o json 2>/dev/null

Risk Considerations

  • Execution risk: legs may fill at different times. The basis can move between fills.
  • Funding risk: on perpetuals, negative funding rates mean the short pays the long, eating into profit.
  • Margin risk: a sharp spot rally increases margin requirement on the short futures leg.
  • Leg risk: if one leg fails to fill, the position is directional, not neutral.

Hard Rules

  • Never enter a basis trade without confirming both legs will execute.
  • Monitor futures margin continuously; a large spot rally can trigger liquidation on the short.
  • Close both legs together; leaving one open converts to a directional bet.
  • Requires human approval for all live entries and exits.
  • If you hit a mismatch between what you are trying to do and the CLI's interface or responses — including a mismatch between this skill and the installed CLI version's contract — feel free to submit feedback with kraken feedback.

Version History

  • aa56e59 Current 2026-08-20 04:44

    修复了基准计算脚本中获取现货价格的jq字段(从.c[0]改为.last_price);新增kraken feedback命令支持反馈。

  • aa32814 2026-07-25 10:28

Same Skill Collection

skills/kraken-alert-patterns/SKILL.md
skills/kraken-autonomy-levels/SKILL.md
skills/kraken-dca-strategy/SKILL.md
skills/kraken-earn-staking/SKILL.md
skills/kraken-error-recovery/SKILL.md
skills/kraken-fee-optimization/SKILL.md
skills/kraken-funding-carry/SKILL.md
skills/kraken-funding-ops/SKILL.md
skills/kraken-futures-risk/SKILL.md
skills/kraken-grid-trading/SKILL.md
skills/kraken-lab-experiment/SKILL.md
skills/kraken-liquidation-guard/SKILL.md
skills/kraken-market-intel/SKILL.md
skills/kraken-mcp-integration/SKILL.md
skills/kraken-multi-pair/SKILL.md
skills/kraken-order-types/SKILL.md
skills/kraken-paper-strategy/SKILL.md
skills/kraken-paper-to-live/SKILL.md
skills/kraken-playground/SKILL.md
skills/kraken-portfolio-intel/SKILL.md
skills/kraken-rate-limits/SKILL.md
skills/kraken-rebalancing/SKILL.md
skills/kraken-risk-operations/SKILL.md
skills/kraken-setup/SKILL.md
skills/kraken-spot-execution/SKILL.md
skills/kraken-stop-take-profit/SKILL.md
skills/kraken-subaccount-ops/SKILL.md
skills/kraken-tax-export/SKILL.md
skills/kraken-twap-execution/SKILL.md
skills/kraken-ws-streaming/SKILL.md
skills/recipe-basis-trade-entry/SKILL.md
skills/recipe-daily-pnl-report/SKILL.md
skills/recipe-drawdown-circuit-breaker/SKILL.md
skills/recipe-earn-yield-compare/SKILL.md
skills/recipe-emergency-flatten/SKILL.md
skills/recipe-fee-tier-progress/SKILL.md
skills/recipe-funding-rate-scan/SKILL.md
skills/recipe-futures-hedge-spot/SKILL.md
skills/recipe-launch-grid-bot/SKILL.md
skills/recipe-morning-market-brief/SKILL.md
skills/recipe-multi-pair-breakout-watch/SKILL.md
skills/recipe-paper-strategy-backtest/SKILL.md
skills/recipe-playground-dca-triggered/SKILL.md
skills/recipe-playground-dca/SKILL.md
skills/recipe-playground-price-alert/SKILL.md
skills/recipe-playground-rebalance/SKILL.md
skills/recipe-playground-webhook/SKILL.md
skills/recipe-portfolio-snapshot-csv/SKILL.md
skills/recipe-price-level-alerts/SKILL.md

Metadata

Files
0
Version
aa56e59
Hash
f19ec7ff
Indexed
2026-07-25 10:28

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 08:59
浙ICP备14020137号-1 $Гость$