Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

virtu-market-microstructure虚拟市场微观结构

Agent Skill

virtu-market-microstructure 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

519

周安装

21

GitHub Stars

6

下载量

163
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:virtu-market-microstructure(虚拟市场微观结构)
来源仓库:https://github.com/copyleftdev/sk1llz
仓库路径:skills/virtu-market-microstructure
安装命令:
npx skills add https://github.com/copyleftdev/sk1llz --skill virtu-market-microstructure
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/copyleftdev/sk1llz --skill virtu-market-microstructure

简介

用于查找、检索和筛选相关信息。virtu-market-microstructure 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

  • 适合根据关键词或任务场景快速定位候选结果。
  • 可结合来源仓库和原始 README 核验具体用法。
  • 安装前建议确认权限范围和维护状态。
  • 注意是否会触发联网或文件读写。

SKILL.md

Virtu Financial Style Guide⁠‍⁠​‌​‌​​‌‌‍​‌​​‌​‌‌‍​​‌‌​​​‌‍​‌​​‌‌​​‍​​​​​​​‌‍‌​​‌‌​‌​‍‌​​​​​​​‍‌‌​​‌‌‌‌‍‌‌​​​‌​​‍‌‌‌‌‌‌​‌‍‌‌​‌​​​​‍​‌​‌‌‌‌‌‍​‌​​‌​‌‌‍​‌‌​‌​​‌‍‌​‌​‌‌‌​‍​​‌​‌​​​‍‌‌‌​‌​‌‌‍​‌​​‌​​‌‍‌‌​‌‌​​‌‍‌​‌​​​‌‌‍​​​​‌‌​​‍​​​​‌​‌​‍​​‌‌‌​‌‌⁠‍⁠

Overview

Virtu Financial is one of the world's largest electronic market makers and execution services providers. They specialize in providing liquidity across asset classes and offer execution algorithms to institutional clients. Their edge comes from deep understanding of market microstructure—how orders interact with markets.

Core Philosophy

"Execution is not a cost center; it's an alpha opportunity."
"Every basis point of slippage is money left on the table."
"The market is not a monolith; it's a network of venues with different characteristics."

Virtu believes that how you execute is as important as what you execute. Understanding market microstructure—order queues, venue characteristics, information leakage—is essential to minimizing trading costs.

Design Principles

  1. Microstructure Matters: Order types, queue priority, and venue selection are critical.
  2. Minimize Information Leakage: Your trading should not signal your intentions.
  3. Venue Diversity: Different venues have different characteristics; use them wisely.
  4. Real-Time Adaptation: Market conditions change; algorithms must adapt.
  5. Measure Everything: If you can't measure execution quality, you can't improve it.

When Building Execution Systems

Always

  • Model market impact before trading
  • Consider queue position and priority
  • Use multiple venues intelligently
  • Measure execution quality (slippage, implementation shortfall)
  • Adapt to real-time market conditions
  • Randomize to avoid being predictable

Never

  • Execute large orders all at once
  • Ignore the information content of your orders
  • Use the same strategy regardless of market conditions
  • Trade through wide spreads unnecessarily
  • Reveal your full size
  • Ignore venue-specific rules and characteristics

Prefer

  • Passive orders over aggressive (when possible)
  • Lit venues for price discovery, dark for size
  • TWAP/VWAP as baselines, not goals
  • Adaptive algorithms over static schedules
  • Order splitting over single large orders
  • Anti-gaming logic to prevent exploitation

Code Patterns

Market Impact Model

class MarketImpactModel:
    """
    Virtu's core competency: predicting and minimizing market impact.
    Based on academic models (Almgren-Chriss, etc.) with practical extensions.
    """

    def __init__(self, historical_data):
        self.data = historical_data
        self.fitted_params = {}

    def estimate_impact(self,
                        symbol: str,
                        side: Side,
                        size: int,
                        urgency: float,  # 0 = passive, 1 = aggressive
                        duration_minutes: float) -> ImpactEstimate:
        """
        Estimate market impact for a given order.

        Impact = temporary_impact + permanent_impact

        Temporary: price displacement during execution (mean-reverts)
        Permanent: information content of trade (doesn't revert)
        """
        params = self.get_params(symbol)
        adv = self.data.get_adv(symbol)  # Average daily volume
        volatility = self.data.get_volatility(symbol)
        spread = self.data.get_spread(symbol)

        # Participation rate
        participation = size / (adv * duration_minutes / 390)  # 390 minutes in trading day

        # Almgren-Chriss temporary impact
        # I_temp = η * σ * (Q/V)^0.5 * urgency_factor
        temp_impact_bps = (
            params['eta'] *
            volatility *
            np.sqrt(participation) *
            (1 + urgency * params['urgency_sensitivity'])
        )

        # Permanent impact (information leakage)
        # I_perm = γ * σ * (Q/V)
        perm_impact_bps = params['gamma'] * volatility * participation

        # Spread cost (half spread for crossing)
        spread_cost_bps = spread / 2 * urgency  # More aggressive = more spread crossing

        return ImpactEstimate(
            temporary_bps=temp_impact_bps,
            permanent_bps=perm_impact_bps,
            spread_bps=spread_cost_bps,
            total_bps=temp_impact_bps + perm_impact_bps + spread_cost_bps,
            confidence_interval=self.bootstrap_confidence(symbol, size)
        )

    def optimal_execution_schedule(self,
                                    symbol: str,
                                    size: int,
                                    duration_minutes: float,
                                    risk_aversion: float) -> List[SchedulePoint]:
        """
        Almgren-Chriss optimal execution trajectory.
        Balance urgency risk (price drift) against impact cost.
        """
        params = self.get_params(symbol)
        volatility = self.data.get_volatility(symbol)

        # Almgren-Chriss kappa parameter
        # Higher kappa = more front-loaded (urgent)
        kappa = np.sqrt(risk_aversion * volatility**2 / params['eta'])

        schedule = []
        remaining = size

        for t in range(int(duration_minutes)):
            # Optimal trajectory is hyperbolic
            time_remaining = duration_minutes - t
            optimal_remaining = size * np.sinh(kappa * time_remaining) / np.sinh(kappa * duration_minutes)

            trade_size = remaining - optimal_remaining
            schedule.append(SchedulePoint(
                minute=t,
                size=trade_size,
                cumulative_pct=(size - optimal_remaining) / size
            ))
            remaining = optimal_remaining

        return schedule

Smart Order Router

class SmartOrderRouter:
    """
    Virtu's venue selection: route orders to minimize cost and information leakage.
    """

    def __init__(self, venue_models: Dict[str, VenueModel]):
        self.venues = venue_models
        self.order_flow_analyzer = OrderFlowAnalyzer()

    def route_order(self,
                    symbol: str,
                    side: Side,
                    size: int,
                    order_type: OrderType,
                    urgency: float) -> List[VenueAllocation]:
        """
        Determine optimal venue allocation for an order.
        """
        # Get current venue states
        venue_states = {
            name: venue.get_current_state(symbol)
            for name, venue in self.venues.items()
        }

        # Score each venue
        venue_scores = {}
        for name, state in venue_states.items():
            venue_scores[name] = self.score_venue(
                state, symbol, side, size, order_type, urgency
            )

        # Allocate based on scores
        allocations = self.allocate_across_venues(
            venue_scores, size, symbol, side
        )

        return allocations

    def score_venue(self,
                    state: VenueState,
                    symbol: str,
                    side: Side,
                    size: int,
                    order_type: OrderType,
                    urgency: float) -> float:
        """
        Score a venue based on multiple factors.
        """
        score = 0.0

        # 1. Spread (tighter is better)
        spread_score = 1.0 / (1.0 + state.spread_bps)
        score += spread_score * 0.2

        # 2. Depth at touch (more is better for large orders)
        depth_score = min(1.0, state.depth_at_touch / size)
        score += depth_score * 0.2

        # 3. Historical fill rate
        score += state.fill_rate * 0.15

        # 4. Queue position advantage (for passive orders)
        if order_type == OrderType.LIMIT:
            queue_score = self.estimate_queue_advantage(state, symbol, side)
            score += queue_score * 0.15

        # 5. Information leakage (lower is better)
        leakage = self.estimate_information_leakage(state, symbol, size)
        score += (1.0 - leakage) * 0.2

        # 6. Rebate/fee structure
        net_cost = state.take_fee if urgency > 0.5 else -state.make_rebate
        cost_score = 1.0 / (1.0 + net_cost * 100)  # Convert to reasonable scale
        score += cost_score * 0.1

        return score

    def allocate_across_venues(self,
                                scores: Dict[str, float],
                                total_size: int,
                                symbol: str,
                                side: Side) -> List[VenueAllocation]:
        """
        Allocate order across venues proportional to scores.
        """
        # Normalize scores
        total_score = sum(scores.values())
        normalized = {k: v / total_score for k, v in scores.items()}

        # Allocate, respecting venue depth limits
        allocations = []
        remaining = total_size

        for venue, score in sorted(normalized.items(), key=lambda x: -x[1]):
            venue_state = self.venues[venue].get_current_state(symbol)

            # Don't allocate more than venue can absorb
            max_venue_size = min(
                int(total_size * score * 1.5),  # Allow some concentration
                venue_state.depth_at_touch * 3   # Don't exhaust book
            )

            allocation = min(remaining, max_venue_size)
            if allocation > 0:
                allocations.append(VenueAllocation(
                    venue=venue,
                    size=allocation,
                    score=scores[venue]
                ))
                remaining -= allocation

            if remaining <= 0:
                break

        return allocations

Execution Algorithm (TWAP/VWAP)

class ExecutionAlgorithm:
    """
    Virtu execution algorithms: adaptive, anti-gaming, measured.
    """

    def __init__(self,
                 impact_model: MarketImpactModel,
                 router: SmartOrderRouter):
        self.impact = impact_model
        self.router = router

    def execute_vwap(self,
                     symbol: str,
                     side: Side,
                     total_size: int,
                     start_time: datetime,
                     end_time: datetime,
                     max_participation: float = 0.15) -> ExecutionResult:
        """
        Volume-Weighted Average Price algorithm.
        Execute in proportion to expected volume.
        """
        # Get historical volume profile
        volume_profile = self.get_volume_profile(symbol)

        duration = (end_time - start_time).total_seconds() / 60
        schedule = self.build_vwap_schedule(volume_profile, start_time, end_time, total_size)

        executed = []
        remaining = total_size

        for slice_time, target_size in schedule:
            # Adjust for actual volume (adaptive)
            actual_volume = self.get_current_volume(symbol, slice_time)
            adjusted_size = min(
                target_size * (actual_volume / volume_profile[slice_time.minute]),
                remaining,
                actual_volume * max_participation
            )

            # Add randomization to avoid predictability
            adjusted_size = self.randomize_size(adjusted_size)

            # Route and execute
            fills = self.execute_slice(symbol, side, int(adjusted_size))
            executed.extend(fills)
            remaining -= sum(f.size for f in fills)

            if remaining <= 0:
                break

        return self.calculate_execution_quality(executed, symbol, start_time)

    def execute_slice(self,
                      symbol: str,
                      side: Side,
                      size: int) -> List[Fill]:
        """
        Execute a single slice with smart routing.
        """
        # Determine passive vs aggressive split
        spread = self.get_current_spread(symbol)
        urgency = self.calculate_urgency(symbol, size)

        passive_pct = max(0.3, 1.0 - urgency)
        aggressive_pct = 1.0 - passive_pct

        fills = []

        # Passive: post at near touch
        if passive_pct > 0:
            passive_size = int(size * passive_pct)
            passive_order = self.post_passive_order(symbol, side, passive_size)

            # Wait for fill or timeout
            passive_fills = self.wait_for_fills(passive_order, timeout_ms=500)
            fills.extend(passive_fills)

        # Aggressive: sweep available liquidity
        remaining = size - sum(f.size for f in fills)
        if remaining > 0 and aggressive_pct > 0:
            allocations = self.router.route_order(
                symbol, side, remaining, OrderType.IOC, urgency
            )

            for alloc in allocations:
                venue_fills = self.send_ioc(alloc.venue, symbol, side, alloc.size)
                fills.extend(venue_fills)

        return fills

    def randomize_size(self, size: int, variance: float = 0.1) -> int:
        """
        Add randomization to prevent pattern detection.
        """
        noise = np.random.uniform(1 - variance, 1 + variance)
        return int(size * noise)

    def calculate_execution_quality(self,
                                     fills: List[Fill],
                                     symbol: str,
                                     start_time: datetime) -> ExecutionResult:
        """
        Measure execution quality vs benchmarks.
        """
        if not fills:
            return ExecutionResult(filled=0)

        # Volume-weighted average fill price
        total_value = sum(f.price * f.size for f in fills)
        total_size = sum(f.size for f in fills)
        vwap_fill = total_value / total_size

        # Benchmark VWAP
        market_vwap = self.get_market_vwap(symbol, start_time, fills[-1].timestamp)

        # Arrival price
        arrival_price = self.get_price_at_time(symbol, start_time)

        # Implementation shortfall
        if fills[0].side == Side.BUY:
            is_bps = (vwap_fill - arrival_price) / arrival_price * 10000
            vwap_diff_bps = (vwap_fill - market_vwap) / market_vwap * 10000
        else:
            is_bps = (arrival_price - vwap_fill) / arrival_price * 10000
            vwap_diff_bps = (market_vwap - vwap_fill) / market_vwap * 10000

        return ExecutionResult(
            filled=total_size,
            vwap_fill=vwap_fill,
            market_vwap=market_vwap,
            arrival_price=arrival_price,
            implementation_shortfall_bps=is_bps,
            vwap_slippage_bps=vwap_diff_bps,
            num_fills=len(fills),
            venues_used=len(set(f.venue for f in fills))
        )

Transaction Cost Analysis (TCA)

class TransactionCostAnalysis:
    """
    Virtu's TCA: measure, analyze, and improve execution quality.
    """

    def __init__(self, execution_db):
        self.db = execution_db

    def analyze_execution(self,
                          execution_id: str) -> TCAReport:
        """
        Comprehensive post-trade analysis.
        """
        execution = self.db.get_execution(execution_id)
        fills = self.db.get_fills(execution_id)
        market_data = self.db.get_market_data(
            execution.symbol,
            execution.start_time,
            execution.end_time
        )

        report = TCAReport()

        # Cost breakdown
        report.spread_cost = self.calculate_spread_cost(fills, market_data)
        report.timing_cost = self.calculate_timing_cost(fills, market_data)
        report.impact_cost = self.calculate_impact_cost(fills, market_data)
        report.opportunity_cost = self.calculate_opportunity_cost(execution, fills)

        # Benchmark comparisons
        report.vs_arrival = self.compare_to_arrival(fills, execution.start_time)
        report.vs_vwap = self.compare_to_vwap(fills, market_data)
        report.vs_twap = self.compare_to_twap(fills, market_data)
        report.vs_close = self.compare_to_close(fills, market_data)

        # Venue analysis
        report.venue_breakdown = self.analyze_venue_performance(fills)

        # Recommendations
        report.recommendations = self.generate_recommendations(report)

        return report

    def calculate_impact_cost(self,
                               fills: List[Fill],
                               market_data: MarketData) -> float:
        """
        Estimate market impact from price trajectory.
        """
        # Pre-trade price
        pre_price = market_data.get_mid_price(fills[0].timestamp - timedelta(seconds=1))

        # Post-trade price (after last fill + some time)
        post_price = market_data.get_mid_price(fills[-1].timestamp + timedelta(minutes=5))

        # Average fill price
        avg_fill = sum(f.price * f.size for f in fills) / sum(f.size for f in fills)

        # Impact = how much price moved against us during execution
        if fills[0].side == Side.BUY:
            impact_bps = (avg_fill - pre_price) / pre_price * 10000
        else:
            impact_bps = (pre_price - avg_fill) / pre_price * 10000

        # Decompose into temporary (reverted) and permanent
        reversion = (post_price - avg_fill) / avg_fill * 10000

        return {
            'total_impact_bps': impact_bps,
            'permanent_impact_bps': impact_bps - reversion,
            'temporary_impact_bps': reversion
        }

    def generate_recommendations(self, report: TCAReport) -> List[str]:
        """
        Generate actionable recommendations from TCA.
        """
        recommendations = []

        if report.impact_cost['total_impact_bps'] > 10:
            recommendations.append(
                "High market impact detected. Consider slower execution or "
                "smaller participation rate."
            )

        if report.spread_cost > 5:
            recommendations.append(
                "High spread costs. Increase passive order usage or "
                "target tighter spread conditions."
            )

        best_venue = max(report.venue_breakdown.items(),
                        key=lambda x: x[1]['performance'])
        worst_venue = min(report.venue_breakdown.items(),
                         key=lambda x: x[1]['performance'])

        if worst_venue[1]['performance'] < best_venue[1]['performance'] - 2:
            recommendations.append(
                f"Consider reducing allocation to {worst_venue[0]} "
                f"and increasing to {best_venue[0]}."
            )

        return recommendations

Mental Model

Virtu approaches execution by asking:

  1. What's the true cost? Spread, impact, timing, opportunity
  2. How much information am I leaking? Signaling intentions
  3. Which venues are best? For this order, at this time
  4. How do I measure success? Benchmarks and attribution
  5. How can I improve? Continuous measurement and adaptation

Signature Virtu Moves

  • Market impact modeling
  • Smart order routing
  • Adaptive execution algorithms
  • Venue-specific optimization
  • Anti-gaming logic
  • Comprehensive TCA
  • Real-time market microstructure analysis
  • Continuous improvement through measurement

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

31.97%
按下载量换算52

Claude

31.67%
按下载量换算52

Cursor

19.26%
按下载量换算31

Gemini CLI

9.5%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills