github.com/polygon-io/client-go@v1.16.4/rest/example/forex/quotes/main.go (about) 1 // Forex - Quotes (BBO) 2 // https://polygon.io/docs/forex/get_v3_quotes__fxticker 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 "time" 11 12 polygon "github.com/polygon-io/client-go/rest" 13 "github.com/polygon-io/client-go/rest/models" 14 ) 15 16 func main() { 17 // init client 18 c := polygon.New(os.Getenv("POLYGON_API_KEY")) 19 20 // set params 21 params := models.ListQuotesParams{ 22 Ticker: "C:EUR-USD", 23 }.WithTimestamp(models.EQ, models.Nanos(time.Date(2023, 4, 13, 0, 0, 0, 0, time.UTC))). 24 WithSort(models.Timestamp). 25 WithOrder(models.Asc). 26 WithLimit(50000) 27 28 // make request 29 iter := c.ListQuotes(context.Background(), params) 30 31 // do something with the result 32 for iter.Next() { 33 log.Print(iter.Item()) 34 } 35 if iter.Err() != nil { 36 log.Fatal(iter.Err()) 37 } 38 }