-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: #142 - Add calendar boilerplate
- Loading branch information
Showing
31 changed files
with
1,141 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// RustQuant: A Rust library for quantitative finance tools. | ||
// Copyright (C) 2023 https://github.com/avhz | ||
// Dual licensed under Apache 2.0 and MIT. | ||
// See: | ||
// - LICENSE-APACHE.md | ||
// - LICENSE-MIT.md | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
use crate::time::Calendar; | ||
use time::{Month, OffsetDateTime, Weekday}; | ||
|
||
/// Czech Republic calendar. | ||
pub struct CzechRepublic; | ||
|
||
impl Calendar for CzechRepublic { | ||
fn name(&self) -> &'static str { | ||
"" | ||
} | ||
|
||
fn is_business_day(&self, date: OffsetDateTime) -> bool { | ||
let (w, d, m, y, dd) = self.unpack_date(date); | ||
let em = Self::easter_monday(y as usize, false); | ||
|
||
if Self::is_weekend(date) { | ||
return false; | ||
} | ||
|
||
true | ||
} | ||
} | ||
|
||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
// UNIT TESTS | ||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
#[cfg(test)] | ||
mod tests {} |
Oops, something went wrong.