From b26afddba17861fc708f4317c3b8eeebbba9bc8d Mon Sep 17 00:00:00 2001 From: justinpolygon <123573436+justinpolygon@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:00:53 -0800 Subject: [PATCH] Update README.md with getting started (#371) --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a4ea549c..3722acca 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,79 @@ [![docs][doc-img]][doc] [![Build][build-img]][build] [![Go Report Card][report-card-img]][report-card] -The official Go client library for the [Polygon](https://polygon.io/) REST and WebSocket API. +The official Go client library for the [Polygon](https://polygon.io/) REST and WebSocket API. This client makes use of Go generics and thus requires Go 1.18. See the [docs](https://polygon.io/docs/stocks/getting-started) for more details on our API. -`go get github.com/polygon-io/client-go` +## Getting Started -This client makes use of Go generics and thus requires Go 1.18. See the [docs](https://polygon.io/docs/stocks/getting-started) for more details on our API. +This section guides you through setting up a simple project with polygon-io/client-go. + +First, make a new directory for your project and navigate into it: +```bash +mkdir myproject && cd myproject +``` + +Next, initialize a new module for dependency management. This creates a `go.mod` file to track your dependencies: +```bash +go mod init example +``` + +Then, create a `main.go` file. For quick start, you can find over 100+ [example code snippets](https://github.com/polygon-io/client-go/tree/master/rest/example) that demonstrate connecting to both the REST and WebSocket APIs. Here's an example that fetches the last trade for `AAPL`. + +```bash +cat > main.go <" <- windows +``` + +Then, run `go mod tidy` to automatically download and install the necessary dependencies. This command ensures your `go.mod` file reflects all dependencies used in your project: +```bash +go mod tidy +``` + +Finally, execute your application: +```bash +go run main.go +``` ## REST API Client