首页/金融与投资/stock-liquidity
S

stock-liquidity

by @himself65v
4.5(50)

流动性分析,涵盖买卖价差、成交量分布、市场影响及Amihud比率计算。

stock-liquidityfinanceanalysisGitHub
安装方式
npx skills add himself65/finance-skills
compare_arrows

Before / After 效果对比

1
使用前

手动收集数据、整理报表,效率低且容易遗漏关键指标

使用后

一键获取专业分析,数据实时更新,覆盖多维度指标

description SKILL.md


name: stock-liquidity description: > Analyze stock liquidity using bid-ask spreads, volume profiles, order book depth, market impact estimates, and turnover ratios via Yahoo Finance data. Use this skill whenever the user asks about liquidity, trading costs, bid-ask spread, market depth, volume analysis, slippage, market impact, turnover ratio, or how easy/hard it is to trade a stock without moving the price. Triggers: "how liquid is AAPL", "bid-ask spread", "volume analysis", "order book depth", "market impact of a large order", "turnover ratio", "slippage estimate", "can I trade 100k shares without moving the price", "liquidity comparison", "spread analysis", "ADTV", "Amihud illiquidity", "dollar volume", "execution cost estimate", "liquidity score", penny stocks, small caps, or thinly traded securities.

Stock Liquidity Analysis Skill

Analyzes stock liquidity across multiple dimensions — bid-ask spreads, volume patterns, order book depth, estimated market impact, and turnover ratios — using data from Yahoo Finance via yfinance.

Liquidity matters because it determines the real cost of trading. The quoted price is not what you actually pay — spreads, slippage, and market impact all eat into returns, especially for larger positions or less liquid names.

Important: This is for research and educational purposes only. Not financial advice. yfinance is not affiliated with Yahoo, Inc.


Step 1: Ensure Dependencies Are Available

Current environment status:

!`python3 -c "import yfinance, pandas, numpy; print(f'yfinance={yfinance.__version__} pandas={pandas.__version__} numpy={numpy.__version__}')" 2>/dev/null || echo "DEPS_MISSING"`

If DEPS_MISSING, install required packages:

import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance", "pandas", "numpy"])

If already installed, skip and proceed.


Step 2: Route to the Correct Sub-Skill

Classify the user's request and jump to the matching section. If the user asks for a general liquidity assessment without specifying a particular metric, run Sub-Skill A (Liquidity Dashboard) which computes all key metrics together.

User RequestRoute ToExamples
General liquidity check, "how liquid is X"Sub-Skill A: Liquidity Dashboard"how liquid is AAPL", "liquidity analysis for TSLA", "is this stock liquid enough"
Bid-ask spread, trading costs, effective spreadSub-Skill B: Spread Analysis"bid-ask spread for AMD", "what's the spread on NVDA options", "trading cost estimate"
Volume, ADTV, dollar volume, volume profileSub-Skill C: Volume Analysis"volume analysis MSFT", "average daily volume", "volume profile for SPY"
Order book depth, market depth, level 2Sub-Skill D: Order Book Depth"order book depth for AAPL", "market depth", "show me the book"
Market impact, slippage, execution cost for large ordersSub-Skill E: Market Impact"how much would 50k shares move the price", "slippage estimate", "market impact of $1M order"
Turnover ratio, trading activity relative to floatSub-Skill F: Turnover Ratio"turnover ratio for GME", "float turnover", "how actively traded is this"
Compare liquidity across multiple stocksSub-Skill A (multi-ticker mode)"compare liquidity AAPL vs TSLA", "which is more liquid AMD or INTC"

Defaults

ParameterDefault
Lookback period3mo (3 months)
Data interval1d (daily)
Market impact modelSquare-root model
Intraday interval (when needed)5m

Sub-Skill A: Liquidity Dashboard

Goal: Produce a comprehensive liquidity snapshot combining all key metrics for one or more tickers.

A1: Fetch data and compute all metrics

import yfinance as yf
import pandas as pd
import numpy as np

def liquidity_dashboard(ticker_symbol, period="3mo"):
    ticker = yf.Ticker(ticker_symbol)
    info = ticker.info
    hist = ticker.history(period=period)

    if hist.empty:
        return None

    # --- Spread metrics (from current quote) ---
    bid = info.get("bid", None)
    ask = info.get("ask", None)
    current_price = info.get("currentPrice") or info.get("regularMarketPrice") or hist["Close"].iloc[-1]

    spread = None
    spread_pct = None
    if bid and ask and bid > 0 and ask > 0:
        spread = round(ask - bid, 4)
        midpoint = (ask + bid) / 2
        spread_pct = round((spread / midpoint) * 100, 4)

    # --- Volume metrics ---
    avg_volume = hist["Volume"].mean()
    median_volume = hist["Volume"].median()
    avg_dollar_volume = (hist["Close"] * hist["Volume"]).mean()
    volume_std = hist["Volume"].std()
    volume_cv = volume_std / avg_volume if avg_volume > 0 else None  # coefficient of variation

    # --- Turnover ratio ---
    shares_outstanding = info.get("sharesOutstanding", None)
    float_shar

forum用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价

统计数据

安装量500
评分4.5 / 5.0
版本
更新日期2026年4月6日
对比案例1 组

用户评分

4.5(50)
5
0%
4
0%
3
0%
2
0%
1
0%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code

时间线

创建2026年4月6日
最后更新2026年4月6日