TdAmeritrade.Net 1.0.0-preview.0.16

.NET 6.0 .NET Core 3.1
This is a prerelease version of TdAmeritrade.Net.
dotnet add package TdAmeritrade.Net --version 1.0.0-preview.0.16
NuGet\Install-Package TdAmeritrade.Net -Version 1.0.0-preview.0.16
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="TdAmeritrade.Net" Version="1.0.0-preview.0.16" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TdAmeritrade.Net --version 1.0.0-preview.0.16
#r "nuget: TdAmeritrade.Net, 1.0.0-preview.0.16"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install TdAmeritrade.Net as a Cake Addin
#addin nuget:?package=TdAmeritrade.Net&version=1.0.0-preview.0.16&prerelease

// Install TdAmeritrade.Net as a Cake Tool
#tool nuget:?package=TdAmeritrade.Net&version=1.0.0-preview.0.16&prerelease


Build status NuGet

What is TdAmeritrade.Net?

TdAmeritrade.Net is an unofficial library for interacting with Td Ameritrade's APIs. It is supported for .net core 3.1, and .net 5.0+.

Where can I get it?

TdAmeritrade.Net is available at

Package Manager PM > Install-Package TdAmeritrade.Net

How it works?

You can make all calls to Td Ameritrade's API via the TdAmeritrade.TdAmeritradeApi class.

var client = new TdAmeritradeApi(
	clientId: "<client id>");

// Retrieving a user's recent transactions.
var result = await client.GetTransactions(
	refreshToken: "<refreshToken>",
	accountId: "<account_id>");

The TdAmeritradeApi class is expected in general to be a short-lived object provided by the DI system on a unit-of-work basis. The access token generated from a refresh token is cached externally using an IMemoryCache provided by the DI system.

If the object is used in a short-lived console application, then a single instance can be held for the lifetime of the application. For all other uses, it is expected to use the DI system.

.NET Core Configuration Options

Easy to use:

There are three ways to add TdAmeritradeApi to the DI system:

  • services.AddTdAmeritradeApi(): In this version, Func<string, TdAmeritradeApi> and Func<string, string, TdAmeritradeApi> are added to the DI system. In this version, either the client ID or both the client ID and the refresh token can be provided to generate a TdAmeritradeApi instance for the given values.
  • services.AddTdAmeritradeApi(string clientId): In this version, TdAmeritradeApi and Func<string, TdAmeritradeApi> are added to the DI system. In this version, the client ID is fixed for all instance, and the refresh token may be added additionally for each TdAmeritradeApi instance.
  • services.AddTdAmeritradeApi(string clientId, string refreshToken): In this version, only TdAmeritradeApi is added to the DI system. All instances will be fixed to the provided client ID and refresh token.

Going.Plaid supports the IHttpClientFactory for correct usage of HttpClient, as described here. If you choose not to call .AddTdAmeritradeApi(), because you need to customize your DI structure, it is recommended that you call services.AddITdAmeritradeApiRefitClient() to properly configure the ITdAmeritradeApi refit client for TdAmeritrade.Net usage.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
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.0.0-preview.0.16 97 5/22/2022