Skip to content

julio-santiesteban/alpaca-trade-api-csharp

 
 

Repository files navigation

Nuget Nuget (with prereleases) Nuget

.NET SDK for Alpaca Markets API

.NET Core Usage Example

  1. Create a new console application in a new, empty folder by running dotnet new console.
  2. Add a reference for Alpaca .NET SDK with dotnet add package Alpaca.Markets.
  3. Change Main method in auto-generated Programm.cs file to this code snippet:
var client = Alpaca.Markets.Environments.Paper
    .GetAlpacaTradingClient(KEY_ID, new SecretKey(SECRET_KEY));

var clock = client.GetClockAsync().Result;

if (clock != null)
{
    Console.WriteLine(
        "Timestamp: {0}, NextOpen: {1}, NextClose: {2}",
        clock.Timestamp, clock.NextOpen, clock.NextClose);
}
  1. Replace KEY_ID and SECRET_KEY values with your own data from the Alpaca dashboard.
  2. Run the sample application using dotnet run command and check the output. You should see information about the current market timestamp and the times that the market will open and close next.

Mapping between branches and SDK versions

Branch Version Description
develop 3.6.* New features, breaking changes
master 3.5.* All new features and hot-fixes
support/v3.4.x 3.4.* Hot fixes only, some features

Release-specific changes in SDK

Use .NET Core IConfiguration

The IConfiguration interface support marked as obsolete in SDK starting from version 3.5.0 because it's hard to maintain and can be easy implemented on client side. This support will be completely removed from SDK in upboming major release.

Polygon NATS client deprecation

Polygon is deprecating their NATS streaming in favor of Websockets, and they have finally made it possible for Alpaca users to switch to the websocket endpoint. Starting from version 3.5.0 support for NATS client streaming completely removed from SDK.

Packages

No packages published

Languages

  • C# 99.8%
  • Other 0.2%