Polygon.Client.DependencyInjection 1.0.0-preview.2

This is a prerelease version of Polygon.Client.DependencyInjection.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Polygon.Client.DependencyInjection --version 1.0.0-preview.2                
NuGet\Install-Package Polygon.Client.DependencyInjection -Version 1.0.0-preview.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Polygon.Client.DependencyInjection" Version="1.0.0-preview.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Polygon.Client.DependencyInjection --version 1.0.0-preview.2                
#r "nuget: Polygon.Client.DependencyInjection, 1.0.0-preview.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Polygon.Client.DependencyInjection as a Cake Addin
#addin nuget:?package=Polygon.Client.DependencyInjection&version=1.0.0-preview.2&prerelease

// Install Polygon.Client.DependencyInjection as a Cake Tool
#tool nuget:?package=Polygon.Client.DependencyInjection&version=1.0.0-preview.2&prerelease                

polygon-dotnet-client

image

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

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

Install the Polygon.Client.Dependency NuGet package.

Package Manager PM > Install-Package Polygon.Client.DependencyInjection

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;
	}
}

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

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 1,253 3/28/2024
1.0.0 135 3/27/2024
1.0.0-preview.2 62 3/27/2024
1.0.0-preview.1 61 3/27/2024

Add initial extension method to allow dependency injection