github.com/polygon-io/client-go@v1.16.4/rest/example/options/daily-open-close/main.go (about) 1 // Options - Daily Open/Close 2 // https://polygon.io/docs/options/get_v1_open-close__optionsticker___date 3 // https://github.com/polygon-io/client-go/blob/master/rest/aggs.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 18 // init client 19 c := polygon.New(os.Getenv("POLYGON_API_KEY")) 20 21 // set params 22 params := models.GetDailyOpenCloseAggParams{ 23 Ticker: "O:SPY251219C00650000", 24 Date: models.Date(time.Date(2023, 2, 22, 0, 0, 0, 0, time.Local)), 25 }.WithAdjusted(true) 26 27 // make request 28 res, err := c.GetDailyOpenCloseAgg(context.Background(), params) 29 if err != nil { 30 log.Fatal(err) 31 } 32 33 // do something with the result 34 log.Print(res) 35 36 }