github.com/polygon-io/client-go@v1.16.4/rest/example/options/quotes/main.go (about) 1 // Options - Quotes 2 // https://polygon.io/docs/options/get_v3_quotes__optionsticker 3 // https://github.com/polygon-io/client-go/blob/master/rest/quotes.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 17 // init client 18 c := polygon.New(os.Getenv("POLYGON_API_KEY")) 19 20 // set params 21 params := models.ListQuotesParams{ 22 Ticker: "O:SPY241220P00720000", 23 }.WithLimit(50000).WithOrder(models.Asc) 24 25 // make request 26 iter := c.ListQuotes(context.Background(), params) 27 28 // do something with the result 29 for iter.Next() { 30 log.Print(iter.Item()) 31 } 32 if iter.Err() != nil { 33 log.Fatal(iter.Err()) 34 } 35 36 }