Rewrites the core pricing functions to evaluate each leg individually through the policy engine rather than grouping by transaction and computing net ratios. Changes: - fetch_raw_trades → fetch_raw_legs: returns per-leg data with pool info, deltas, post-state reserves, and sequence numbers - aggregate_raw_trades: now takes per-leg data and folds through the policy for each leg; judges acceptance, updates state, and accumulates OHLC - candlesticks: creates a Policy instance with default params (F=5, q=5%), passes it through the aggregation pipeline Key behaviors: - Volume ALWAYS counted (both accepted and muted legs) - OHLC updated ONLY for accepted legs - transaction_count = unique txids in interval - Carry-forward logic for intervals with no accepted prints - Policy state maintained and updated per-leg across the full window Tests: 222 passing (5 new policy tests + 217 existing candle/ohlcv/price tests) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .vscode | ||
| contrib | ||
| internal | ||
| linters | ||
| src | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
Riftenlabs Indexer
RiftenLabs indexer is for indexing DeFi contracts by Riften Labs. It allows for querying historical on-chain data on Bitcoin Cash.
Contributing
All contributors are required to sign a Contributor License Agreement (CLA) before their contributions can be merged into the project.
Contributions are generally welcome. If you intend to make larger changes please discuss them in an issue before MRing them to avoid duplicate work and architectural mismatches.
Installing Rust
Rust can be installed using your package manager of choice or rustup.rs. The former way is considered more secure since it typically doesn't involve trust in the CA system. But you should be aware that the version of Rust shipped by your distribution might be out of date.
Building
The library can be built and tested using cargo:
git clone https://gitlab.com/riftenlabs/riftenlabs-indexer.git
cd riftenlabs-indexer
cargo build
You can run tests with:
cargo test