client-go

module
v1.16.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: MIT

README

Polygon Go Client

Coverage

docs Build Go Report Card

The official Go client library for the Polygon REST and WebSocket API. This client makes use of Go generics and thus requires Go 1.18. See the docs for more details on our API.

Getting Started

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:

mkdir myproject && cd myproject

Next, initialize a new module for dependency management. This creates a go.mod file to track your dependencies:

go mod init example

Then, create a main.go file. For quick start, you can find over 100+ example code snippets that demonstrate connecting to both the REST and WebSocket APIs. Here's an example that fetches the last trade for AAPL.

cat > main.go <<EOF
// Stocks - Last Trade
// https://polygon.io/docs/stocks/get_v2_last_trade__stocksticker
// https://github.com/polygon-io/client-go/blob/master/rest/trades.go
package main

import (
	"context"
	"log"
	"os"

	polygon "github.com/polygon-io/client-go/rest"
	"github.com/polygon-io/client-go/rest/models"
)

func main() {

	// init client
	c := polygon.New(os.Getenv("POLYGON_API_KEY"))

	// set params
	params := &models.GetLastTradeParams{
		Ticker: "AAPL",
	}

	// make request
	res, err := c.GetLastTrade(context.Background(), params)
	if err != nil {
		log.Fatal(err)
	}

	// do something with the result
	log.Print(res)

}
EOF

Please remember to set your Polygon API key, which you can find on the polygon.io dashboard, in the environment variable POLYGON_API_KEY. Or, as a less secure option, by hardcoding it in your code. But please note that hardcoding the API key can be risky if your code is shared or exposed. You can configure the environment variable by running:

export POLYGON_API_KEY="<your_api_key>"        <- mac/linux
xset POLYGON_API_KEY "<your_api_key>"          <- 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:

go mod tidy

Finally, execute your application:

go run main.go

REST API Client

rest-docs

To get started, you'll need to import two main packages.

import (
	polygon "github.com/polygon-io/client-go/rest"
	"github.com/polygon-io/client-go/rest/models"
)

Next, create a new client with your API key.

c := polygon.New("YOUR_API_KEY")

Or create a client with a custom HTTP client implementation.

hc := http.Client{} // some custom HTTP client
c := polygon.NewWithClient("YOUR_API_KEY", hc)
Using the client

After creating the client, making calls to the Polygon API is simple.

params := models.GetTickerDetailsParams{
    Ticker: "AAPL",
}.WithDate(models.Date(time.Date(2021, 7, 22, 0, 0, 0, 0, time.Local)))

res, err := c.GetTickerDetails(context.Background(), params)
if err != nil {
    log.Fatal(err)
}
log.Print(res) // do something with the result
Pagination

Our list methods return iterators that handle pagination for you.

// create a new iterator
params := models.ListTradesParams{Ticker: "AAPL"}.
    WithTimestamp(models.GTE, models.Nanos(time.Date(2021, 7, 22, 0, 0, 0, 0, time.UTC))).
    WithOrder(models.Asc)
iter := c.ListTrades(context.Background(), params)

// iter.Next() advances the iterator to the next value in the list
for iter.Next() {
    log.Print(iter.Item()) // do something with the current value
}

// if the loop breaks, it has either reached the end of the list or an error has occurred
// you can check if something went wrong with iter.Err()
if iter.Err() != nil {
    log.Fatal(iter.Err())
}

We also provide a builder method to make it easier to retrieve all trades and quotes for a specific day.

params := models.ListQuotesParams{Ticker: "AAPL"}.
    WithDay(2021, 7, 22). // get all quotes for July 22, 2021
    WithOrder(models.Asc)
iter := c.ListQuotes(context.Background(), params)

for iter.Next() {
    log.Print(iter.Item())
}
if iter.Err() != nil {
    log.Fatal(iter.Err())
}
Request options

Advanced users may want to add additional headers or query params to a given request.

params := &models.GetGroupedDailyAggsParams{
    Locale:     models.US,
    MarketType: models.Stocks,
    Date:       models.Date(time.Date(2021, 7, 22, 0, 0, 0, 0, time.Local)),
}

res, err := c.GetGroupedDailyAggs(context.Background(), params,
    models.APIKey("YOUR_OTHER_API_KEY"),
    models.Header("X-CUSTOM-HEADER", "VALUE"),
    models.QueryParam("adjusted", strconv.FormatBool(true)))
if err != nil {
    log.Fatal(err)
}
log.Print(res) // do something with the result
Launchpad Usage

Users of the Launchpad product will need to pass in certain headers in order to make API requests. Example can be found here.

Debugging

Sometimes you may find it useful to see the actual request and response details while working with the API. The client allows for this through its models.WithTrace(true) option.

How to Enable Debug Mode

You can activate the debug mode per request as follows by adding models.WithTrace(true) after the params:

iter := c.ListAggs(context.Background(), params, models.WithTrace(true))
What Does Debug Mode Do?

When debug mode is enabled, the client will print out useful debugging information for each API request. This includes: the request URL, the headers sent in the request, and the headers received in the response.

Example Output

For instance, if you made a request for TSLA data for the date 2023-08-01, you would see debug output similar to the following:

Request URL: /v2/aggs/ticker/AAPL/range/1/day/1672531200000/1678320000000?adjusted=true&limit=50000&sort=desc
Request Headers: map[Accept-Encoding:[gzip] Authorization:[REDACTED] User-Agent:[Polygon.io GoClient/v1.14.1]]
Response Headers: map[Content-Encoding:[gzip] Content-Length:[1639] Content-Type:[application/json] Date:[Tue, 05 Sep 2023 23:25:00 GMT] Server:[nginx/1.19.2] Strict-Transport-Security:[max-age=15724800; includeSubDomains] Vary:[Accept-Encoding] X-Request-Id:[ba3d3e9f42622bd16d05dafe01200f72]]

This can be an invaluable tool for debugging issues or understanding how the client interacts with the API.

WebSocket Client

ws-docs

Import the WebSocket client and models packages to get started.

import (
    polygonws "github.com/polygon-io/client-go/websocket"
    "github.com/polygon-io/client-go/websocket/models"
)

Next, create a new client with your API key and a couple other config options.

// create a new client
c, err := polygonws.New(polygonws.Config{
    APIKey:    "YOUR_API_KEY",
    Feed:      polygonws.RealTime,
    Market:    polygonws.Stocks,
})
if err != nil {
    log.Fatal(err)
}
defer c.Close() // the user of this client must close it

// connect to the server
if err := c.Connect(); err != nil {
    log.Error(err)
    return
}

The client automatically reconnects to the server when the connection is dropped. By default, it will attempt to reconnect indefinitely but the number of retries is configurable. When the client successfully reconnects, it automatically resubscribes to any topics that were set before the disconnect.

Using the client

After creating a client, subscribe to one or more topics and start accessing data. Currently, all of the data is pushed to a single output channel.

// passing a topic by itself will subscribe to all tickers
if err := c.Subscribe(polygonws.StocksSecAggs); err != nil {
    log.Fatal(err)
}
if err := c.Subscribe(polygonws.StocksTrades, "TSLA", "GME"); err != nil {
    log.Fatal(err)
}

for {
    select {
    case err := <-c.Error(): // check for any fatal errors (e.g. auth failed)
        log.Fatal(err)
    case out, more := <-c.Output(): // read the next data message
        if !more {
            return
        }

        switch out.(type) {
        case models.EquityAgg:
            log.Print(out) // do something with the agg
        case models.EquityTrade:
            log.Print(out) // do something with the trade
        }
    }
}

See the full example for more details on how to use this client effectively.

Release planning

This client will attempt to follow the release cadence of our API. When endpoints are deprecated and newer versions are added, the client will maintain two methods in a backwards compatible way (e.g. ListTrades and ListTradesV4(...)). When deprecated endpoints are removed from the API, we'll rename the versioned method (e.g. ListTradesV4(...) -> ListTrades(...)), remove the old method, and release a new major version of the client. The goal is to give users ample time to upgrade to newer versions of our API before we bump the major version of the client, and in general, we'll try to bundle breaking changes like this to avoid frequent major version bumps.

There are a couple exceptions to this. When we find small breaking issues with this client library (e.g. incorrect response types), we may decide to release them under the same major version. These changes will be clearly outlined in the release notes. Also, methods that fall under the VX client are considered experimental and may be modified or deprecated as needed. We'll call out any breaking changes to VX endpoints in our release notes to make using them easier.

Contributing

If you found a bug or have an idea for a new feature, please first discuss it with us by submitting a new issue. We will respond to issues within at most 3 weeks. We're also open to volunteers if you want to submit a PR for any open issues but please discuss it with us beforehand. PRs that aren't linked to an existing issue or discussed with us ahead of time will generally be declined. If you have more general feedback or want to discuss using this client with other users, feel free to reach out on our Slack channel.


Directories

Path Synopsis
Package polygon defines a REST client for the Polygon API.
Package polygon defines a REST client for the Polygon API.
example/crypto/aggregates-bars
Crypto - Aggregates (Bars) https://polygon.io/docs/crypto/get_v2_aggs_ticker__cryptoticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Crypto - Aggregates (Bars) https://polygon.io/docs/crypto/get_v2_aggs_ticker__cryptoticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/crypto/conditions
Crypto - Conditions https://polygon.io/docs/crypto/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Crypto - Conditions https://polygon.io/docs/crypto/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/crypto/daily-open-close
Crypto - Daily Open/Close https://polygon.io/docs/crypto/get_v1_open-close_crypto__from___to___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Crypto - Daily Open/Close https://polygon.io/docs/crypto/get_v1_open-close_crypto__from___to___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/crypto/exchanges
Crypto - Exchanges https://polygon.io/docs/crypto/get_v3_reference_exchanges
Crypto - Exchanges https://polygon.io/docs/crypto/get_v3_reference_exchanges
example/crypto/grouped-daily-bars
Crypto - Grouped Daily (Bars) https://polygon.io/docs/crypto/get_v2_aggs_grouped_locale_global_market_crypto__date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Crypto - Grouped Daily (Bars) https://polygon.io/docs/crypto/get_v2_aggs_grouped_locale_global_market_crypto__date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/crypto/last-trade-for-a-crypto-pair
Crypto - Last Trade for a Crypto Pair https://polygon.io/docs/crypto/get_v1_last_crypto__from___to https://github.com/polygon-io/client-go/blob/master/rest/trades.go
Crypto - Last Trade for a Crypto Pair https://polygon.io/docs/crypto/get_v1_last_crypto__from___to https://github.com/polygon-io/client-go/blob/master/rest/trades.go
example/crypto/market-holidays
Crypto - Market Holidays https://polygon.io/docs/crypto/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Crypto - Market Holidays https://polygon.io/docs/crypto/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/crypto/market-status
Crypto - Market Status https://polygon.io/docs/crypto/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Crypto - Market Status https://polygon.io/docs/crypto/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/crypto/previous-close
Crypto - Previous Close https://polygon.io/docs/crypto/get_v2_aggs_ticker__cryptoticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Crypto - Previous Close https://polygon.io/docs/crypto/get_v2_aggs_ticker__cryptoticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/crypto/snapshots-all-tickers
Crypto - Snapshot All Tickers https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto_tickers https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Crypto - Snapshot All Tickers https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto_tickers https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/crypto/snapshots-gainers-losers
Crypto - Snapshot Gainers/Losers https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto__direction https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Crypto - Snapshot Gainers/Losers https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto__direction https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/crypto/snapshots-ticker
Crypto - Snapshot Ticker https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Crypto - Snapshot Ticker https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/crypto/snapshots-ticker-full-book-l2
Crypto - Ticker Full Book (L2) https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto_tickers__ticker__book https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Crypto - Ticker Full Book (L2) https://polygon.io/docs/crypto/get_v2_snapshot_locale_global_markets_crypto_tickers__ticker__book https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/crypto/technical-indicators-ema
Crypto - Exponential Moving Average (EMA) https://polygon.io/docs/crypto/get_v1_indicators_ema__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Crypto - Exponential Moving Average (EMA) https://polygon.io/docs/crypto/get_v1_indicators_ema__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/crypto/technical-indicators-macd
Crypto - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/crypto/get_v1_indicators_macd__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Crypto - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/crypto/get_v1_indicators_macd__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/crypto/technical-indicators-rsi
Crypto - Relative Strength Index (RSI) https://polygon.io/docs/crypto/get_v1_indicators_rsi__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Crypto - Relative Strength Index (RSI) https://polygon.io/docs/crypto/get_v1_indicators_rsi__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/crypto/technical-indicators-sma
Crypto - Simple Moving Average (SMA) https://polygon.io/docs/crypto/get_v1_indicators_sma__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Crypto - Simple Moving Average (SMA) https://polygon.io/docs/crypto/get_v1_indicators_sma__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/crypto/tickers
Crypto - Tickers https://polygon.io/docs/crypto/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Crypto - Tickers https://polygon.io/docs/crypto/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/crypto/trades
Crypto - Trades https://polygon.io/docs/crypto/get_v3_trades__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
Crypto - Trades https://polygon.io/docs/crypto/get_v3_trades__cryptoticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
example/forex/aggregates-bars
Forex - Aggregates (Bars) https://polygon.io/docs/forex/get_v2_aggs_ticker__forexticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Forex - Aggregates (Bars) https://polygon.io/docs/forex/get_v2_aggs_ticker__forexticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/forex/conditions
Forex - Conditions https://polygon.io/docs/forex/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Forex - Conditions https://polygon.io/docs/forex/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/forex/exchanges
Forex - Exchanges https://polygon.io/docs/forex/get_v3_reference_exchanges
Forex - Exchanges https://polygon.io/docs/forex/get_v3_reference_exchanges
example/forex/grouped-daily-bars
Forex - Grouped Daily (Bars) https://polygon.io/docs/forex/get_v2_aggs_grouped_locale_global_market_fx__date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Forex - Grouped Daily (Bars) https://polygon.io/docs/forex/get_v2_aggs_grouped_locale_global_market_fx__date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/forex/last-quote-for-a-currency-pair
Forex - Last Quote for a Currency Pair https://polygon.io/docs/forex/get_v1_last_quote_currencies__from___to https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
Forex - Last Quote for a Currency Pair https://polygon.io/docs/forex/get_v1_last_quote_currencies__from___to https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
example/forex/market-holidays
Forex - Market Holidays https://polygon.io/docs/forex/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Forex - Market Holidays https://polygon.io/docs/forex/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/forex/market-status
Forex - Market Status https://polygon.io/docs/forex/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Forex - Market Status https://polygon.io/docs/forex/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/forex/previous-close
Forex - Previous Close https://polygon.io/docs/forex/get_v2_aggs_ticker__forexticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Forex - Previous Close https://polygon.io/docs/forex/get_v2_aggs_ticker__forexticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/forex/quotes
Forex - Quotes (BBO) https://polygon.io/docs/forex/get_v3_quotes__fxticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
Forex - Quotes (BBO) https://polygon.io/docs/forex/get_v3_quotes__fxticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
example/forex/real-time-currency-conversion
Forex - Real-time Currency Conversion https://polygon.io/docs/forex/get_v1_conversion__from___to https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
Forex - Real-time Currency Conversion https://polygon.io/docs/forex/get_v1_conversion__from___to https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
example/forex/snapshots-all-tickers
Forex - Snapshot All Tickers https://polygon.io/docs/forex/get_v2_snapshot_locale_global_markets_forex_tickers https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Forex - Snapshot All Tickers https://polygon.io/docs/forex/get_v2_snapshot_locale_global_markets_forex_tickers https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/forex/snapshots-gainers-losers
Forex - Snapshot Gainers/Losers https://polygon.io/docs/forex/get_v2_snapshot_locale_global_markets_forex__direction https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Forex - Snapshot Gainers/Losers https://polygon.io/docs/forex/get_v2_snapshot_locale_global_markets_forex__direction https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/forex/snapshots-ticker
Forex - Snapshot Ticker https://polygon.io/docs/forex/get_v2_snapshot_locale_global_markets_forex_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Forex - Snapshot Ticker https://polygon.io/docs/forex/get_v2_snapshot_locale_global_markets_forex_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/forex/technical-indicators-ema
Forex - Exponential Moving Average (EMA) https://polygon.io/docs/forex/get_v1_indicators_ema__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Forex - Exponential Moving Average (EMA) https://polygon.io/docs/forex/get_v1_indicators_ema__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/forex/technical-indicators-macd
Forex - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/forex/get_v1_indicators_macd__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Forex - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/forex/get_v1_indicators_macd__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/forex/technical-indicators-rsi
Forex - Relative Strength Index (RSI) https://polygon.io/docs/forex/get_v1_indicators_rsi__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Forex - Relative Strength Index (RSI) https://polygon.io/docs/forex/get_v1_indicators_rsi__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/forex/technical-indicators-sma
Forex - Simple Moving Average (SMA) https://polygon.io/docs/forex/get_v1_indicators_sma__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Forex - Simple Moving Average (SMA) https://polygon.io/docs/forex/get_v1_indicators_sma__fxticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/forex/tickers
Forex - Tickers https://polygon.io/docs/forex/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Forex - Tickers https://polygon.io/docs/forex/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/indices/aggregates-bars
Indices - Aggregates (Bars) https://polygon.io/docs/indices/get_v2_aggs_ticker__indicesticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Indices - Aggregates (Bars) https://polygon.io/docs/indices/get_v2_aggs_ticker__indicesticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/indices/daily-open-close
Indices - Daily Open/Close https://polygon.io/docs/indices/get_v1_open-close__indicesticker___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Indices - Daily Open/Close https://polygon.io/docs/indices/get_v1_open-close__indicesticker___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/indices/market-holidays
Indices - Market Holidays https://polygon.io/docs/indices/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Indices - Market Holidays https://polygon.io/docs/indices/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/indices/market-status
Indices - Market Status https://polygon.io/docs/indices/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Indices - Market Status https://polygon.io/docs/indices/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/indices/previous-close
Indices - Previous Close https://polygon.io/docs/indices/get_v2_aggs_ticker__indicesticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Indices - Previous Close https://polygon.io/docs/indices/get_v2_aggs_ticker__indicesticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/indices/snapshots
Indices - Snapshot https://polygon.io/docs/indices/get_v3_snapshot_indices https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Indices - Snapshot https://polygon.io/docs/indices/get_v3_snapshot_indices https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/indices/technical-indicators-ema
Indices - Exponential Moving Average (EMA) https://polygon.io/docs/indices/get_v1_indicators_ema__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Indices - Exponential Moving Average (EMA) https://polygon.io/docs/indices/get_v1_indicators_ema__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/indices/technical-indicators-macd
Indices - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/indices/get_v1_indicators_macd__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Indices - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/indices/get_v1_indicators_macd__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/indices/technical-indicators-rsi
Indices - Relative Strength Index (RSI) https://polygon.io/docs/indices/get_v1_indicators_rsi__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Indices - Relative Strength Index (RSI) https://polygon.io/docs/indices/get_v1_indicators_rsi__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/indices/technical-indicators-sma
Indices - Simple Moving Average (SMA) https://polygon.io/docs/indices/get_v1_indicators_sma__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Indices - Simple Moving Average (SMA) https://polygon.io/docs/indices/get_v1_indicators_sma__indicesticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/indices/ticker-types
Indices - Ticker Types https://polygon.io/docs/indices/get_v3_reference_tickers_types https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Indices - Ticker Types https://polygon.io/docs/indices/get_v3_reference_tickers_types https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/indices/tickers
Indices - Tickers https://polygon.io/docs/indices/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Indices - Tickers https://polygon.io/docs/indices/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/aggregates-bars
Options - Aggregates (Bars) https://polygon.io/docs/options/get_v2_aggs_ticker__optionsticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Options - Aggregates (Bars) https://polygon.io/docs/options/get_v2_aggs_ticker__optionsticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/options/conditions
Options - Conditions https://polygon.io/docs/options/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Conditions https://polygon.io/docs/options/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/contract
Options - Options Contract https://polygon.io/docs/options/get_v3_reference_options_contracts__options_ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Options Contract https://polygon.io/docs/options/get_v3_reference_options_contracts__options_ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/contracts
Options - Options Contracts https://polygon.io/docs/options/get_v3_reference_options_contracts https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Options Contracts https://polygon.io/docs/options/get_v3_reference_options_contracts https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/daily-open-close
Options - Daily Open/Close https://polygon.io/docs/options/get_v1_open-close__optionsticker___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Options - Daily Open/Close https://polygon.io/docs/options/get_v1_open-close__optionsticker___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/options/exchanges
Options - Exchanges https://polygon.io/docs/options/get_v3_reference_exchanges https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Exchanges https://polygon.io/docs/options/get_v3_reference_exchanges https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/last-trade
Options - Last Trade https://polygon.io/docs/options/get_v2_last_trade__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
Options - Last Trade https://polygon.io/docs/options/get_v2_last_trade__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
example/options/market-holidays
Options - Market Holidays https://polygon.io/docs/options/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Market Holidays https://polygon.io/docs/options/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/market-status
Options - Market Status https://polygon.io/docs/options/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Market Status https://polygon.io/docs/options/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/previous-close
Options - Previous Close https://polygon.io/docs/options/get_v2_aggs_ticker__optionsticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Options - Previous Close https://polygon.io/docs/options/get_v2_aggs_ticker__optionsticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/options/quotes
Options - Quotes https://polygon.io/docs/options/get_v3_quotes__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
Options - Quotes https://polygon.io/docs/options/get_v3_quotes__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
example/options/snapshots-option-contract
Options - Option Contract https://polygon.io/docs/options/get_v3_snapshot_options__underlyingasset___optioncontract https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Options - Option Contract https://polygon.io/docs/options/get_v3_snapshot_options__underlyingasset___optioncontract https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/options/snapshots-options-chain
Options - Options Chain https://polygon.io/docs/options/get_v3_snapshot_options__underlyingasset https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Options - Options Chain https://polygon.io/docs/options/get_v3_snapshot_options__underlyingasset https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/options/technical-indicators-ema
Options - Exponential Moving Average (EMA) https://polygon.io/docs/options/get_v1_indicators_ema__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Options - Exponential Moving Average (EMA) https://polygon.io/docs/options/get_v1_indicators_ema__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/options/technical-indicators-macd
Options - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/options/get_v1_indicators_macd__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Options - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/options/get_v1_indicators_macd__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/options/technical-indicators-rsi
Options - Relative Strength Index (RSI) https://polygon.io/docs/options/get_v1_indicators_rsi__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Options - Relative Strength Index (RSI) https://polygon.io/docs/options/get_v1_indicators_rsi__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/options/technical-indicators-sma
Options - Simple Moving Average (SMA) https://polygon.io/docs/options/get_v1_indicators_sma__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Options - Simple Moving Average (SMA) https://polygon.io/docs/options/get_v1_indicators_sma__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/options/ticker-details
Options - Ticker Details v3 https://polygon.io/docs/options/get_v3_reference_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Ticker Details v3 https://polygon.io/docs/options/get_v3_reference_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/ticker-news
Options - Ticker News https://polygon.io/docs/options/get_v3_reference_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Ticker News https://polygon.io/docs/options/get_v3_reference_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/tickers
Options - Tickers https://polygon.io/docs/options/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Options - Tickers https://polygon.io/docs/options/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/options/trades
Options - Trades https://polygon.io/docs/options/get_v3_trades__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
Options - Trades https://polygon.io/docs/options/get_v3_trades__optionsticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
example/stocks/aggregates-bars
Stocks - Aggregates (Bars) https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Stocks - Aggregates (Bars) https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__range__multiplier___timespan___from___to https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/stocks/conditions
Stocks - Conditions https://polygon.io/docs/stocks/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Conditions https://polygon.io/docs/stocks/get_v3_reference_conditions https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/daily-open-close
Stocks - Daily Open/Close https://polygon.io/docs/stocks/get_v1_open-close__stocksticker___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Stocks - Daily Open/Close https://polygon.io/docs/stocks/get_v1_open-close__stocksticker___date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/stocks/dividends
Stocks - Dividends v3 https://polygon.io/docs/stocks/get_v3_reference_dividends https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Dividends v3 https://polygon.io/docs/stocks/get_v3_reference_dividends https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/exchanges
Stocks - Exchanges https://polygon.io/docs/stocks/get_v3_reference_exchanges
Stocks - Exchanges https://polygon.io/docs/stocks/get_v3_reference_exchanges
example/stocks/grouped-daily-bars
Stocks - Grouped Daily (Bars) https://polygon.io/docs/stocks/get_v2_aggs_grouped_locale_us_market_stocks__date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Stocks - Grouped Daily (Bars) https://polygon.io/docs/stocks/get_v2_aggs_grouped_locale_us_market_stocks__date https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/stocks/last-quote
Stocks - Last Quote (NBBO) https://polygon.io/docs/stocks/get_v2_last_nbbo__stocksticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
Stocks - Last Quote (NBBO) https://polygon.io/docs/stocks/get_v2_last_nbbo__stocksticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
example/stocks/last-trade
Stocks - Last Trade https://polygon.io/docs/stocks/get_v2_last_trade__stocksticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
Stocks - Last Trade https://polygon.io/docs/stocks/get_v2_last_trade__stocksticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
example/stocks/market-holidays
Stocks - Market Holidays https://polygon.io/docs/stocks/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Market Holidays https://polygon.io/docs/stocks/get_v1_marketstatus_upcoming https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/market-status
Stocks - Market Status https://polygon.io/docs/stocks/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Market Status https://polygon.io/docs/stocks/get_v1_marketstatus_now https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/previous-close
Stocks - Previous Close https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
Stocks - Previous Close https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__prev https://github.com/polygon-io/client-go/blob/master/rest/aggs.go
example/stocks/quotes
Stocks - Quotes (NBBO) https://polygon.io/docs/stocks/get_v3_quotes__stockticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
Stocks - Quotes (NBBO) https://polygon.io/docs/stocks/get_v3_quotes__stockticker https://github.com/polygon-io/client-go/blob/master/rest/quotes.go
example/stocks/related-companies
Stocks - Related Companies https://polygon.io/docs/stocks/get_v1_related-companies__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Related Companies https://polygon.io/docs/stocks/get_v1_related-companies__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/snapshots-all
Stocks - Snapshot All Tickers https://polygon.io/docs/stocks/get_v2_snapshot_locale_us_markets_stocks_tickers https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Stocks - Snapshot All Tickers https://polygon.io/docs/stocks/get_v2_snapshot_locale_us_markets_stocks_tickers https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/stocks/snapshots-gainers-losers
Stocks - Snapshot Gainers/Losers https://polygon.io/docs/stocks/get_v2_snapshot_locale_us_markets_stocks__direction https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Stocks - Snapshot Gainers/Losers https://polygon.io/docs/stocks/get_v2_snapshot_locale_us_markets_stocks__direction https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/stocks/snapshots-ticker
Stocks - Snapshot Ticker https://polygon.io/docs/stocks/get_v2_snapshot_locale_us_markets_stocks_tickers__stocksticker https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
Stocks - Snapshot Ticker https://polygon.io/docs/stocks/get_v2_snapshot_locale_us_markets_stocks_tickers__stocksticker https://github.com/polygon-io/client-go/blob/master/rest/snapshot.go
example/stocks/stock-financials
Stocks - Stock Financials vX https://polygon.io/docs/stocks/get_vx_reference_financials https://github.com/polygon-io/client-go/blob/master/rest/vx.go
Stocks - Stock Financials vX https://polygon.io/docs/stocks/get_vx_reference_financials https://github.com/polygon-io/client-go/blob/master/rest/vx.go
example/stocks/stock-splits
Stocks - Stock Splits v3 https://polygon.io/docs/stocks/get_v3_reference_splits https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Stock Splits v3 https://polygon.io/docs/stocks/get_v3_reference_splits https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/technical-indicators-ema
Stocks - Exponential Moving Average (EMA) https://polygon.io/docs/stocks/get_v1_indicators_ema__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Stocks - Exponential Moving Average (EMA) https://polygon.io/docs/stocks/get_v1_indicators_ema__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/stocks/technical-indicators-macd
Stocks - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/stocks/get_v1_indicators_macd__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Stocks - Moving Average Convergence/Divergence (MACD) https://polygon.io/docs/stocks/get_v1_indicators_macd__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/stocks/technical-indicators-rsi
Stocks - Relative Strength Index (RSI) https://polygon.io/docs/stocks/get_v1_indicators_rsi__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Stocks - Relative Strength Index (RSI) https://polygon.io/docs/stocks/get_v1_indicators_rsi__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/stocks/technical-indicators-sma
Stocks - Simple Moving Average (SMA) https://polygon.io/docs/stocks/get_v1_indicators_sma__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
Stocks - Simple Moving Average (SMA) https://polygon.io/docs/stocks/get_v1_indicators_sma__stockticker https://github.com/polygon-io/client-go/blob/master/rest/indicators.go
example/stocks/ticker-details
Stocks - Ticker Details v3 https://polygon.io/docs/stocks/get_v3_reference_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Ticker Details v3 https://polygon.io/docs/stocks/get_v3_reference_tickers__ticker https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/ticker-events
Stocks - Ticker Events https://polygon.io/docs/stocks/get_vx_reference_tickers__id__events https://github.com/polygon-io/client-go/blob/master/rest/vx.go
Stocks - Ticker Events https://polygon.io/docs/stocks/get_vx_reference_tickers__id__events https://github.com/polygon-io/client-go/blob/master/rest/vx.go
example/stocks/ticker-news
Stocks - Ticker News https://polygon.io/docs/stocks/get_v2_reference_news https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Ticker News https://polygon.io/docs/stocks/get_v2_reference_news https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/ticker-types
Stocks - Ticker Types https://polygon.io/docs/stocks/get_v3_reference_tickers_types https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Ticker Types https://polygon.io/docs/stocks/get_v3_reference_tickers_types https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/tickers
Stocks - Tickers https://polygon.io/docs/stocks/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
Stocks - Tickers https://polygon.io/docs/stocks/get_v3_reference_tickers https://github.com/polygon-io/client-go/blob/master/rest/reference.go
example/stocks/trades
Stocks - Trades https://polygon.io/docs/stocks/get_v3_trades__stockticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go
Stocks - Trades https://polygon.io/docs/stocks/get_v3_trades__stockticker https://github.com/polygon-io/client-go/blob/master/rest/trades.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL