WICKTRIQ
A system that scans the market with ICT concepts, grades setups, tests them on history and carries a trade from signal to close.
- Fintech / trading automation
- Python / pandas / numpy / ccxt / Bybit V5 API / PostgreSQL 16 / FastAPI / PWA + lightweight-charts / Telegram Bot / Claude API / Docker Compose / pytest





Problem
Reading market structure by hand is slow and never quite the same twice. An idea is hard to test on history, and in live trading the costliest mistakes are technical: a duplicate order, a loss limit forgotten after a restart.
Solution
One pipeline from candles to a closed trade. Detectors follow a written rulebook and use closed candles only; the backtest runs the very same detectors. A chain of risk checks sits in front of every order.
- 675
- Python files
- ~145k
- lines of code
- 1 336
- commits in a year
- 350
- test files
- ~2 500
- test functions
- 16
- instruments scanned
- 232
- setups in the research registry
- 9
- checks before an order
Signal path
From candles to a closed trade a signal passes eight steps. Each step is its own module.
Data
- USDT perpetual candles through ccxt, cached
- Closed candles only, never the forming one
- Timeframes from 5 minutes to a day
Structure
- Swings, BOS and CHoCH
- 4h direction and premium / discount zones
- OTE 0.62–0.79, the impulse leg
Liquidity
- EQH / EQL, BSL / SSL, daily and weekly highs
- Liquidity sweeps and their classification
- A sweep against the trade blocks entry or closes the position
POI
- FVG, order block, breaker and rejection block zones
- A displacement filter for order blocks
- First Trouble Area on the way to target
Confirmation
- A touch of the higher-timeframe zone
- A structure shift on the lower timeframe
- A new zone and its retest
Grading
- A confluence score and an A / B / C / F grade
- A and B go to auto-execution, C is alert-only
- An AI entry review as an adviser: off / shadow / gate
Risk
- A daily loss limit in R, read from the database so it survives restarts
- Risk per trade of 0.5–2% depending on score
- One trade per symbol, five positions at most, stop no wider than 2%
Execution
- Bybit V5 through a hand-written client, testnet or mainnet
- Intent is saved to the database before the order is sent
- An unclear exchange response is reconciled, never resent
Modules
- Scanner
- A loop over 16 instruments: direction, zones, confirmation, grade. Signal statuses: entry_pending → claimed → position_entered → closed
- Backtest
- A replay of production logic on history with no look-ahead, A/B comparisons, multi-day runs in CI
- Research
- An optimizer with in-sample / out-of-sample and walk-forward; metrics from profit factor to Sharpe; bootstrap, placebo runs, a double-cost stress test
- Dashboard
- A PWA on FastAPI: positions with live prices, setups, history, charts, logs, diagnostics, manual close
- Notifications
- Telegram: an entry message with a chart and a risk/reward box, an exit message with day and week totals, a queue with retries
Integrations
- Bybit V5 API
- Orders on USDT perpetuals through a custom HMAC client; a public WebSocket for live prices
- ccxt
- Market data from Bybit and Binance
- Dukascopy / yfinance
- Forex and index history for research
- Telegram Bot API
- Entry and exit notifications with a chart
- Claude API
- AI entry review; advisory by default
- PostgreSQL 16
- Signals, positions, trade history, journal
- lightweight-charts
- Charts in the dashboard
- GitHub Actions
- Tests on two Python versions, deploy, backtest runs
Architecture
- Python: 20 packages — analysis, data, trading, notifications, backtest, optimizer, research
- PostgreSQL 16 in production, SQLite locally, automatic schema migration
- The scanner as its own looping process; the FastAPI dashboard as a separate service
- Docker Compose with four services behind Caddy with automatic HTTPS
- Concurrency: a Postgres advisory lock, SELECT … FOR UPDATE, a partial unique index on positions
- CI: tests on Python 3.11 and 3.13 with coverage, deploy after tests, a separate backtest workflow
Engineering decisions
- Idempotent execution: intent and a stable order id are saved before sending, and state is reconciled with the exchange after a restart
- The daily loss limit is counted in R from the database. If the data cannot be read, entries are blocked
- Rounding to the price tick is never allowed to raise dollar risk
- The optimizer is kept apart from production but wraps the real detectors, so the backtest tests the same code
- Research rules are fixed in advance: placebo runs and a frozen selection against curve fitting
- The AI is advisory by default; in gate mode any failure of it lets the entry through instead of blocking trading
What was delivered
- Market structure: BOS, CHoCH, swings
- Liquidity and sweeps
- FVG, OB and breaker zones
- A 16-instrument scanner
- Setup grading
- Replay backtest
- Optimizer and walk-forward
- Bybit execution
- Paper mode
- A chain of risk checks
- PWA dashboard
- Telegram notifications
Need something similar?
Start a project