Skip to content

rwitzlib/polygon-dotnet-client

Repository files navigation

polygon-dotnet-client

Build MIT License

image

.NET client for getting stocks, crypto, forex, and indices data from Polygon.io API.

Independently developed, this is not an official library and I am not affiliated with Polygon.

Prerequisites

Create an account with Polygon. Upon account creation, an API key will be provided for you.

You can manage your API keys on the Dashboard

Setup

Install the Polygon.Client NuGet package

Package Manager PM > Install-Package Polygon.Client

Using the API key that was generated for you earlier, you can create a Polygon client in the following ways.

Without Dependency Injection

using var client = new PolygonClient("API KEY GOES HERE");

With Dependency Injection

services.AddPolygonClient("API KEY GOES HERE");

Usage

public class SomeClass
{
    private readonly IPolygonClient _polygonClient;

    public SomeClass(IPolygonClient polygonClient)
    {
        _polygonClient = polygonClient;
    }

    public async Task<PolygonAggregateResponse> DoSomething()
    {
        // This will get all of the 1-minute bars for 2024-04-20

        var request = new PolygonAggregatesRequest
        {
            Ticker = "SPY",
            Multuplier = 1
            Timespan = "minute",
            From = "2024-04-20",
            To = "2024-04-20"
        };
        
        var response = await _polygonClient.GetAggregatesAsync(request);

        return response;
    }
}

Supported Endpoints

Market Data Endpoints Supported?
Aggregates ✔️
Grouped Daily ✔️
Daily Open/Close
Previous Close
Trades
Last Trade
Quotes (NBBO)
Last Quote
Snapshot - All Tickers ✔️
Snapshot - Gainers/Losers
Snapshot - Ticker
Snapshot - Universal
Technical Indicators - SMA
Technical Indicators - EMA
Technical Indicators - MACD
Technical Indicators - RSI
Reference Data Endpoints Supported?
Tickers ✔️
Ticker Details V3 ✔️
Ticker Events
Ticker News
Ticker Types
Market Holidays
Market Status
Stock Splits V3
Dividends V3
Stock Financials VX
Conditions
Exchanges

About

.NET client for Polygon.io API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages