- Create new console application using command
dotnet new consolein new empty folder. - Add reference for Alpaca .NET SDK using
dotnet add package Alpaca.Marketscommand. - Change
Mainmethod in auto-generatedProgramm.csfile 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_KEYandAPI_URLvalues with data from web console. - Run sample application using
dotnet runcommand 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.
Starting from version 1.2.3 and 2.0.0 NuGet packages contains strongly signed assemblies only for .NET Standard 1.6 and 2.0 targets, .NET Framework 4.5 version of Alpaca.Markets.dll packaged unsigned because dependent assembly NATS.Client.dll also shipped unsigned.