github.com/polygon-io/client-go@v1.16.4/rest/models/financials.go (about)

     1  package models
     2  
     3  // ListStockFinancialsParams is the set of parameters for the ListStockFinancials method.
     4  type ListStockFinancialsParams struct {
     5  	// Query by company ticker.
     6  	Ticker *string `query:"ticker"`
     7  
     8  	// Query by central index key Number (CIK: https://www.sec.gov/edgar/searchedgar/cik.htm).
     9  	CIK *string `query:"cik"`
    10  
    11  	// Query by company name.
    12  	CompanyNameFull   *string `query:"company_name"`
    13  	CompanyNameSearch *string `query:"company_name.search"`
    14  
    15  	// Query by standard industrial classification (SIC:
    16  	// https://www.sec.gov/corpfin/division-of-corporation-finance-standard-industrial-classification-sic-code-list).
    17  	SIC *string `query:"sic"`
    18  
    19  	// Query by the date when the filing with financials data was filed in YYYY-MM-DD format.
    20  	//
    21  	// Best used when querying over date ranges to find financials based on filings that happen in a time period.
    22  	//
    23  	// Examples:
    24  	//
    25  	// To get financials based on filings that have happened after January 1, 2009 use the query param
    26  	// filing_date.gte=2009-01-01.
    27  	//
    28  	// To get financials based on filings that happened in the year 2009 use the query params
    29  	// filing_date.gte=2009-01-01&filing_date.lt=2010-01-01.
    30  	FilingDateEQ  *Date `query:"filing_dividend_date"`
    31  	FilingDateLT  *Date `query:"filing_dividend_date.lt"`
    32  	FilingDateLTE *Date `query:"filing_dividend_date.lte"`
    33  	FilingDateGT  *Date `query:"filing_dividend_date.gt"`
    34  	FilingDateGTE *Date `query:"filing_dividend_date.gte"`
    35  
    36  	// The period of report for the filing with financials data in YYYY-MM-DD format.
    37  	PeriodOfReportDateEQ  *Date `query:"period_of_report_date"`
    38  	PeriodOfReportDateLT  *Date `query:"period_of_report_date.lt"`
    39  	PeriodOfReportDateLTE *Date `query:"period_of_report_date.lte"`
    40  	PeriodOfReportDateGT  *Date `query:"period_of_report_date.gt"`
    41  	PeriodOfReportDateGTE *Date `query:"period_of_report_date.gte"`
    42  
    43  	// Query by timeframe. Annual financials originate from 10-K filings, and quarterly financials originate from 10-Q
    44  	// filings. Note: Most companies do not file quarterly reports for Q4 and instead include those financials in their
    45  	// annual report, so some companies my not return quarterly financials for Q4.
    46  	Timeframe *Timeframe `query:"timeframe"`
    47  
    48  	// Whether or not to include the xpath and formula attributes for each financial data point. See the xpath and
    49  	// formula response attributes for more info. False by default.
    50  	IncludeSources *bool `query:"include_sources"`
    51  
    52  	// Order results based on the sort field.
    53  	Order *Order `query:"order"`
    54  
    55  	// Limit the number of results returned, default is 10 and max is 100.
    56  	Limit *int `query:"limit"`
    57  
    58  	// Sort field used for ordering.
    59  	Sort *Sort `query:"sort"`
    60  }
    61  
    62  func (p ListStockFinancialsParams) WithTicker(q string) *ListStockFinancialsParams {
    63  	p.Ticker = &q
    64  	return &p
    65  }
    66  
    67  func (p ListStockFinancialsParams) WithCIK(q string) *ListStockFinancialsParams {
    68  	p.CIK = &q
    69  	return &p
    70  }
    71  
    72  func (p ListStockFinancialsParams) WithCompanyName(c NameComparator, q string) *ListStockFinancialsParams {
    73  	switch c {
    74  	case Full:
    75  		p.CompanyNameFull = &q
    76  	case Search:
    77  		p.CompanyNameSearch = &q
    78  	}
    79  	return &p
    80  }
    81  
    82  func (p ListStockFinancialsParams) WithSIC(q string) *ListStockFinancialsParams {
    83  	p.SIC = &q
    84  	return &p
    85  }
    86  
    87  func (p ListStockFinancialsParams) WithFilingDate(c Comparator, q Date) *ListStockFinancialsParams {
    88  	switch c {
    89  	case EQ:
    90  		p.FilingDateEQ = &q
    91  	case LT:
    92  		p.FilingDateLT = &q
    93  	case LTE:
    94  		p.FilingDateLTE = &q
    95  	case GT:
    96  		p.FilingDateGT = &q
    97  	case GTE:
    98  		p.FilingDateGTE = &q
    99  	}
   100  	return &p
   101  }
   102  
   103  func (p ListStockFinancialsParams) WithPeriodOfReportDate(c Comparator, q Date) *ListStockFinancialsParams {
   104  	switch c {
   105  	case EQ:
   106  		p.PeriodOfReportDateEQ = &q
   107  	case LT:
   108  		p.PeriodOfReportDateLT = &q
   109  	case LTE:
   110  		p.PeriodOfReportDateLTE = &q
   111  	case GT:
   112  		p.PeriodOfReportDateGT = &q
   113  	case GTE:
   114  		p.PeriodOfReportDateGTE = &q
   115  	}
   116  	return &p
   117  }
   118  
   119  func (p ListStockFinancialsParams) WithTimeframe(q Timeframe) *ListStockFinancialsParams {
   120  	p.Timeframe = &q
   121  	return &p
   122  }
   123  
   124  func (p ListStockFinancialsParams) WithIncludeSources(q bool) *ListStockFinancialsParams {
   125  	p.IncludeSources = &q
   126  	return &p
   127  }
   128  
   129  func (p ListStockFinancialsParams) WithOrder(q Order) *ListStockFinancialsParams {
   130  	p.Order = &q
   131  	return &p
   132  }
   133  
   134  func (p ListStockFinancialsParams) WithLimit(q int) *ListStockFinancialsParams {
   135  	p.Limit = &q
   136  	return &p
   137  }
   138  
   139  func (p ListStockFinancialsParams) WithSort(q Sort) *ListStockFinancialsParams {
   140  	p.Sort = &q
   141  	return &p
   142  }
   143  
   144  // ListStockFinancialsResponse is the response returned by the ListFinancials method.
   145  type ListStockFinancialsResponse struct {
   146  	BaseResponse
   147  	Results []StockFinancial `json:"results,omitempty"`
   148  }
   149  
   150  // StockFinancial contains detailed information on a specified stock financial.
   151  type StockFinancial struct {
   152  	CIK                 string               `json:"cik,omitempty"`
   153  	CompanyName         string               `json:"company_name,omitempty"`
   154  	EndDate             string               `json:"end_date,omitempty"`
   155  	FilingDate          string               `json:"filing_date,omitempty"`
   156  	Financials          map[string]Financial `json:"financials,omitempty"`
   157  	FiscalPeriod        string               `json:"fiscal_period,omitempty"`
   158  	FiscalYear          string               `json:"fiscal_year,omitempty"`
   159  	SourceFilingFileUrl string               `json:"source_filing_file_url,omitempty"`
   160  	SourceFilingUrl     string               `json:"source_filing_url,omitempty"`
   161  	StartDate           string               `json:"start_date,omitempty"`
   162  }
   163  
   164  // Financial aliases nested data points of information for a stock financial.
   165  type Financial map[string]struct {
   166  	Formula string  `json:"formula,omitempty"`
   167  	Label   string  `json:"label,omitempty"`
   168  	Order   int32   `json:"order,omitempty"`
   169  	Unit    string  `json:"unit,omitempty"`
   170  	Value   float64 `json:"value,omitempty"`
   171  	Xpath   string  `json:"xpath,omitempty"`
   172  }