HtmlReportOptions

Struct HtmlReportOptions 

Source
pub struct HtmlReportOptions<'a> {
    pub benchmark: Option<&'a ReturnSeries>,
    pub rf: f64,
    pub grayscale: bool,
    pub title: String,
    pub output: Option<PathBuf>,
    pub compounded: bool,
    pub periods_per_year: u32,
    pub template_path: Option<PathBuf>,
    pub match_dates: bool,
    pub strategy_title: Option<String>,
    pub benchmark_title: Option<String>,
}

Fields§

§benchmark: Option<&'a ReturnSeries>§rf: f64§grayscale: bool§title: String§output: Option<PathBuf>§compounded: bool§periods_per_year: u32§template_path: Option<PathBuf>§match_dates: bool§strategy_title: Option<String>§benchmark_title: Option<String>

Implementations§

Source§

impl<'a> HtmlReportOptions<'a>

Source

pub fn with_benchmark(self, benchmark: &'a ReturnSeries) -> Self

Examples found in repository?
examples/html_with_benchmark.rs (line 11)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let strategy = common::demo_strategy();
8    let benchmark = common::demo_benchmark();
9
10    let options = HtmlReportOptions::default()
11        .with_benchmark(&benchmark)
12        .with_title("Quantstats-rs Demo Tearsheet (with Benchmark)")
13        .with_strategy_title("Strategy")
14        .with_benchmark_title("Benchmark Index")
15        .with_output("tearsheet_with_benchmark.html");
16
17    let html = html(&strategy, options)?;
18
19    println!(
20        "Generated HTML report with benchmark ({} bytes) at tearsheet_with_benchmark.html",
21        html.len()
22    );
23
24    Ok(())
25}
Source

pub fn with_output<P: AsRef<Path>>(self, path: P) -> Self

Examples found in repository?
examples/html_report.rs (line 12)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let series = common::demo_strategy();
8
9    let options = HtmlReportOptions::default()
10        .with_title("Quantstats-rs Demo Tearsheet")
11        .with_strategy_title("Demo Strategy")
12        .with_output("tearsheet.html");
13
14    let html = html(&series, options)?;
15
16    println!(
17        "Generated HTML report ({} bytes) at tearsheet.html",
18        html.len()
19    );
20
21    Ok(())
22}
More examples
Hide additional examples
examples/html_with_benchmark.rs (line 15)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let strategy = common::demo_strategy();
8    let benchmark = common::demo_benchmark();
9
10    let options = HtmlReportOptions::default()
11        .with_benchmark(&benchmark)
12        .with_title("Quantstats-rs Demo Tearsheet (with Benchmark)")
13        .with_strategy_title("Strategy")
14        .with_benchmark_title("Benchmark Index")
15        .with_output("tearsheet_with_benchmark.html");
16
17    let html = html(&strategy, options)?;
18
19    println!(
20        "Generated HTML report with benchmark ({} bytes) at tearsheet_with_benchmark.html",
21        html.len()
22    );
23
24    Ok(())
25}
Source

pub fn with_title<S: Into<String>>(self, title: S) -> Self

Examples found in repository?
examples/html_report.rs (line 10)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let series = common::demo_strategy();
8
9    let options = HtmlReportOptions::default()
10        .with_title("Quantstats-rs Demo Tearsheet")
11        .with_strategy_title("Demo Strategy")
12        .with_output("tearsheet.html");
13
14    let html = html(&series, options)?;
15
16    println!(
17        "Generated HTML report ({} bytes) at tearsheet.html",
18        html.len()
19    );
20
21    Ok(())
22}
More examples
Hide additional examples
examples/html_with_benchmark.rs (line 12)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let strategy = common::demo_strategy();
8    let benchmark = common::demo_benchmark();
9
10    let options = HtmlReportOptions::default()
11        .with_benchmark(&benchmark)
12        .with_title("Quantstats-rs Demo Tearsheet (with Benchmark)")
13        .with_strategy_title("Strategy")
14        .with_benchmark_title("Benchmark Index")
15        .with_output("tearsheet_with_benchmark.html");
16
17    let html = html(&strategy, options)?;
18
19    println!(
20        "Generated HTML report with benchmark ({} bytes) at tearsheet_with_benchmark.html",
21        html.len()
22    );
23
24    Ok(())
25}
Source

pub fn with_strategy_title<S: Into<String>>(self, title: S) -> Self

Examples found in repository?
examples/html_report.rs (line 11)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let series = common::demo_strategy();
8
9    let options = HtmlReportOptions::default()
10        .with_title("Quantstats-rs Demo Tearsheet")
11        .with_strategy_title("Demo Strategy")
12        .with_output("tearsheet.html");
13
14    let html = html(&series, options)?;
15
16    println!(
17        "Generated HTML report ({} bytes) at tearsheet.html",
18        html.len()
19    );
20
21    Ok(())
22}
More examples
Hide additional examples
examples/html_with_benchmark.rs (line 13)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let strategy = common::demo_strategy();
8    let benchmark = common::demo_benchmark();
9
10    let options = HtmlReportOptions::default()
11        .with_benchmark(&benchmark)
12        .with_title("Quantstats-rs Demo Tearsheet (with Benchmark)")
13        .with_strategy_title("Strategy")
14        .with_benchmark_title("Benchmark Index")
15        .with_output("tearsheet_with_benchmark.html");
16
17    let html = html(&strategy, options)?;
18
19    println!(
20        "Generated HTML report with benchmark ({} bytes) at tearsheet_with_benchmark.html",
21        html.len()
22    );
23
24    Ok(())
25}
Source

pub fn with_benchmark_title<S: Into<String>>(self, title: S) -> Self

Examples found in repository?
examples/html_with_benchmark.rs (line 14)
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Use shared demo data from examples/common.rs (generated from data file)
7    let strategy = common::demo_strategy();
8    let benchmark = common::demo_benchmark();
9
10    let options = HtmlReportOptions::default()
11        .with_benchmark(&benchmark)
12        .with_title("Quantstats-rs Demo Tearsheet (with Benchmark)")
13        .with_strategy_title("Strategy")
14        .with_benchmark_title("Benchmark Index")
15        .with_output("tearsheet_with_benchmark.html");
16
17    let html = html(&strategy, options)?;
18
19    println!(
20        "Generated HTML report with benchmark ({} bytes) at tearsheet_with_benchmark.html",
21        html.len()
22    );
23
24    Ok(())
25}
Source

pub fn with_template_path<P: AsRef<Path>>(self, path: P) -> Self

Trait Implementations§

Source§

impl<'a> Default for HtmlReportOptions<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for HtmlReportOptions<'a>

§

impl<'a> RefUnwindSafe for HtmlReportOptions<'a>

§

impl<'a> Send for HtmlReportOptions<'a>

§

impl<'a> Sync for HtmlReportOptions<'a>

§

impl<'a> Unpin for HtmlReportOptions<'a>

§

impl<'a> UnwindSafe for HtmlReportOptions<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.