Add more calendars.
avhz opened this issue · 7 comments
This just involves going through each country and completing the following boilerplate (using some source such as timeanddate.com).
pub struct Argentina;
impl Calendar for Argentina {
fn name(&self) -> &'static str {
"Argentina"
}
fn country_code(&self) -> crate::iso::ISO_3166 {
crate::iso::ARGENTINA
}
// Use the MIC code for the primary stock exchange of the country.
fn market_identifier_code(&self) -> crate::iso::ISO_10383 {
crate::iso::XBUE
}
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)
|| (d == 25 && m == Month::December) // Christmas
|| (d == 1 && m == Month::January) // New Years Day
... // and so on...
{
return false;
}
true
}
}
To-do:
- Argentina
- Australia
- Austria
- Botswana
- Brazil
- Canada
- Chile
- China
- Czech Republic
- Denmark
- Finland
- France
- Germany
- Hong Kong
- Hungary
- Iceland
- India
- Indonesia
- Israel
- Italy
- Japan
- Mexico
- New Zealand
- Norway
- Poland
- Romania
- Russia
- Saudi Arabia
- Singapore
- Slovakia
- South Africa
- South Korea
- Sweden
- Switzerland
- Taiwan
- Thailand
- Turkey
- Ukraine
- United Kingdom
- United States of America
can i take this task?
Sure :) take a look at what is already implemented for an idea of what needs to be done.
Thanks for your interest !
@avhz Getting this error while building locally on mac air m1.
dakshdagariya@Dakshs-MacBook-Air RustQuant % cargo build
error: failed to download `color_quant v1.1.0`
Caused by:
unable to get `packages` from source
Caused by:
failed to download replaced source registry `crates-io`
Caused by:
failed to read `/Users/dakshdagariya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/color_quant-1.1.0/Cargo.toml`
Caused by:
No such file or directory (os error 2)
Hi, I'm not getting that error. Looks like a problem with the plotters
crate.
Is your Rust up-to-date? Try rustup update
and re-compile and let me know what happens.
Edit: probably also worth running cargo clean
after updating Rust.
Hi thanks @avhz I'm able to build now but how to run this locally getting this.
dakshdagariya@Dakshs-MacBook-Air RustQuant % cargo run
error: a bin target must be available for `cargo run`
RustQuant is a library, not a binary. So you can't run it.
You may find the Rust book helpful: https://doc.rust-lang.org/book/
I believe there's a chapter about libraries and binaries.
okay thanks a lot.