Closed justinpolygon closed 2 months ago
Update client with related companies support. This PR updates the spec, adds a GetTickerRelatedCompanies function, params, response, test, and a working example. This also fixes https://github.com/polygon-io/client-go/issues/424 for the spec changes.
GetTickerRelatedCompanies
// Stocks - Related Companies // https://polygon.io/docs/stocks/get_v1_related-companies__ticker // https://github.com/polygon-io/client-go/blob/master/rest/reference.go package main import ( "context" "log" "os" polygon "github.com/polygon-io/client-go/rest" "github.com/polygon-io/client-go/rest/models" ) func main() { // init client c := polygon.New(os.Getenv("POLYGON_API_KEY")) // set params params := models.GetTickerRelatedCompaniesParams{ Ticker: "AAPL", } // make request res, err := c.GetTickerRelatedCompanies(context.Background(), ¶ms) if err != nil { log.Fatal(err) } // do something with the result log.Print(res) }
$ go run rest/example/stocks/related-companies/main.go 2024/06/18 13:33:20 &{{{} OK e1aa58d77611eef9a9e98f904539c34d 0 } [{MSFT} {GOOGL} {AMZN} {GOOG} {TSLA} {NVDA} {META} {NFLX} {DIS} {BRK.B}]}
Update client with related companies support. This PR updates the spec, adds a
GetTickerRelatedCompanies
function, params, response, test, and a working example. This also fixes https://github.com/polygon-io/client-go/issues/424 for the spec changes.