use-return 0.1.0

Primitive quantitative return vocabulary for RustUse
Documentation
  • Coverage
  • 96.77%
    30 out of 31 items documented1 out of 16 items with examples
  • Size
  • Source code size: 12.62 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 720.61 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-quant
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-return

Primitive quantitative return vocabulary for RustUse.

use-return stores finite f64 return values and provides tiny helpers for simple and log returns from start/end prices.

Example

use use_return::{LogReturn, ReturnKind, SimpleReturn};

let simple = SimpleReturn::from_prices(100.0, 105.0)?;
let log = LogReturn::from_prices(100.0, 105.0)?;
let kind: ReturnKind = "simple".parse()?;

assert!((simple.value() - 0.05).abs() < 1.0e-12);
assert!(log.value() > 0.0);
assert_eq!(kind.to_string(), "simple");
# Ok::<(), Box<dyn std::error::Error>>(())

Scope

Use this crate for return values and obvious price-to-return calculations. It does not implement performance analytics, fee/tax accounting, advice, or strategy logic.

License

Licensed under either MIT or Apache-2.0.