Langsung ke konten
Skillpedia
Analisis & spreadsheet37k Β· #7518

execution-model

Fungsinya

Skill ini menambahkan biaya trading yang realistis ke backtest, seperti slippage, dampak harga, dan penundaan. Skill ini untuk trader yang menginginkan hasil simulasi yang lebih dekat dengan apa yang terjadi di pasar nyata.

Kapan dipakai

  • βœ“Saat sebuah backtest terlihat terlalu bagus dan Anda curiga ia mengabaikan biaya trading.
  • βœ“Saat Anda ingin memodelkan bagaimana order besar akan menggerakkan harga.
  • βœ“Saat Anda ingin backtest mencerminkan jeda antara sinyal dan eksekusi.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/execution-model/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œJalankan ulang backtest ini dengan slippage yang realistis dan penundaan eksekusi satu bar, lalu tunjukkan bagaimana hasilnya berubah.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memakai fungsi bantu yang sudah diuji untuk menambahkan biaya slippage tetap, perkiraan dampak pasar, atau penundaan pada setiap transaksi simulasi. Agent lalu menjalankan ulang backtest agar Anda bisa membandingkan hasil sebelum dan sesudahnya. Ini hanya berlaku untuk backtest simulasi, bukan trading langsung.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Apakah ini menempatkan transaksi sungguhan?

Tidak. Ini hanya mengubah asumsi di dalam backtest dan tidak menempatkan order langsung.

Apa itu dampak pasar?

Pergerakan harga yang disebabkan oleh order besar, yang cenderung meningkat seiring ukuran transaksi.

Mengapa menambahkan penundaan eksekusi?

Sinyal tidak bisa langsung dieksekusi pada saat ia muncul, sehingga penundaan membuat simulasi lebih jujur.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
37k
Peringkat
#7518
Lisensi
MIT
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa