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

     1  package models_test
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	"github.com/polygon-io/client-go/rest/models"
     8  )
     9  
    10  func TestListStockFinancialsParams(t *testing.T) {
    11  	ticker := "A"
    12  	date := models.Date(time.Date(2023, 3, 23, 0, 0, 0, 0, time.Local))
    13  	timeframe := models.TFAnnual
    14  	cik := "0001650729"
    15  	name := "Apple"
    16  	sic := "3570"
    17  	sources := false
    18  	order := models.Asc
    19  	limit := 100
    20  	sort := models.TickerSymbol
    21  
    22  	expect := models.ListStockFinancialsParams{
    23  		Ticker:                &ticker,
    24  		CIK:                   &cik,
    25  		CompanyNameFull:       &name,
    26  		CompanyNameSearch:     &name,
    27  		SIC:                   &sic,
    28  		FilingDateEQ:          &date,
    29  		FilingDateLT:          &date,
    30  		FilingDateLTE:         &date,
    31  		FilingDateGT:          &date,
    32  		FilingDateGTE:         &date,
    33  		PeriodOfReportDateEQ:  &date,
    34  		PeriodOfReportDateLT:  &date,
    35  		PeriodOfReportDateLTE: &date,
    36  		PeriodOfReportDateGT:  &date,
    37  		PeriodOfReportDateGTE: &date,
    38  		Timeframe:             &timeframe,
    39  		IncludeSources:        &sources,
    40  		Order:                 &order,
    41  		Limit:                 &limit,
    42  		Sort:                  &sort,
    43  	}
    44  	actual := models.ListStockFinancialsParams{}.
    45  		WithTicker(ticker).
    46  		WithCIK(cik).
    47  		WithCompanyName(models.Full, name).
    48  		WithCompanyName(models.Search, name).
    49  		WithSIC(sic).
    50  		WithFilingDate(models.EQ, date).
    51  		WithFilingDate(models.LT, date).
    52  		WithFilingDate(models.LTE, date).
    53  		WithFilingDate(models.GT, date).
    54  		WithFilingDate(models.GTE, date).
    55  		WithPeriodOfReportDate(models.EQ, date).
    56  		WithPeriodOfReportDate(models.LT, date).
    57  		WithPeriodOfReportDate(models.LTE, date).
    58  		WithPeriodOfReportDate(models.GT, date).
    59  		WithPeriodOfReportDate(models.GTE, date).
    60  		WithTimeframe(timeframe).
    61  		WithIncludeSources(sources).
    62  		WithOrder(order).
    63  		WithLimit(limit).
    64  		WithSort(sort)
    65  
    66  	checkParams(t, expect, *actual)
    67  }