github.com/polygon-io/client-go@v1.16.4/rest/example/indices/ticker-types/main.go (about)

     1  // Indices - Ticker Types
     2  // https://polygon.io/docs/indices/get_v3_reference_tickers_types
     3  // https://github.com/polygon-io/client-go/blob/master/rest/reference.go
     4  package main
     5  
     6  import (
     7  	"context"
     8  	"log"
     9  	"os"
    10  
    11  	polygon "github.com/polygon-io/client-go/rest"
    12  	"github.com/polygon-io/client-go/rest/models"
    13  )
    14  
    15  func main() {
    16  	// init client
    17  	c := polygon.New(os.Getenv("POLYGON_API_KEY"))
    18  
    19  	// set params
    20  	params := models.GetTickerTypesParams{}.WithAssetClass("indices")
    21  
    22  	// make request
    23  	res, err := c.GetTickerTypes(context.Background(), params)
    24  	if err != nil {
    25  		log.Fatal(err)
    26  	}
    27  
    28  	// do something with the result
    29  	log.Print(res)
    30  }