본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트37k · #7518

execution-model

하는 일

이 스킬은 슬리피지, 가격 충격, 지연 같은 현실적인 거래 비용을 백테스트에 더합니다. 시뮬레이션 결과를 실제 시장에 가깝게 만들고 싶은 트레이더를 위한 스킬입니다.

사용하는 경우

  • ✓백테스트가 너무 좋아 보여서 거래 비용을 무시한 것 같을 때.
  • ✓큰 주문이 가격을 얼마나 움직일지 모델링하고 싶을 때.
  • ✓신호와 체결 사이의 지연을 백테스트에 반영하고 싶은 경우.

스킬 링크

https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/execution-model/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/execution-model/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 백테스트를 현실적인 슬리피지와 한 봉 체결 지연을 넣어 다시 실행하고, 결과가 어떻게 달라지는지 보여 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 검증된 보조 함수를 써서 각 모의 거래에 고정 슬리피지, 시장 충격 추정치, 또는 지연을 더합니다. 그다음 백테스트를 다시 실행해 적용 전후 결과를 비교할 수 있게 합니다. 이는 모의 백테스트에만 적용되며 실제 거래는 하지 않습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Trade Execution Modeling

Overview

Provide more realistic execution assumptions for backtests, including slippage models, market-impact estimation, and execution-algorithm principles. This skill is for backtest simulation only and does not involve live order execution.

Slippage Models

Why Slippage Models Are Needed

Idealized backtest: filled at the close, zero slippage
Real world:
1. The order book has a bid-ask spread
2. Large orders push prices (market impact)
3. Execution is delayed (there is latency from signal to fill)

No slippage model -> overly optimistic backtest -> losses in live trading

Do not retype these models. All four are implemented and tested in src/quantlib/impact.py; import them. The tested versions validate their inputs — a zero ADV raises instead of dividing by zero, and a negative delay_bars raises instead of silently introducing look-ahead bias.

from src.quantlib.impact import fixed_slippage, linear_impact, sqrt_impact, delayed_execution

1. Fixed Slippage Model

fixed_slippage(price=100.0, direction=1, bps=5.0)   # 100.05  (buy pays up)
fixed_slippage(price=100.0, direction=-1, bps=5.0)  #  99.95  (sell receives less)

direction is 1 to buy or -1 to sell, and must be exactly one of those — it multiplies the impact, so an unchecked 2 would silently double the modelled cost. bps defaults to DEFAULT_SLIPPAGE_BPS (5.0).

Reference fixed-slippage assumptions by market:

Market Instrument Suggested Slippage (bps) Notes
China A-share large cap CSI 300 constituents 3-5 Good liquidity
China A-share small cap CSI 1000 constituents 5-10 Average liquidity
China micro-cap market cap < 5 billion RMB 10-30 Poor liquidity
US large cap AAPL / MSFT 1-3 Excellent liquidity
Hong Kong stocks Hang Seng constituents 5-10 Less liquid than A / US
BTC spot BTC-USDT 2-5 Good OKX liquidity
ETH spot ETH-USDT 3-8 Slightly worse than BTC
Small altcoins other -USDT pairs 10-50 Liquidity varies widely

2. Linear Impact Model

impact = impact_coeff × volume_traded / adv

# 100k shares against 1M ADV = 10% participation; at coeff 0.1 that is a 1% move.
linear_impact(price=100.0, direction=1, volume_traded=100_000, adv=1_000_000, impact_coeff=0.1)
# 101.0

Marginal impact is constant here, which overstates the cost of very large orders. impact_coeff defaults to DEFAULT_LINEAR_IMPACT_COEFF (0.1).

Reference impact coefficients:

Market impact_coeff Notes
China A-share large cap 0.05-0.10 10% daily price-limit system
China A-share small cap 0.10-0.20 Liquidity premium
US equities 0.03-0.08 Market-maker buffering
Crypto 0.05-0.15 24h trading is dispersed

3. Square-Root Impact Model

impact = η × σ × sqrt(volume_traded / adv)

# 250k against 1M ADV = 25% participation; 0.5 × 0.02 × sqrt(0.25) = 0.005 = 50bps.
sqrt_impact(price=100.0, direction=1, volume_traded=250_000, adv=1_000_000,
            volatility=0.02, eta=0.5)
# 100.5  (100.49999999999999 in binary floating point)

volatility is daily return volatility as a decimal fraction. eta defaults to DEFAULT_SQRT_IMPACT_ETA (0.5); 0.3-0.8 is the usual calibrated range.

Advantages of the square-root model:

  • Strongest empirical support (standard in financial literature)
  • Marginal impact declines for larger orders (intuitive)
  • Parameters can be estimated from historical data

Naming. This impact term is often labelled "Almgren-Chriss", and it does come from that literature, but it is not Almgren-Chriss optimal execution. There is no trading trajectory, no permanent/temporary impact split and no risk-aversion parameter here, and none is implemented anywhere in this repository. Call it a square-root impact function, and do not claim an optimal schedule was computed.

Slippage Model Selection Decision Tree

Backtest capital vs instrument ADV:
├── Capital < 0.5% of ADV -> fixed slippage (5bps) is enough
├── Capital 0.5-5% -> linear impact model
└── Capital > 5% -> square-root impact model (required)

Execution Algorithm Principles

VWAP (Volume Weighted Average Price)

Goal: execute at the day's volume-weighted average price

VWAP = Σ(Price_i × Volume_i) / Σ(Volume_i)

Execution logic:
1. Forecast the intraday volum
자주 묻는 질문

이 스킬이 실제 거래를 하나요?

아닙니다. 백테스트 안의 가정만 바꾸며, 실거래 주문은 넣지 않습니다.

시장 충격이란 무엇인가요?

큰 주문이 가격을 움직이는 현상이며, 보통 거래 규모가 커질수록 커집니다.

왜 체결 지연을 더하나요?

신호가 나타난 순간에 바로 체결될 수는 없으므로, 지연을 넣으면 시뮬레이션이 더 정직해집니다.

상세 정보

작성자의 원본 설명

Trade execution modeling (backtest only) — slippage formulas (linear / square-root impact), VWAP/TWAP execution logic, market-impact cost estimation, and execution-assumption configuration.

repo: HKUDS/Vibe-Trading

인기도

GitHub 스타
37k
순위
#7518
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬