Alpaca.Markets 8.0.0

dotnet add package Alpaca.Markets --version 8.0.0
                    
NuGet\Install-Package Alpaca.Markets -Version 8.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Alpaca.Markets" Version="8.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Alpaca.Markets" Version="8.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Alpaca.Markets" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Alpaca.Markets --version 8.0.0
                    
#r "nuget: Alpaca.Markets, 8.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Alpaca.Markets@8.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Alpaca.Markets&version=8.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Alpaca.Markets&version=8.0.0
                    
Install as a Cake Tool

Contributors Codacy Coverage

.NET SDK for Alpaca Markets API

This package contains C#/.NET SDK for Alpaca Trade API. See complete online documentation here.

.NET Core Usage Example

  1. Create a new console application in a new, empty folder by running dotnet new console.
  2. Add a reference for Alpaca .NET SDK with dotnet add package Alpaca.Markets.
  3. Replace content of the auto-generated 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);
            }
        }
    }
}
  1. Replace the KEY_ID and SECRET_KEY values with your data from the Alpaca dashboard.
  2. Run the sample application using 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.).

Contributors

Thanks a lot for all the contributors. See the complete list of project supporters in the CONTRIBUTORS file.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Alpaca.Markets:

Package Downloads
Alpaca.Markets.Extensions

C# SDK for Alpaca Trade API https://docs.alpaca.markets/

OoplesFinance.StockIndicators

Largest C# stock indicator library with over 750 to choose from and easiest to use with abilities such as making an indicator out of any other indicator or using any moving average with any indicator.

Atlas.Services.Alpaca.Library.Dto

Package Description

Cryptohaus.Core

Package Description

Cryptohaus.Infrastructure

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Alpaca.Markets:

Repository Stars
facioquo/stock-indicators-dotnet
Stock Indicators for .NET is a C# NuGet package that transforms raw equity, commodity, forex, or cryptocurrency financial market price quotes into technical indicators and trading insights. You'll need this essential data in the investment tools that you're building for algorithmic trading, technical analysis, machine learning, or visual charting.
Version Downloads Last Updated
8.0.0 1,262 9/25/2026
8.0.0-beta5 907 8/27/2026
8.0.0-beta4 3,966 9/8/2025
8.0.0-beta3 7,482 3/15/2025
8.0.0-beta2 788 1/29/2025
8.0.0-beta1 1,853 1/21/2025
7.2.2 24,998 7/9/2026
7.2.0 128,449 1/12/2025
7.2.0-beta1 326 1/5/2025
7.1.4 7,817 11/16/2024
7.1.3 598 11/10/2024
7.1.2 3,286 10/20/2024
7.1.1 3,339 9/30/2024
7.1.0 17,116 5/12/2024
7.0.6 1,822 4/7/2024
7.0.5 743 3/26/2024
Loading failed

- BREAKING: The `ICalendar`, `ITimeInterval`, `IInclusiveTimeInterval`, `IExclusiveTimeInterval`, `TimeInterval`, and `IRequestWithTimeInterval<T>` types were removed. Use `IIntervalCalendar` with `ListIntervalCalendarAsync`, and pass `Interval<DateTime>` or `DateOnly` ranges on historical, calendar, and announcement requests.
- BREAKING: Crypto latest/snapshot APIs that used `LatestDataRequest`, `LatestBestBidOfferRequest`, `SnapshotDataRequest`, or `LatestBestBidOfferListRequest` were removed. Use the list-based `LatestDataListRequest` methods for latest bars, trades, and quotes on `IAlpacaCryptoDataClient`; use `SnapshotDataListRequest` with `ListSnapshotsAsync` for snapshots. Exchange filters were removed from historical crypto request types.
- BREAKING: The `IOrder.AssetId`, `IOrder.Symbol`, `IOrder.AssetClass`, and `IOrder.OrderSide` properties are now nullable.
- BREAKING: The `IsDayPatternTrader` and `DayTradeCount` properties were removed from the `IAccount` interface because the corresponding `pattern_day_trader` and `daytrade_count` fields no longer exist in the Alpaca Trading API `Account` response.
- BREAKING: The `DayTradeMarginCallProtection` property was removed from the `IAccountConfiguration` interface, and the `DayTradeMarginCallProtection` enumeration was removed, because the Trading API no longer returns `dtbp_check` on `/v2/account/configurations`.
- BREAKING: The public `UseMessagePack` getter was removed from `StreamingClientConfiguration`.
- BREAKING: The `BaseValue` property in `IPortfolioHistory` is now nullable.
- BREAKING: Remaining fully obsolete members were removed, and obsolete usage is treated as an error.
- Target frameworks are now `netstandard2.0`, `netstandard2.1`, `net462`, `net8.0`, and `net10.0` (`net6.0` was removed).
- Options multi-leg orders are supported.
- The new `IAlpacaOptionsStreamingClient` interface provides real-time options market data streaming.
- The `IAlpacaOptionsDataClient` interface now supports historical option quotes and latest option bars.
- The new `IOrderImbalance` interface and `GetOrderImbalanceSubscription` method were added to `IAlpacaDataStreamingClient`.
- The new `Trail` property was added to the `ChangeOrderRequest` class for updating trailing-stop orders (same unit as the original order).
- The new `MarginRequirementLong` and `MarginRequirementShort` properties were added to the `IAsset` interface. The old `MaintenanceMarginRequirement` property is marked as obsolete.
- The new `DelayedSip`, `Boats`, and `Overnight` values were added to the `MarketDataFeed` enumeration.
- The new `CryptoPerpetual` value was added to the `AssetClass` enumeration (preparatory — Alpaca currently supports spot crypto trading only).
- The new `Ascx` value was added to the `Exchange` enumeration.
- The HTTP User-Agent header now follows the cross-SDK `APCA-DOTNET/<sdk-version> .NET/<runtime-version>` format.
- Fixed `IOrder.OrderClass` so REST orders and trade updates report the real class (`mleg`, `bracket`, and others) instead of always `Simple`. An empty `order_class` from the API maps to `OrderClass.Simple`.
- Fixed a bug where the `NonMarginableBuyingPower` property of the `IAccount` interface was never populated due to a JSON property name typo (`non_maginable_buying_power` instead of `non_marginable_buying_power`).
- Fixed options streaming endpoint construction so the `v1beta1` path is not duplicated.
- All dependencies were updated to the latest stable versions.