feat: Rust rewrite of Polymarket arbitrage bot with backtesting#7
Open
dsb4 wants to merge 3 commits intoGabagool2-2:mainfrom
Open
feat: Rust rewrite of Polymarket arbitrage bot with backtesting#7dsb4 wants to merge 3 commits intoGabagool2-2:mainfrom
dsb4 wants to merge 3 commits intoGabagool2-2:mainfrom
Conversation
Complete rewrite of rarb in Rust (rust-bot/). Key improvements: Architecture: - tokio async runtime with mpsc channels instead of asyncio callbacks - Arc<Mutex<>> for shared state with single-lock balance+circuit-breaker checks to eliminate the TOCTOU race in the Python version - All-Decimal arithmetic (no f64 mixing that caused precision loss) - Config loaded once as Arc<Config> — no global mutable singleton Fixes vs Python: - TOCTOU race: balance check and deduction now under single lock guard - Float precision: rust_decimal::Decimal throughout, no float conversions - Zombie WS: built into receive loop timeout (no separate watchdog task) - Global settings singleton replaced with immutable Arc<Config> New features: - Backtesting engine: fetches 1-min price history, simulates arb detection with 0.2% slippage + 1% fee model, computes Sharpe/drawdown/win-rate - Demo backtest with synthetic data (no API key needed): `rarb backtest --demo` - AUDIT.md: detailed security/accuracy audit of changes vs Python Crypto: - Native EIP-712 signing via k256 + sha3 (no Python FFI) - HMAC-SHA256 L2 auth via hmac + sha2 (auditable, no external client) CLI: `rarb run | backtest | config | status` https://claude.ai/code/session_01PsfoUzGqnBn1DSxM8x8Cw1
Covers quick start, config reference, CLI usage, backtest output example, architecture overview, and key design decisions. https://claude.ai/code/session_01PsfoUzGqnBn1DSxM8x8Cw1
Add detailed backtest section covering: - Demo vs live mode with concrete examples - Full flags table with defaults - Metric explanations (Sharpe, drawdown, win rate, etc.) - Simulation assumptions (slippage, fees, cooldown, capital constraint) - Tuning guidance using backtest results - JSON output schema with example https://claude.ai/code/session_01PsfoUzGqnBn1DSxM8x8Cw1
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.
Complete rewrite of rarb in Rust (rust-bot/). Key improvements:
Architecture:
Fixes vs Python:
New features:
rarb backtest --demoCrypto:
CLI:
rarb run | backtest | config | statushttps://claude.ai/code/session_01PsfoUzGqnBn1DSxM8x8Cw1