- 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(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);
}
- 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.
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 |
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 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.