1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use serde::{Deserialize, Serialize};
use chrono::NaiveDate;
use crate::calendar::{DayAdjust,DayCountConv};
use crate::time_period::TimePeriod;
#[derive(Deserialize, Serialize, Debug)]
pub struct Bond {
isin: Option<String>,
security_id: Option<String>,
prospect_url: Option<String>,
issuer: Option<Issuer>,
bond_type: String,
currency: String,
coupon : Coupon,
business_day_rule: DayAdjust,
calendar: String,
issue_date: NaiveDate,
maturity: NaiveDate,
denomination: u32,
volume: f64
}
#[derive(Deserialize, Serialize, Debug)]
struct Issuer {
name: String,
address: Option<IssuerAddress>,
}
#[derive(Deserialize, Serialize, Debug)]
struct IssuerAddress {
city: String,
country: String,
}
#[derive(Deserialize, Serialize, Debug)]
struct Coupon {
coupon_type: String,
rate: f64,
coupon_date: String,
period: TimePeriod,
day_count_convention: DayCountConv,
}