- Create new console application using command
dotnet new console
in new empty folder. - Add reference for Alpaca .NET SDK using
dotnet add package Alpaca.Markets
command. - Change
Main
method in auto-generatedProgramm.cs
file using next code snippet:
var client = new Alpaca.Markets.RestClient(
KEY_ID, SECRET_KEY, new Uri(API_URL));
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
,SECRET_KEY
andAPI_URL
values with data from web console. - Run sample application using
dotnet run
command and check output
Starting form version 1.1.0 you can use IConfiguration interface for providing configuration data into constructors. You can read more about new .NET Core configuration approach in this article. Read appropriate Wiki pages about expected configuration parameters for each constructor.