FactSet.SDK.Utils
1.0.0
Prefix Reserved
dotnet add package FactSet.SDK.Utils --version 1.0.0
NuGet\Install-Package FactSet.SDK.Utils -Version 1.0.0
<PackageReference Include="FactSet.SDK.Utils" Version="1.0.0" />
paket add FactSet.SDK.Utils --version 1.0.0
#r "nuget: FactSet.SDK.Utils, 1.0.0"
// Install FactSet.SDK.Utils as a Cake Addin #addin nuget:?package=FactSet.SDK.Utils&version=1.0.0 // Install FactSet.SDK.Utils as a Cake Tool #tool nuget:?package=FactSet.SDK.Utils&version=1.0.0
<img alt="FactSet" src="https://www.factset.com/hubfs/Assets/images/factset-logo.svg" height="56" width="290">
FactSet SDK Utilities for .NET
This repository contains a collection of utilities that supports FactSet's SDK in .NET and facilitate usage of FactSet APIs.
Installation
.NET CLI
dotnet add package FactSet.SDK.Utils
NuGet
nuget install FactSet.SDK.Utils
Usage
This library contains multiple modules, sample usage of each module is below.
Authentication
First, you need to create the OAuth 2.0 client configuration that will be used to authenticate against FactSet's APIs:
- Create a new application on FactSet's Developer Portal.
- When prompted, download the configuration file and move it to your development environment.
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using FactSet.SDK.Utils.Authentication;
namespace Example
{
static class Program
{
static async Task Main(string[] args)
{
ConfidentialClient confidentialClient = await ConfidentialClient.CreateAsync("./path/to/config.json");
string token = await confidentialClient.GetAccessTokenAsync();
HttpClient client = new HttpClient();
HttpResponseMessage res;
using (var requestMessage = new HttpRequestMessage(HttpMethod.Get,
"https://api.factset.com/analytics/lookups/v3/currencies"))
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
res = await client.SendAsync(requestMessage);
}
Console.WriteLine(await res.Content.ReadAsStringAsync());
}
}
}
Modules
Information about the various utility modules contained in this library can be found below.
Authentication
The authentication module provides helper classes that facilitate OAuth 2.0 authentication and authorization with FactSet's APIs. Currently the module has support for the client credentials flow.
Each helper class in the module has the following features:
- Accepts a
Configuration
instance that contains information about the OAuth 2.0 client, including the client ID and private key. - Performs authentication with FactSet's OAuth 2.0 authorization server and retrieves an access token.
- Caches the access token for reuse and requests a new access token as needed when one expires.
Configuration
Classes in the authentication module require OAuth 2.0 client configuration information to be passed to the CreateAsync
factory method in the ConfidentialClient
through a JSON-formatted file or a Configuration
object. Below is an example of a JSON-formatted file:
{
"name": "Application name registered with FactSet's Developer Portal",
"clientId": "OAuth 2.0 Client ID registered with FactSet's Developer Portal",
"clientAuthType": "Confidential",
"owners": ["USERNAME-SERIAL"],
"jwk": {
"kty": "RSA",
"use": "sig",
"alg": "RS256",
"kid": "Key ID",
"d": "ECC Private Key",
"n": "Modulus",
"e": "Exponent",
"p": "First Prime Factor",
"q": "Second Prime Factor",
"dp": "First Factor CRT Exponent",
"dq": "Second Factor CRT Exponent",
"qi": "First CRT Coefficient"
}
}
The other option is to pass in the Configuration
instance which is initialised as shown below:
using System.Collections.Generic;
using FactSet.SDK.Utils.Authentication;
using Microsoft.IdentityModel.Tokens;
// Fill values with values from your generated config.
var jwk = new JsonWebKey(@"
{
'kty': 'RSA',
'use': 'sig',
'alg': 'RS256',
'kid': 'Key ID',
'd': 'ECC Private Key',
'n': 'Modulus',
'e': 'AQAB',
'p': 'First Prime Factor',
'q': 'Second Prime Factor',
'dp': 'First Factor CRT Exponent',
'dq': 'Second Factor CRT Exponent',
'qi': 'First CRT Coefficient'
}");
var config = new Configuration("client id", "Confidential", jwk);
If you're just starting out, you can visit FactSet's Developer Portal to create a new application and download a configuration file in this format.
If you're creating and managing your signing key pair yourself, see the required JWK parameters for public-private key pairs.
Debugging
This library uses the built-in Trace class to log various messages that will help you understand what it's doing. For more information on how to redirect the log output or change the log message severity, read the documentation linked.
Contributing
Please refer to the contributing guide.
Copyright
Copyright 2022 FactSet Research Systems Inc
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- IdentityModel (>= 6.0.0)
- Microsoft.IdentityModel.Tokens (>= 6.16.0)
- Newtonsoft.Json (>= 13.0.1)
- System.Collections.Immutable (>= 6.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.16.0)
NuGet packages (116)
Showing the top 5 NuGet packages that depend on FactSet.SDK.Utils:
Package | Downloads |
---|---|
FactSet.SDK.FactSetGlobalPrices
FactSet Global Prices client library for .NET |
|
FactSet.SDK.Symbology
Symbology client library for .NET |
|
FactSet.SDK.FactSetConcordance
FactSet Concordance client library for .NET |
|
FactSet.SDK.SPAREngine
Style Performance and Risk Analysis (SPAR) Engine client library for .NET |
|
FactSet.SDK.PAEngine
PA Engine client library for .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.