Skip to content

v0.4.1: Fix fractional volume truncation in OHLC and Spot ticks#9

Merged
mwlang merged 3 commits into
mainfrom
rc-0.4.1
May 17, 2026
Merged

v0.4.1: Fix fractional volume truncation in OHLC and Spot ticks#9
mwlang merged 3 commits into
mainfrom
rc-0.4.1

Conversation

@mwlang

@mwlang mwlang commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bug fix: base_volume and target_volume were coerced with .to_i in both Quant::Ticks::OHLC and Quant::Ticks::Spot, silently truncating fractional values. Changed to .to_f — crypto and many futures markets routinely express fractional volumes (e.g. 0.12345 BTC).
  • Regression specs: Added test blocks that assert both the value and the class (be_a(Float)) for fractional crypto-style volumes so future regressions fail loudly rather than being masked by Ruby's == coercion between Integer and Float.
  • Gemspec: Fixed changelog_uri to point directly to CHANGELOG.md in the repo.
  • Gitignore: Added .serena/ to .gitignore.

Test plan

  • bundle exec rspec spec/lib/quant/ticks/ohlc_spec.rb passes, including new fractional-volume context
  • bundle exec rspec spec/lib/quant/ticks/spot_spec.rb passes, including new fractional-volume context
  • bundle exec rspec full suite passes

Generated with Claude Code

Michael Lang and others added 3 commits May 16, 2026 20:13
Volumes were coerced with `.to_i`, silently truncating fractional values
common in crypto and futures markets (e.g. 0.12345 BTC). Changed to `.to_f`
in both Quant::Ticks::OHLC and Quant::Ticks::Spot initializers, added
regression specs that assert both value and class, updated changelog URI
in gemspec, and added .serena/ to .gitignore.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Volumes are now stored as Float; inspect output reflects that.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented May 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.15%. Comparing base (01bdb79) to head (1ce71c3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main       #9   +/-   ##
=======================================
  Coverage   99.15%   99.15%           
=======================================
  Files          75       75           
  Lines        2243     2243           
=======================================
  Hits         2224     2224           
  Misses         19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mwlang
mwlang merged commit 98173af into main May 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant