Receber por email
← Voltar para o catálogo

longbridge-correlation

Multi-asset correlation and cointegration analysis via Longbridge Securities — computes Pearson / Spearman return correlation matrix for 2–10 symbols, rolling 60-day correlation, Engle-Granger cointegration (ADF unit root), and spread half-life (AR(1) estimate). Used for portfolio decorrelation and pairs-trading pre-screening. Triggers: "相关性", "协整", "相关系数", "相关矩阵", "滚动相关", "去相关", "多标的相关", "相關性", "

27estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add longbridge/skills

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/longbridge-correlation/svg)](https://www.skillteca.com.br/skills/longbridge-correlation)
#ai

Skills relacionadas

Ver todas de Marketing →

Alerta por categoria

Receba novas skills de Marketing toda segunda

1 email curto, só com as skills novas de Marketing. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

longbridge-correlation

Computes pairwise return correlations and cointegration statistics for a basket of 2–10 symbols. Helps identify diversification opportunities, highly correlated pairs (pairs-trading candidates), and portfolio concentration risks.

Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.

When to use

  • User supplies 2–10 symbols and asks for correlation analysis, whether two stocks move together, rolling correlation trends, or pairs-trading pre-screening.
  • Triggers: "AAPL MSFT GOOGL 相关矩阵", "TSLA 和 NVDA 滚动相关", "correlation matrix for my watchlist", "协整检验 700.HK 5.HK".

Workflow

  1. For each symbol, fetch 252 daily candles:

longbridge kline <SYMBOL> --period day --count 252 --format json

  1. Align all series on time; drop dates missing in any series.
  2. Compute daily log-returns for each symbol.
  3. Pearson correlation matrix: pairwise Pearson correlation of returns; flag pairs with |ρ| > 0.8 (high) or < 0.2 (low).
  4. Spearman correlation (rank-based, robust to outliers): compute alongside Pearson for comparison.
  5. Rolling 60-day correlation for the highest-correlated pair: show trend over time.
  6. Cointegration screen (for pairs only):
  7. OLS spread residuals → ADF test → report p-value and verdict
  8. Half-life = −ln(2) / OLS slope of Δspread ~ spread_{t-1}
  9. Output correlation matrix heatmap description (text-based) and a summary of key relationships.

Run longbridge kline --help to confirm current flag names.

CLI

longbridge kline --help

# Repeat for each symbol (2–10)
longbridge kline <SYMBOL> --period day --count 252 --format json

Output

| Metric | 简体 | 繁體 | English | |---|---|---|---| | Pearson ρ matrix | 皮尔森相关矩阵 | 皮爾森相關矩陣 | Pearson correlation matrix | | Spearman ρ | 斯皮尔曼相关 | 斯皮爾曼相關 | Spearman correlation | | Rolling 60d corr | 60日滚动相关 | 60日滾動相關 | 60-day rolling correlation | | ADF p-value | 协整 p 值 | 協整 p 值 | ADF p-value | | Half-life | 半衰期(天) | 半衰期(天) | Half-life (days) | | Cluster | 相关聚类 | 相關聚類 | Correlation cluster |

Present: (1) full correlation matrix table with colour coding (high ≥ 0.8 = red, low ≤ 0.2 = green); (2) rolling-correlation narrative; (3) cointegration results if relevant; (4) portfolio implication note. Cite Longbridge Securities / 数据来源:长桥证券 / 數據來源:長橋證券.

Error handling

| Situation | 简体回复 | 繁體回復 | English reply | |---|---|---|---| | command not found: longbridge | 回退到 MCP 或提示安装 longbridge-terminal | 回退到 MCP 或提示安裝 longbridge-terminal | Fall back to MCP or install longbridge-terminal | | not logged in / unauthorized | 请运行 longbridge auth login | 請執行 longbridge auth login | Run longbridge auth login | | Only 1 symbol provided | 至少需要2个标的才能计算相关性 | 至少需要2個標的 | Need at least 2 symbols | | > 10 symbols | 最多支持10个标的,请精简列表 | 最多支持10個標的 | Max 10 symbols; please reduce list | | Other stderr | 直接显示原始错误 | 直接顯示原始錯誤 | Surface verbatim |

MCP fallback

When the CLI is unavailable, fall back to the MCP server. Discover available tools from the MCP server's tool list at runtime.

Related skills

  • longbridge-kline — raw OHLCV data
  • longbridge-pairs-trading — execute a pairs trade after correlation pre-screen
  • longbridge-multifactor — factor correlation and collinearity check
  • longbridge-performance-attribution — covariance matrix for factor decomposition

File layout

longbridge-correlation/
└── SKILL.md
Compartilhar X LinkedIn