|
| 1 | +package models |
| 2 | + |
| 3 | +// ListTreasuryYieldsParams is the set of parameters for the ListTreasuryYields method. |
| 4 | +type ListTreasuryYieldsParams struct { |
| 5 | + // Calendar date of the yield observation (YYYY-MM-DD). |
| 6 | + DateEQ *string `query:"date"` |
| 7 | + DateLT *string `query:"date.lt"` |
| 8 | + DateLTE *string `query:"date.lte"` |
| 9 | + DateGT *string `query:"date.gt"` |
| 10 | + DateGTE *string `query:"date.gte"` |
| 11 | + |
| 12 | + // Sort field used for ordering. Default is date. |
| 13 | + Sort *Sort `query:"sort"` |
| 14 | + |
| 15 | + // Order results based on the sort field. Default is asc. |
| 16 | + Order *Order `query:"order"` |
| 17 | + |
| 18 | + // Limit the number of results returned, default is 100 and max is 50000. |
| 19 | + Limit *int `query:"limit"` |
| 20 | +} |
| 21 | + |
| 22 | +func (p ListTreasuryYieldsParams) WithDate(c Comparator, q string) *ListTreasuryYieldsParams { |
| 23 | + switch c { |
| 24 | + case EQ: |
| 25 | + p.DateEQ = &q |
| 26 | + case LT: |
| 27 | + p.DateLT = &q |
| 28 | + case LTE: |
| 29 | + p.DateLTE = &q |
| 30 | + case GT: |
| 31 | + p.DateGT = &q |
| 32 | + case GTE: |
| 33 | + p.DateGTE = &q |
| 34 | + } |
| 35 | + return &p |
| 36 | +} |
| 37 | + |
| 38 | +func (p ListTreasuryYieldsParams) WithSort(q Sort) *ListTreasuryYieldsParams { |
| 39 | + p.Sort = &q |
| 40 | + return &p |
| 41 | +} |
| 42 | + |
| 43 | +func (p ListTreasuryYieldsParams) WithOrder(q Order) *ListTreasuryYieldsParams { |
| 44 | + p.Order = &q |
| 45 | + return &p |
| 46 | +} |
| 47 | + |
| 48 | +func (p ListTreasuryYieldsParams) WithLimit(q int) *ListTreasuryYieldsParams { |
| 49 | + p.Limit = &q |
| 50 | + return &p |
| 51 | +} |
| 52 | + |
| 53 | +// ListTreasuryYieldsResponse is the response returned by the ListTreasuryYields method. |
| 54 | +type ListTreasuryYieldsResponse struct { |
| 55 | + BaseResponse |
| 56 | + |
| 57 | + // An array of treasury yields that match your query. |
| 58 | + Results []TreasuryYield `json:"results,omitempty"` |
| 59 | +} |
| 60 | + |
| 61 | +// TreasuryYield contains treasury yield data for a specific date. |
| 62 | +type TreasuryYield struct { |
| 63 | + Date string `json:"date,omitempty"` |
| 64 | + Yield1Month *float64 `json:"yield_1_month,omitempty"` |
| 65 | + Yield3Month *float64 `json:"yield_3_month,omitempty"` |
| 66 | + Yield6Month *float64 `json:"yield_6_month,omitempty"` |
| 67 | + Yield1Year *float64 `json:"yield_1_year,omitempty"` |
| 68 | + Yield2Year *float64 `json:"yield_2_year,omitempty"` |
| 69 | + Yield3Year *float64 `json:"yield_3_year,omitempty"` |
| 70 | + Yield5Year *float64 `json:"yield_5_year,omitempty"` |
| 71 | + Yield7Year *float64 `json:"yield_7_year,omitempty"` |
| 72 | + Yield10Year *float64 `json:"yield_10_year,omitempty"` |
| 73 | + Yield20Year *float64 `json:"yield_20_year,omitempty"` |
| 74 | + Yield30Year *float64 `json:"yield_30_year,omitempty"` |
| 75 | +} |
0 commit comments