scuriolus 0.3.0

Scuriolus is a modular trading bot platform.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use chrono::{DateTime, Datelike as _, TimeZone as _, Utc};

pub fn semester(date: &DateTime<Utc>) -> (DateTime<Utc>, DateTime<Utc>) {
    let year = date.year();
    if date.month() < 7 {
        (
            Utc.with_ymd_and_hms(year, 1, 1, 0, 0, 0).unwrap(),
            Utc.with_ymd_and_hms(year, 7, 1, 0, 0, 0).unwrap(),
        )
    } else {
        (
            Utc.with_ymd_and_hms(year, 7, 1, 0, 0, 0).unwrap(),
            Utc.with_ymd_and_hms(year + 1, 1, 1, 0, 0, 0).unwrap(),
        )
    }
}