Shariah-compliant trading bot framework for Interactive Brokers, with a pluggable strategy interface.
Open-core of ibkr-trader — the framework is MIT, run it with the bundled SMA reference strategy or plug in your own.
Coming soon — add to docs/screenshots/ and link here once deployment screenshots are captured.
- FastAPI backend + React frontend — full webapp with portfolio, settings, alerts, compliance, zakat pages.
- IBKR integration — order routing, reconciliation, account manager.
- AAOIFI Shariah screening — debt/cash/revenue ratio checks, sector blocklist, dynamic VIX-aware buffer.
- Zakat calculator — hawl tracking, purification of haram income.
- Multi-channel alerts — Telegram, email, Slack.
- Observability — Prometheus metrics + provisioned Grafana dashboard.
- Pluggable
Strategyinterface — ship with SMA crossover and buy-and-hold reference impls, swap with your own via env var.
This is the framework. The author's private alpha strategies (ML/RL signal models, tuned halal universe filters, trained weights) live in a separate proprietary repo. You can run this with the included reference strategies, or write your own.
git clone https://github.com/dozken/ibkr-trader-core.git
cd ibkr-trader-core
cp ibkr_core/.env.example ibkr_core/.env # then fill in your IBKR creds
docker compose up --buildOpen http://localhost:8000/docs for API, http://localhost:3000 for UI.
By default uses SMACrossover strategy. To swap:
STRATEGY_CLASS=ibkr_core.strategies.buy_and_hold:BuyAndHold docker compose up# my_alpha/strategy.py
from ibkr_core.core.strategy import Strategy, MarketContext
from ibkr_core.features.trading.schemas import TradeSignal
class MyAlpha(Strategy):
name = "MyAlpha"
async def generate_signals(self, ctx: MarketContext) -> list[TradeSignal]:
# your logic
return [...]Then run:
STRATEGY_CLASS=my_alpha.strategy:MyAlpha docker compose upSee ibkr_core/core/strategy/base.py for the full interface.
Screening follows AAOIFI Shariah standards (33% debt-to-asset, 33% cash-to-asset, 5% non-compliant revenue caps by default). Buffers tighten under VIX stress. See docs/COMPLIANCE.md.
Riba (interest), short selling, margin, and gharar-heavy instruments are blocked at the framework level — not just the strategy.
ibkr_core/
core/ framework primitives (db, auth, audit, websocket)
core/strategy/ Strategy ABC + plugin loader
strategies/ SMA + buy-and-hold reference impls
features/
compliance/ AAOIFI screening
zakat/ hawl + purification calc
trading/ IBKR integration, order routing
portfolio/ positions + P&L
alerts/ telegram / email / slack
settings/
migrations/ alembic
frontend/ React + Vite + Tailwind
infra/ prometheus + grafana provisioning
docs/ architecture + ops guides
Early. APIs may change before 1.0. See docs/ROADMAP.md if/when public.
MIT — see LICENSE.