github.com/polygon-io/client-go@v1.16.4/rest/models/dividends.go (about) 1 package models 2 3 // ListDividendsParams is the set of parameters for the ListDividends method. 4 type ListDividendsParams struct { 5 // Return the dividends that contain this ticker. 6 TickerEQ *string `query:"ticker"` 7 TickerLT *string `query:"ticker.lt"` 8 TickerLTE *string `query:"ticker.lte"` 9 TickerGT *string `query:"ticker.gt"` 10 TickerGTE *string `query:"ticker.gte"` 11 12 // Query by ex-dividend date with the format YYYY-MM-DD. 13 ExDividendDateEQ *Date `query:"ex_dividend_date"` 14 ExDividendDateLT *Date `query:"ex_dividend_date.lt"` 15 ExDividendDateLTE *Date `query:"ex_dividend_date.lte"` 16 ExDividendDateGT *Date `query:"ex_dividend_date.gt"` 17 ExDividendDateGTE *Date `query:"ex_dividend_date.gte"` 18 19 // Query by record date with the format YYYY-MM-DD. 20 RecordDateEQ *Date `query:"record_date"` 21 RecordDateLT *Date `query:"record_date.lt"` 22 RecordDateLTE *Date `query:"record_date.lte"` 23 RecordDateGT *Date `query:"record_date.gt"` 24 RecordDateGTE *Date `query:"record_date.gte"` 25 26 // Query by declaration date with the format YYYY-MM-DD. 27 DeclarationDateEQ *Date `query:"declaration_date"` 28 DeclarationDateLT *Date `query:"declaration_date.lt"` 29 DeclarationDateLTE *Date `query:"declaration_date.lte"` 30 DeclarationDateGT *Date `query:"declaration_date.gt"` 31 DeclarationDateGTE *Date `query:"declaration_date.gte"` 32 33 // Query by pay date with the format YYYY-MM-DD. 34 PayDateEQ *Date `query:"pay_date"` 35 PayDateLT *Date `query:"pay_date.lt"` 36 PayDateLTE *Date `query:"pay_date.lte"` 37 PayDateGT *Date `query:"pay_date.gt"` 38 PayDateGTE *Date `query:"pay_date.gte"` 39 40 // Query by the number of times per year the dividend is paid out. Possible values are 0 (one-time), 1 (annually), 2 41 // (bi-annually), 4 (quarterly), and 12 (monthly). 42 Frequency *Frequency `query:"frequency"` 43 44 // Query by the cash amount of the dividend. 45 CashAmountEQ *float64 `query:"cash_amount"` 46 CashAmountLT *float64 `query:"cash_amount.lt"` 47 CashAmountLTE *float64 `query:"cash_amount.lte"` 48 CashAmountGT *float64 `query:"cash_amount.gt"` 49 CashAmountGTE *float64 `query:"cash_amount.gte"` 50 51 // Query by the type of dividend. Dividends that have been paid and/or are expected to be paid on consistent 52 // schedules are denoted as CD. Special Cash dividends that have been paid that are infrequent or unusual, and/or 53 // can not be expected to occur in the future are denoted as SC. 54 DividendType *DividendType `query:"dividend_type"` 55 56 // Order results based on the sort field. 57 Order *Order `query:"order"` 58 59 // Limit the number of results returned, default is 10 and max is 1000. 60 Limit *int `query:"limit"` 61 62 // Sort field used for ordering. 63 Sort *Sort `query:"sort"` 64 } 65 66 func (p ListDividendsParams) WithTicker(c Comparator, q string) *ListDividendsParams { 67 switch c { 68 case EQ: 69 p.TickerEQ = &q 70 case LT: 71 p.TickerLT = &q 72 case LTE: 73 p.TickerLTE = &q 74 case GT: 75 p.TickerGT = &q 76 case GTE: 77 p.TickerGTE = &q 78 } 79 return &p 80 } 81 82 func (p ListDividendsParams) WithExDividendDate(c Comparator, q Date) *ListDividendsParams { 83 switch c { 84 case EQ: 85 p.ExDividendDateEQ = &q 86 case LT: 87 p.ExDividendDateLT = &q 88 case LTE: 89 p.ExDividendDateLTE = &q 90 case GT: 91 p.ExDividendDateGT = &q 92 case GTE: 93 p.ExDividendDateGTE = &q 94 } 95 return &p 96 } 97 98 func (p ListDividendsParams) WithDeclarationDate(c Comparator, q Date) *ListDividendsParams { 99 switch c { 100 case EQ: 101 p.DeclarationDateEQ = &q 102 case LT: 103 p.DeclarationDateLT = &q 104 case LTE: 105 p.DeclarationDateLTE = &q 106 case GT: 107 p.DeclarationDateGT = &q 108 case GTE: 109 p.DeclarationDateGTE = &q 110 } 111 return &p 112 } 113 114 func (p ListDividendsParams) WithFrequency(q Frequency) *ListDividendsParams { 115 p.Frequency = &q 116 return &p 117 } 118 119 func (p ListDividendsParams) WithCashAmount(c Comparator, q float64) *ListDividendsParams { 120 switch c { 121 case EQ: 122 p.CashAmountEQ = &q 123 case LT: 124 p.CashAmountLT = &q 125 case LTE: 126 p.CashAmountLTE = &q 127 case GT: 128 p.CashAmountGT = &q 129 case GTE: 130 p.CashAmountGTE = &q 131 } 132 return &p 133 } 134 135 func (p ListDividendsParams) WithDividendType(q DividendType) *ListDividendsParams { 136 p.DividendType = &q 137 return &p 138 } 139 140 func (p ListDividendsParams) WithOrder(q Order) *ListDividendsParams { 141 p.Order = &q 142 return &p 143 } 144 145 func (p ListDividendsParams) WithLimit(q int) *ListDividendsParams { 146 p.Limit = &q 147 return &p 148 } 149 150 func (p ListDividendsParams) WithSort(q Sort) *ListDividendsParams { 151 p.Sort = &q 152 return &p 153 } 154 155 // ListDividendsResponse is the response returned by the ListDividends method. 156 type ListDividendsResponse struct { 157 BaseResponse 158 Results []Dividend `json:"results,omitempty"` 159 } 160 161 // Dividend contains detailed information on a specified stock dividend. 162 type Dividend struct { 163 CashAmount float64 `json:"cash_amount,omitempty"` 164 DeclarationDate Date `json:"declaration_date,omitempty"` 165 DividendType string `json:"dividend_type,omitempty"` 166 ExDividendDate string `json:"ex_dividend_date,omitempty"` 167 Frequency int64 `json:"frequency,omitempty"` 168 PayDate Date `json:"pay_date,omitempty"` 169 RecordDate Date `json:"record_date,omitempty"` 170 Ticker string `json:"ticker,omitempty"` 171 }