add quant alpha backtest workflow for better accuracy including an initialization of a quantitative trading algorithm#3
Open
ITheClixs wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Özet
Bu PR, mevcut MCP veya ajan mimarisini değiştirmeden BorsaCI’ye küçük, deterministik bir quant alpha iş akışı ekler.
Değişenler:
borsaci.quant_alphaeklendi.get_historical_dataOHLCV döndürdükten sonra alpha/backtest/ICT/tahmin istekleri mevcut ajan cevap akışına bağlandı.plotextbağımlılığı kullanılarak alpha ile al ve tut stratejisini karşılaştıran bir equity-curve görselleştirmesi eklendi.docs/quant_alpha_backtest.mdeklendi.Neden
BorsaCI zaten BIST tarihsel fiyatlarını çekiyor ve terminal grafikleri render ediyor. Bu değişiklik bu akışı olduğu gibi korur, ancak LLM nihai cevabı yazmadan önce yeniden üretilebilir bir yerel hesaplama katmanı ekler. Bu da kullanıcılara algoritmik/quantitative trading analizi sorduklarında doğrulanmamış bir anlatı yerine şeffaf metrikler verir.
Alpha skoru trend, momentum breakout, RSI bağlamı, volatilite/hacim displacement, ICT tarzı likidite sweep tespiti ve ICT tarzı fair value gap tespitini birleştirir.
Backtest, BIST nakit hisse senetleri için bilinçli olarak konservatiftir: long-only çalışır, negatif sinyallerde nakde çıkar ve her pozisyon değişiminde %0,20 ücret uygular.
Backtest kanıtı
Yeni motoru 2026-04-25 tarihinde güncel
BorsaMCP.get_historical_data(symbol, market="bist", period="5y")çıktıları üzerinde çalıştırdım. MCP şu anda bu 5 yıllık örnekler için 30 kaba OHLCV barı döndürüyor, bu yüzden motor lookback pencerelerini mevcut bar sayısına uyarlar ve kanıt, bağımsız bir trading sistemi olarak abartılmak yerine al ve tut ile yan yana gösterilir.Varsayımların tamamı
docs/quant_alpha_backtest.mdiçinde dokümante edilmiştir.Doğrulama
uv run python -m unittest discover -s testsperiod="5y"ileget_historical_datakullanan gerçek MCP smoke runNotlar
Bu yalnızca araştırma amaçlı bir araçtır ve oluşturulan rapor bunun yatırım tavsiyesi olmadığını açıkça belirtir. Özellik özellikle yerel sinyal üretimi ve backtest metrikleriyle sınırlandırılmıştır, böylece incelenmesi ve bakımı kolay kalır.
Summary
This PR adds a small, deterministic quant alpha workflow to BorsaCI without changing the existing MCP or agent architecture.
What changed:
borsaci.quant_alpha, a dependency-free alpha/backtest module for BIST OHLCV data.get_historical_datareturns OHLCV.plotextdependency.docs/quant_alpha_backtest.mdwith real MCP-backed sample results.Why
BorsaCI already retrieves BIST historical prices and renders terminal charts. This change keeps that flow intact, but adds a reproducible local calculation layer before the LLM writes the final response. That gives users transparent metrics instead of an unverified narrative when they ask for algorithmic/quantitative trading analysis.
The alpha score combines trend, momentum breakout, RSI context, volatility/volume displacement, ICT-style liquidity sweep detection, and ICT-style fair value gap detection.
The backtest is intentionally conservative for BIST cash equities: it is long-only, exits to cash on negative signals, and charges 0.20% on each position change.
Backtest evidence
I ran the new engine on current
BorsaMCP.get_historical_data(symbol, market="bist", period="5y")outputs on 2026-04-25. The MCP currently returns 30 coarse OHLCV bars for these 5-year samples, so the engine adapts lookback windows to the available bar count and the evidence is shown beside buy-and-hold rather than overstated as a standalone trading system.The full assumptions are documented in
docs/quant_alpha_backtest.md.Validation
uv run python -m unittest discover -s testsget_historical_datafor ASELS, THYAO, and GARAN withperiod="5y"Notes
This is research tooling only and the generated report explicitly states that it is not investment advice. The feature is intentionally scoped to local signal generation and backtest metrics so it remains easy to review and maintain.