https://github.com/dozken/ibkr-trader-core
Shariah-compliant IBKR trading bot framework with pluggable Strategy interface (open-core)
https://github.com/dozken/ibkr-trader-core
aaoifi algotrading fastapi halal ibkr interactive-brokers open-core python quant react shariah trading-bot
Last synced: 18 days ago
JSON representation
Shariah-compliant IBKR trading bot framework with pluggable Strategy interface (open-core)
- Host: GitHub
- URL: https://github.com/dozken/ibkr-trader-core
- Owner: dozken
- License: mit
- Created: 2026-05-19T18:25:23.000Z (28 days ago)
- Default Branch: main
- Last Pushed: 2026-05-28T20:24:06.000Z (19 days ago)
- Last Synced: 2026-05-28T20:25:40.867Z (19 days ago)
- Topics: aaoifi, algotrading, fastapi, halal, ibkr, interactive-brokers, open-core, python, quant, react, shariah, trading-bot
- Language: Python
- Homepage: https://github.com/dozken/ibkr-trader-core
- Size: 711 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: docs/SECURITY.md
Awesome Lists containing this project
README
# ibkr-trader-core
[](https://github.com/dozken/ibkr-trader-core/actions/workflows/ci.yml)
[](LICENSE)
[](https://www.python.org/downloads/)
[](https://fastapi.tiangolo.com/)
[](https://react.dev/)
Shariah-compliant trading bot framework for Interactive Brokers, with a pluggable strategy interface.
> Open-core of [ibkr-trader](https://github.com/dozken/ibkr-trader) — the framework is MIT, run it with the bundled SMA reference strategy or plug in your own.
## What you get
- **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 `Strategy` interface** — ship with SMA crossover and buy-and-hold reference impls, swap with your own via env var.
## What you don't get (by design)
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.
## Quick start
```bash
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 --build
```
Open for API, for UI.
By default uses `SMACrossover` strategy. To swap:
```bash
STRATEGY_CLASS=ibkr_core.strategies.buy_and_hold:BuyAndHold docker compose up
```
## Plug in your own strategy
```python
# 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:
```bash
STRATEGY_CLASS=my_alpha.strategy:MyAlpha docker compose up
```
See [`ibkr_core/core/strategy/base.py`](ibkr_core/core/strategy/base.py) for the full interface, or the [example momentum strategy](examples/momentum_strategy/) for a complete external plugin.
## Compliance
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`](docs/COMPLIANCE.md).
**Riba (interest), short selling, margin, and gharar-heavy instruments are blocked at the framework level — not just the strategy.**
## Project layout
```
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
```
## Status
Early beta (v0.3.x). Strategy interface is stable; other APIs may change before 1.0.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md). Bug fixes, new reference strategies, and compliance improvements welcome.
## License
MIT — see [LICENSE](LICENSE).