github.com/polygon-io/client-go@v1.16.4/rest/example/crypto/snapshots-ticker/main.go (about) 1 // Crypto - Snapshot Ticker 2 // https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto_tickers__ticker 3 // https://github.com/polygon-io/client-go/blob/master/rest/snapshot.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.GetTickerSnapshotParams{ 22 Ticker: "X:BTCUSD", 23 Locale: models.Global, 24 MarketType: models.Crypto, 25 } 26 27 // make request 28 res, err := c.GetTickerSnapshot(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 }