- Create a new console application in a new, empty folder by running
dotnet new console
. - Add a reference for Alpaca .NET SDK with
dotnet add package Alpaca.Markets
. - Change
Main
method in auto-generatedProgramm.cs
file to this code snippet:
var client = Alpaca.Markets.Environments.Paper
.GetAlpacaTradingClient(new SecretKey(KEY_ID, SECRET_KEY));
var clock = client.GetClockAsync().Result;
if (clock != null)
{
Console.WriteLine(
"Timestamp: {0}, NextOpen: {1}, NextClose: {2}",
clock.Timestamp, clock.NextOpen, clock.NextClose);
}
- Replace
KEY_ID
andSECRET_KEY
values with your own data from the Alpaca dashboard. - 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.
See the UsageExamples project for near-to-real-world strategy implementation using this SDK. The Wiki pages contains a lot of additonal information about different aspects of this SDK (environments handling, authentication types, different order placement approaches, streaming client subscriptions handling, etc.).
Branch | Version | Description |
---|---|---|
develop | 3.9.* | New features, breaking changes |
master | 3.8.* | All new features and hot-fixes |
support/v3.7.x | 3.7.* | Hot fixes only, some features |