Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const (
UpcomingPath rawPath
)
View Source
const (
UpcomingRatelimiter ratelimiter
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a wrapper for http.Client.
func (*Client) Upcoming ¶
Upcoming gets market holidays and their open/close times.
source: https://polygon.io/docs/crypto/get_v1_marketstatus_upcoming
Example ¶
package main import ( "context" "fmt" "log" "os" "github.com/alpine-hodler/web/pkg/polygon" "github.com/alpine-hodler/web/pkg/transport" ) func main() { url := "https://api.polygon.io" apikey := os.Getenv("POLYGON_API_KEY") client, err := polygon.NewClient(context.TODO(), transport.NewAuth2().SetBearer(apikey).SetURL(url)) if err != nil { log.Fatalf("error fetching client: %v", err) } upcoming, err := client.Upcoming() if err != nil { log.Fatalf("error fetching upcoming holidays: %v", err) } fmt.Printf("the next holiday is %q\n", upcoming[0].Name) }
Output:
type Upcoming ¶
type Upcoming struct { // Close is the market close time on the holiday (if it's not closed). Close string `json:"close" bson:"close"` // Date is the date of the holiday. Date string `json:"date" bson:"date"` // Exchange is market the record is for. Exchange string `json:"exchange" bson:"exchange"` // Name is the name of the holiday. Name string `json:"name" bson:"name"` // Open is the market open time on the holiday (if it's not closed). Open string `json:"open" bson:"open"` // Status is the status of the market on the holiday. Status string `json:"status" bson:"status"` }
Upcoming returns information concerning market holidays and their open/close times.
Click to show internal directories.
Click to hide internal directories.