GitHub - SO2304/toxiflow · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
SO2304
toxiflow
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>5 Commits<br>5 Commits
docs
docs
.gitignore
.gitignore
CHANGELOG.md
CHANGELOG.md
LICENSE
LICENSE
README.md
README.md
RELEASE_NOTES_v0.6.4.md
RELEASE_NOTES_v0.6.4.md
View all files
Repository files navigation
Toxiflow
v0.6.4 — a pre-trade microstructure execution layer in Rust.
Toxiflow measures the adverse-selection cost of order fills — toxic<br>flow — and gates, sizes, or refuses order placement on that signal,<br>before orders reach the exchange .
It is not a trading strategy and does not generate alpha. It is the<br>layer that sits between a signal source and the venue: you point<br>your own order flow at it, and it defends that flow against adverse<br>selection with a graded response —
full size → continuous size attenuation → discrete refusal → kill-switch
Toxiflow ships with a runnable end-to-end harness — demo signal<br>sources, a mock and a live executor, a live dashboard — so it runs out<br>of the box. But the product is the gate , not the demo strategies.
Licensing. Toxiflow is proprietary software —<br>LicenseRef-Toxiflow-Proprietary-1.0, see LICENSE.<br>This repository distributes release binaries and operator<br>documentation . Source access is licensed separately.<br>Contact: souhaybrharrab@gmail.com
Quick start (release binary)
Download from the<br>Releases page:
Platform<br>Layer binary<br>Self-check
Windows x86-64<br>toxiflow.exe<br>toxiflow-selfcheck.exe
Linux x86-64 — static musl, no glibc<br>toxiflow-linux-musl<br>toxiflow-selfcheck-linux-musl
The binaries are not code-signed . Verify the SHA-256 of every<br>download against<br>RELEASE_NOTES_v0.6.4.md before running it<br>(Get-FileHash on Windows, sha256sum on Linux). On Linux,<br>chmod +x the binary first.
Then validate the deployment before going live:
# 1. Pre-flight self-check — drives the whole stack in-process<br>TOXIFLOW_HTTP_PORT=8765 ./toxiflow-selfcheck<br># → prints a 16-check report, exit 0 = OK to deploy
# 2. Dev demo run (mock executor, synthetic candles, live dashboard)<br>TOXIFLOW_HTTP_PORT=8765 ./toxiflow<br># → http://127.0.0.1:8765/ HTML dashboard<br># → http://127.0.0.1:8765/health JSON snapshot<br># → http://127.0.0.1:8765/metrics Prometheus text
toxiflow-selfcheck prints a cargo test-style report — one line per<br>shipped wire — and exits 0 (PASS) or 1 (FAIL). The PASS/FAIL<br>aggregator is itself a formally-checked module, so a green light is<br>trustworthy by construction:
[PASS] boot_wire_audit emits stable grep token<br>[PASS] MAR-1 STP refused opposite-side signal<br>[PASS] flow EWMA consumes Candle.taker_buy_base_volume<br>[PASS] microstructure gate refused orders in opposing flow<br>[PASS] hysteresis keeps gate refusing in hover zone (no flapping)<br>[PASS] attenuator shrinks size in mid-band opposing flow<br>[PASS] consecutive-adverse alert rising-edge fired exactly once<br>... (16 checks total)<br>──────<br>pass=16 fail=0 skipped=0 total=16<br>OVERALL: PASS
The microstructure layer
Component<br>What it does
Mark-out tracker<br>Per-side realised adverse-selection cost at a 10 s horizon — the CEX analogue of LVR (Milionis-Moallemi-Roughgarden-Zhang 2022; Cartea-Drissi 2023).
Flow EWMA<br>Normalised kline signed flow ∈ [-1, +1] — kline-resolution Order Flow Imbalance proxy (Cont-Cucuringu-Zhang 2023).
Gate<br>Discrete refusal of orders flagged AdverseSelection or FlowConflict, with a sticky hysteresis layer that prevents threshold flapping.
Attenuator<br>Continuous order-size shrink before the gate's hard refusal — the graded complement to the discrete wall.
Consecutive-adverse<br>Burst detector + one-shot Telegram alert at a configurable streak threshold.
Enforcement mode<br>Observe (shadow — compute + count, never block) vs Enforce (production).
Every order — wherever the signal came from — travels:<br>risk → MAR-1 self-trade prevention → microstructure gate →<br>attenuator → place. All of it is visible on /metrics, /health,<br>and the embedded HTML...