C# SDK for Alpaca Trade API https://docs.alpaca.markets/
$ dotnet add package Alpaca.Markets.Extensions
utm_source=website&utm_medium=github&utm_campaign=open_source)
This package contains helper extensions methods for the C#/.NET SDK for Alpaca Trade API. See complete online documentation here.
dotnet new console.dotnet add package Alpaca.Markets.Program.cs file with this code snippet:using System;
using Alpaca.Markets;
using System.Threading.Tasks;
namespace AlpacaExample
{
internal static class Program
{
private const String KEY_ID = "";
private const String SECRET_KEY = "";
public static async Task Main()
{
var client = Environments.Paper
.GetAlpacaTradingClient(new SecretKey(KEY_ID, SECRET_KEY));
var clock = await client.GetClockAsync();
if (clock != null)
{
Console.WriteLine(
"Timestamp: {0}, NextOpen: {1}, NextClose: {2}",
clock.TimestampUtc, clock.NextOpenUtc, clock.NextCloseUtc);
}
}
}
}KEY_ID and SECRET_KEY values with your data from the Alpaca dashboard.dotnet run command and check the output. You should see information about the current market timestamp and when the market will open and close next.See the UsageExamples project for near-to-real-world strategy implementation using this SDK and the Alpaca.Markets.Tests repository for SDK usage examples. The Wiki pages contain a lot of additional information about different aspects of this SDK (environments handling, authentication types, different order placement approaches, streaming client subscriptions handling, etc.).
Thanks a lot for all the contributors. See the complete list of project supporters in the CONTRIBUTORS file.