diff --git a/Alpaca.Markets/AlpacaTradingClient.General.cs b/Alpaca.Markets/AlpacaTradingClient.General.cs index b0a88d36..3138a3af 100644 --- a/Alpaca.Markets/AlpacaTradingClient.General.cs +++ b/Alpaca.Markets/AlpacaTradingClient.General.cs @@ -114,4 +114,24 @@ await _httpClient.GetAsync, List> await request.EnsureNotNull().Validate() .GetUriBuilderAsync(_httpClient).ConfigureAwait(false), _rateLimitHandler, cancellationToken).ConfigureAwait(false); + + public async Task> ListOptionContractsAsync( + OptionContractsRequest request, + CancellationToken cancellationToken = default) => + (await _httpClient.GetAsync( + await request.EnsureNotNull().Validate() + .GetUriBuilderAsync(_httpClient).ConfigureAwait(false), + _rateLimitHandler, cancellationToken).ConfigureAwait(false)).Contracts; + + public Task GetOptionContractByIdAsync( + Guid contractId, + CancellationToken cancellationToken = default) => + _httpClient.GetAsync( + $"v2/options/contracts/{contractId:D}", _rateLimitHandler, cancellationToken); + + public Task GetOptionContractBySymbolAsync( + String symbol, + CancellationToken cancellationToken = default) => + _httpClient.GetAsync( + $"v2/options/contracts/{symbol.EnsureNotNull()}", _rateLimitHandler, cancellationToken); } diff --git a/Alpaca.Markets/CompatibilitySuppressions.xml b/Alpaca.Markets/CompatibilitySuppressions.xml index 473bf5c4..461aeee6 100644 --- a/Alpaca.Markets/CompatibilitySuppressions.xml +++ b/Alpaca.Markets/CompatibilitySuppressions.xml @@ -1,6 +1,27 @@  + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.GetOptionContractByIdAsync(System.Guid,System.Threading.CancellationToken) + lib/net6.0/Alpaca.Markets.dll + lib/net6.0/Alpaca.Markets.dll + true + + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.GetOptionContractBySymbolAsync(System.String,System.Threading.CancellationToken) + lib/net6.0/Alpaca.Markets.dll + lib/net6.0/Alpaca.Markets.dll + true + + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.ListOptionContractsAsync(Alpaca.Markets.OptionContractsRequest,System.Threading.CancellationToken) + lib/net6.0/Alpaca.Markets.dll + lib/net6.0/Alpaca.Markets.dll + true + CP0006 P:Alpaca.Markets.IAccount.OptionsApprovedLevel @@ -29,6 +50,27 @@ lib/net6.0/Alpaca.Markets.dll true + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.GetOptionContractByIdAsync(System.Guid,System.Threading.CancellationToken) + lib/netstandard2.0/Alpaca.Markets.dll + lib/netstandard2.0/Alpaca.Markets.dll + true + + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.GetOptionContractBySymbolAsync(System.String,System.Threading.CancellationToken) + lib/netstandard2.0/Alpaca.Markets.dll + lib/netstandard2.0/Alpaca.Markets.dll + true + + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.ListOptionContractsAsync(Alpaca.Markets.OptionContractsRequest,System.Threading.CancellationToken) + lib/netstandard2.0/Alpaca.Markets.dll + lib/netstandard2.0/Alpaca.Markets.dll + true + CP0006 P:Alpaca.Markets.IAccount.OptionsApprovedLevel @@ -57,6 +99,27 @@ lib/netstandard2.0/Alpaca.Markets.dll true + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.GetOptionContractByIdAsync(System.Guid,System.Threading.CancellationToken) + lib/netstandard2.1/Alpaca.Markets.dll + lib/netstandard2.1/Alpaca.Markets.dll + true + + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.GetOptionContractBySymbolAsync(System.String,System.Threading.CancellationToken) + lib/netstandard2.1/Alpaca.Markets.dll + lib/netstandard2.1/Alpaca.Markets.dll + true + + + CP0006 + M:Alpaca.Markets.IAlpacaTradingClient.ListOptionContractsAsync(Alpaca.Markets.OptionContractsRequest,System.Threading.CancellationToken) + lib/netstandard2.1/Alpaca.Markets.dll + lib/netstandard2.1/Alpaca.Markets.dll + true + CP0006 P:Alpaca.Markets.IAccount.OptionsApprovedLevel diff --git a/Alpaca.Markets/Enums/OptionStyle.cs b/Alpaca.Markets/Enums/OptionStyle.cs new file mode 100644 index 00000000..1d062c54 --- /dev/null +++ b/Alpaca.Markets/Enums/OptionStyle.cs @@ -0,0 +1,22 @@ +namespace Alpaca.Markets; + +/// +/// Supported option contract styles for Alpaca REST API. +/// +[JsonConverter(typeof(StringEnumConverter))] +public enum OptionStyle +{ + /// + /// American option contract execution style. + /// + [UsedImplicitly] + [EnumMember(Value = "american")] + American, + + /// + /// European option contract execution style. + /// + [UsedImplicitly] + [EnumMember(Value = "european")] + European +} diff --git a/Alpaca.Markets/Enums/OptionType.cs b/Alpaca.Markets/Enums/OptionType.cs new file mode 100644 index 00000000..acbb3cf6 --- /dev/null +++ b/Alpaca.Markets/Enums/OptionType.cs @@ -0,0 +1,22 @@ +namespace Alpaca.Markets; + +/// +/// Supported option contract types for Alpaca REST API. +/// +[JsonConverter(typeof(StringEnumConverter))] +public enum OptionType +{ + /// + /// Call option contract. + /// + [UsedImplicitly] + [EnumMember(Value = "call")] + Call, + + /// + /// Put option contract. + /// + [UsedImplicitly] + [EnumMember(Value = "put")] + Put +} diff --git a/Alpaca.Markets/Interfaces/IAlpacaTradingClient.cs b/Alpaca.Markets/Interfaces/IAlpacaTradingClient.cs index b1798cc0..230fd3f0 100644 --- a/Alpaca.Markets/Interfaces/IAlpacaTradingClient.cs +++ b/Alpaca.Markets/Interfaces/IAlpacaTradingClient.cs @@ -26,7 +26,6 @@ public interface IAlpacaTradingClient : IRateLimitProvider, IDisposable [UsedImplicitly] Task> ListWatchListsAsync( CancellationToken cancellationToken = default); - /// /// Add new watch list object into Alpaca REST API endpoint. /// @@ -929,4 +928,79 @@ Task GetAnnouncementAsync( Task> ListAnnouncementsAsync( AnnouncementsRequest request, CancellationToken cancellationToken = default); + + /// + /// Gets list of active option contracts from Alpaca REST API endpoint. By default, only active contracts that expire before the upcoming weekend are returned. + /// + /// Option contracts request parameters. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// The argument contains invalid data or some required data is missing, unable to create a valid HTTP request. + /// + /// + /// The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout. + /// + /// + /// The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. + /// + /// + /// The initial TPC socket connection failed due to an underlying low-level network connectivity issue. + /// + /// + /// .NET Core and .NET 5 and later only: The request failed due to timeout. + /// + /// + /// The argument is null. + /// + /// Read-only list of corporate action information objects. + [UsedImplicitly] + Task> ListOptionContractsAsync( + OptionContractsRequest request, + CancellationToken cancellationToken = default); + + /// + /// Gets option contract from Alpaca REST API endpoint using contract identifier. + /// + /// Option contract unique identifier. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout. + /// + /// + /// The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. + /// + /// + /// The initial TPC socket connection failed due to an underlying low-level network connectivity issue. + /// + /// + /// .NET Core and .NET 5 and later only: The request failed due to timeout. + /// + /// Read-only list of corporate action information objects. + [UsedImplicitly] + Task GetOptionContractByIdAsync( + Guid contractId, + CancellationToken cancellationToken = default); + + /// + /// Gets option contract from Alpaca REST API endpoint using contract symbol name. + /// + /// Option contract unique symbol name. + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout. + /// + /// + /// The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. + /// + /// + /// The initial TPC socket connection failed due to an underlying low-level network connectivity issue. + /// + /// + /// .NET Core and .NET 5 and later only: The request failed due to timeout. + /// + /// Read-only list of corporate action information objects. + [UsedImplicitly] + Task GetOptionContractBySymbolAsync( + String symbol, + CancellationToken cancellationToken = default); } diff --git a/Alpaca.Markets/Interfaces/IOptionContract.cs b/Alpaca.Markets/Interfaces/IOptionContract.cs new file mode 100644 index 00000000..22967f74 --- /dev/null +++ b/Alpaca.Markets/Interfaces/IOptionContract.cs @@ -0,0 +1,108 @@ +namespace Alpaca.Markets; + +/// +/// +/// +public interface IOptionContract +{ + /// + /// Gets unique option contract identifier used by Alpaca. + /// + [UsedImplicitly] + Guid ContractId { get; } + + /// + /// Get option contract symbol. + /// + String Symbol { get; } + + /// + /// Gets option contract name. + /// + [UsedImplicitly] + String Name { get; } + + /// + /// Get option contract status in API. + /// + [UsedImplicitly] + AssetStatus Status { get; } + + /// + /// Returns true if asset is tradable. + /// + [UsedImplicitly] + Boolean IsTradable { get; } + + /// + /// Get option contract size. + /// + [UsedImplicitly] + Decimal Size { get; } + + /// + /// Get option contract type. + /// + [UsedImplicitly] + OptionType OptionType { get; } + + /// + /// Get option contract strike price. + /// + [UsedImplicitly] + Decimal StrikePrice { get; } + + /// + /// Get option contract expiration date. + /// + [UsedImplicitly] + DateOnly ExpirationDate { get; } + + /// + /// Get option contract execution style. + /// + [UsedImplicitly] + OptionStyle OptionStyle { get; } + + /// + /// Get option contract root asset property. + /// + [UsedImplicitly] + String RootSymbol { get; } + + /// + /// Get option contract underlying asset property. + /// + [UsedImplicitly] + String UnderlyingSymbol { get; } + + /// + /// Get option contract underlying asset property. + /// + [UsedImplicitly] + Guid UnderlyingAssetId { get; } + + /// + /// Get option contract open interest. + /// + [UsedImplicitly] + Decimal? OpenInterest { get; } + + /// + /// Get option contract open interest date. + /// + [UsedImplicitly] + DateOnly? OpenInterestDate { get; } + + /// + /// Get option contract close price. + /// + [UsedImplicitly] + Decimal? ClosePrice { get; } + + /// + /// Get option contract close price date. + /// + [UsedImplicitly] + DateOnly? ClosePriceDate { get; } +} diff --git a/Alpaca.Markets/Messages/JsonOptionContract.cs b/Alpaca.Markets/Messages/JsonOptionContract.cs new file mode 100644 index 00000000..dd00fb8e --- /dev/null +++ b/Alpaca.Markets/Messages/JsonOptionContract.cs @@ -0,0 +1,71 @@ +namespace Alpaca.Markets; + +[DebuggerDisplay("{DebuggerDisplay,nq}", Type = nameof(IOptionContract))] +[SuppressMessage( + "Microsoft.Performance", "CA1812:Avoid uninstantiated internal classes", + Justification = "Object instances of this class will be created by Newtonsoft.JSON library.")] +internal sealed class JsonOptionContract : IOptionContract +{ + [JsonProperty(PropertyName = "id", Required = Required.Always)] + public Guid ContractId { get; set; } + + [JsonProperty(PropertyName = "symbol", Required = Required.Always)] + public String Symbol { get; set; } = String.Empty; + + [JsonProperty(PropertyName = "name", Required = Required.Always)] + public String Name { get; set; } = String.Empty; + + [JsonProperty(PropertyName = "status", Required = Required.Always)] + public AssetStatus Status { get; set; } + + [JsonProperty(PropertyName = "tradable", Required = Required.Always)] + public Boolean IsTradable { get; set; } + + [JsonProperty(PropertyName = "size", Required = Required.Always)] + public Decimal Size { get; set; } + + [JsonProperty(PropertyName = "type", Required = Required.Always)] + public OptionType OptionType { get; } + + [JsonProperty(PropertyName = "strike_price", Required = Required.Always)] + public Decimal StrikePrice { get; set; } + + [JsonConverter(typeof(DateOnlyConverter))] + [JsonProperty(PropertyName = "expiration_date", Required = Required.Always)] + public DateOnly ExpirationDate { get; set; } + + [JsonProperty(PropertyName = "style", Required = Required.Always)] + public OptionStyle OptionStyle { get; } + + [JsonProperty(PropertyName = "root_symbol", Required = Required.Always)] + public String RootSymbol { get; set; } = String.Empty; + + [JsonProperty(PropertyName = "underlying_symbol", Required = Required.Always)] + public String UnderlyingSymbol { get; set; } = String.Empty; + + [JsonProperty(PropertyName = "underlying_asset_id", Required = Required.Always)] + public Guid UnderlyingAssetId { get; set; } + + [JsonProperty(PropertyName = "open_interest", Required = Required.Default)] + public Decimal? OpenInterest { get; set; } + + [JsonConverter(typeof(DateOnlyConverter))] + [JsonProperty(PropertyName = "open_interest_date", Required = Required.Default)] + public DateOnly? OpenInterestDate { get; set; } + + [JsonProperty(PropertyName = "close_price", Required = Required.Default)] + public Decimal? ClosePrice { get; set; } + + [JsonConverter(typeof(DateOnlyConverter))] + [JsonProperty(PropertyName = "close_price_date", Required = Required.Default)] + public DateOnly? ClosePriceDate { get; set; } + + [ExcludeFromCodeCoverage] + public override String ToString() => + JsonConvert.SerializeObject(this); + + [ExcludeFromCodeCoverage] + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private String DebuggerDisplay => + $"{nameof(IOptionContract)} {{ ID = {ContractId:B}, Symbol = \"{Symbol}\" }}"; +} diff --git a/Alpaca.Markets/Messages/JsonOptionContractsPage.cs b/Alpaca.Markets/Messages/JsonOptionContractsPage.cs new file mode 100644 index 00000000..ee80c8c1 --- /dev/null +++ b/Alpaca.Markets/Messages/JsonOptionContractsPage.cs @@ -0,0 +1,10 @@ +namespace Alpaca.Markets; + +[SuppressMessage( + "Microsoft.Performance", "CA1812:Avoid uninstantiated internal classes", + Justification = "Object instances of this class will be created by Newtonsoft.JSON library.")] +internal sealed class JsonOptionContractsPage +{ + [JsonProperty(PropertyName = "option_contracts", Required = Required.Always)] + public List Contracts { get; set; } = []; +} \ No newline at end of file diff --git a/Alpaca.Markets/Parameters/OptionContractsRequest.cs b/Alpaca.Markets/Parameters/OptionContractsRequest.cs new file mode 100644 index 00000000..b90a0075 --- /dev/null +++ b/Alpaca.Markets/Parameters/OptionContractsRequest.cs @@ -0,0 +1,137 @@ +namespace Alpaca.Markets; + +/// +/// Encapsulates request parameters for call. +/// +public sealed class OptionContractsRequest : Validation.IRequest +{ + /// + /// Creates new instance of object. + /// + /// The symbol of the underlying asset for filtering. + public OptionContractsRequest( + String underlyingSymbol) => + UnderlyingSymbol = underlyingSymbol.EnsureNotNull(); + + /// + /// Gets the symbol of the underlying asset for filtering. + /// + [UsedImplicitly] + public String UnderlyingSymbol { get; } + + /// + /// Gets or sets filter by the asset status. By default, only active contracts are returned. + /// + [UsedImplicitly] + public AssetStatus? AssetStatus { get; set; } + + /// + /// Gets or sets filter by the exact option contract expiration date. + /// + [UsedImplicitly] + public DateOnly? ExpirationDateEqualTo { get; set; } + + /// + /// Gets or sets filter by the expiration date greater than or equal to the specified value. + /// + [UsedImplicitly] + public DateOnly? ExpirationDateGreaterThanOrEqualTo { get; set; } + + /// + /// Gets or sets filter by the expiration date less than or equal to the specified value. + /// + [UsedImplicitly] + public DateOnly? ExpirationDateLessThanOrEqualTo { get; set; } + + /// + /// Gets or sets filter ty the root symbol. + /// + [UsedImplicitly] + public String? RootSymbol { get; set; } + + /// + /// Gets or sets filter the option contract type. + /// + [UsedImplicitly] + public OptionType? OptionType { get; set; } + + /// + /// Gets or sets filter the option contract execution style. + /// + [UsedImplicitly] + public OptionStyle? OptionStyle { get; set; } + + /// + /// Gets or sets filter by the strike price greater than or equal to the specified value. + /// + [UsedImplicitly] + public Decimal? StrikePriceGreaterThanOrEqualTo { get; set; } + + /// + /// Gets or sets filter by the strike price less than or equal to the specified value. + /// + [UsedImplicitly] + public Decimal? StrikePriceLessThanOrEqualTo { get; set; } + + /// + /// Gets or sets the desired page number. The null treated as 1st page. + /// + [UsedImplicitly] + [CLSCompliant(false)] + public UInt32? PageNumber { get; set; } + + /// + /// Gets or sets the number of contracts to limit per page (default = 10000). + /// + [UsedImplicitly] + [CLSCompliant(false)] + public UInt32? PageSize { get; set; } + + internal async ValueTask GetUriBuilderAsync( + HttpClient httpClient) => + new(httpClient.BaseAddress!) + { + Path = "v2/options/contracts", + Query = await new QueryBuilder() + .AddParameter("underlying_symbol", UnderlyingSymbol) + .AddParameter("status", AssetStatus) + .AddParameter("expiration_date", ExpirationDateEqualTo) + .AddParameter("expiration_date_gte", ExpirationDateGreaterThanOrEqualTo) + .AddParameter("expiration_date_lte", ExpirationDateLessThanOrEqualTo) + .AddParameter("root_symbol", RootSymbol) + .AddParameter("style", OptionStyle) + .AddParameter("type", OptionType) + .AddParameter("strike_price_gte", StrikePriceGreaterThanOrEqualTo) + .AddParameter("strike_price_lte", StrikePriceLessThanOrEqualTo) + .AddParameter("page", PageNumber) + .AddParameter("limit", PageSize) + .AsStringAsync().ConfigureAwait(false) + }; + + /// + IEnumerable Validation.IRequest.GetExceptions() + { + yield return UnderlyingSymbol.TryValidateSymbolName(); + yield return RootSymbol?.TryValidateSymbolName(); + + if (ExpirationDateEqualTo.HasValue && ( + ExpirationDateGreaterThanOrEqualTo.HasValue || + ExpirationDateLessThanOrEqualTo.HasValue)) + { + yield return new RequestValidationException(nameof(ExpirationDateEqualTo), + "Inconsistent expiration date filters combination."); + } + + if (PageNumber is 0) + { + yield return new RequestValidationException(nameof(PageNumber), + "Page number should be greater than or equal to 1."); + } + + if (PageSize is 0 or > 10_000) + { + yield return new RequestValidationException(nameof(PageSize), + "Page size value should be between 1 and 10 0000."); + } + } +} diff --git a/Alpaca.Markets/PublicAPI.Unshipped.txt b/Alpaca.Markets/PublicAPI.Unshipped.txt index c06bfa21..9547f0c4 100644 --- a/Alpaca.Markets/PublicAPI.Unshipped.txt +++ b/Alpaca.Markets/PublicAPI.Unshipped.txt @@ -4,7 +4,59 @@ Alpaca.Markets.IAccount.OptionsApprovedLevel.get -> Alpaca.Markets.OptionsTradin Alpaca.Markets.IAccount.OptionsBuyingPower.get -> decimal? Alpaca.Markets.IAccount.OptionsTradingLevel.get -> Alpaca.Markets.OptionsTradingLevel? Alpaca.Markets.IAccountConfiguration.MaxOptionsTradingLevel.get -> Alpaca.Markets.OptionsTradingLevel? +Alpaca.Markets.IAlpacaTradingClient.GetOptionContractByIdAsync(System.Guid contractId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Alpaca.Markets.IAlpacaTradingClient.GetOptionContractBySymbolAsync(string! symbol, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! +Alpaca.Markets.IAlpacaTradingClient.ListOptionContractsAsync(Alpaca.Markets.OptionContractsRequest! request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!>! +Alpaca.Markets.IOptionContract +Alpaca.Markets.IOptionContract.ClosePrice.get -> decimal? +Alpaca.Markets.IOptionContract.ClosePriceDate.get -> System.DateOnly? +Alpaca.Markets.IOptionContract.ContractId.get -> System.Guid +Alpaca.Markets.IOptionContract.ExpirationDate.get -> System.DateOnly +Alpaca.Markets.IOptionContract.IsTradable.get -> bool +Alpaca.Markets.IOptionContract.Name.get -> string! +Alpaca.Markets.IOptionContract.OpenInterest.get -> decimal? +Alpaca.Markets.IOptionContract.OpenInterestDate.get -> System.DateOnly? +Alpaca.Markets.IOptionContract.OptionStyle.get -> Alpaca.Markets.OptionStyle +Alpaca.Markets.IOptionContract.OptionType.get -> Alpaca.Markets.OptionType +Alpaca.Markets.IOptionContract.RootSymbol.get -> string! +Alpaca.Markets.IOptionContract.Size.get -> decimal +Alpaca.Markets.IOptionContract.Status.get -> Alpaca.Markets.AssetStatus +Alpaca.Markets.IOptionContract.StrikePrice.get -> decimal +Alpaca.Markets.IOptionContract.Symbol.get -> string! +Alpaca.Markets.IOptionContract.UnderlyingAssetId.get -> System.Guid +Alpaca.Markets.IOptionContract.UnderlyingSymbol.get -> string! +Alpaca.Markets.OptionContractsRequest +Alpaca.Markets.OptionContractsRequest.AssetStatus.get -> Alpaca.Markets.AssetStatus? +Alpaca.Markets.OptionContractsRequest.AssetStatus.set -> void +Alpaca.Markets.OptionContractsRequest.ExpirationDateEqualTo.get -> System.DateOnly? +Alpaca.Markets.OptionContractsRequest.ExpirationDateEqualTo.set -> void +Alpaca.Markets.OptionContractsRequest.ExpirationDateGreaterThanOrEqualTo.get -> System.DateOnly? +Alpaca.Markets.OptionContractsRequest.ExpirationDateGreaterThanOrEqualTo.set -> void +Alpaca.Markets.OptionContractsRequest.ExpirationDateLessThanOrEqualTo.get -> System.DateOnly? +Alpaca.Markets.OptionContractsRequest.ExpirationDateLessThanOrEqualTo.set -> void +Alpaca.Markets.OptionContractsRequest.OptionContractsRequest(string! underlyingSymbol) -> void +Alpaca.Markets.OptionContractsRequest.OptionStyle.get -> Alpaca.Markets.OptionStyle? +Alpaca.Markets.OptionContractsRequest.OptionStyle.set -> void +Alpaca.Markets.OptionContractsRequest.OptionType.get -> Alpaca.Markets.OptionType? +Alpaca.Markets.OptionContractsRequest.OptionType.set -> void +Alpaca.Markets.OptionContractsRequest.PageNumber.get -> uint? +Alpaca.Markets.OptionContractsRequest.PageNumber.set -> void +Alpaca.Markets.OptionContractsRequest.PageSize.get -> uint? +Alpaca.Markets.OptionContractsRequest.PageSize.set -> void +Alpaca.Markets.OptionContractsRequest.RootSymbol.get -> string? +Alpaca.Markets.OptionContractsRequest.RootSymbol.set -> void +Alpaca.Markets.OptionContractsRequest.StrikePriceGreaterThanOrEqualTo.get -> decimal? +Alpaca.Markets.OptionContractsRequest.StrikePriceGreaterThanOrEqualTo.set -> void +Alpaca.Markets.OptionContractsRequest.StrikePriceLessThanOrEqualTo.get -> decimal? +Alpaca.Markets.OptionContractsRequest.StrikePriceLessThanOrEqualTo.set -> void +Alpaca.Markets.OptionContractsRequest.UnderlyingSymbol.get -> string! Alpaca.Markets.OptionsTradingLevel Alpaca.Markets.OptionsTradingLevel.CoveredCallCashSecuredPut = 1 -> Alpaca.Markets.OptionsTradingLevel Alpaca.Markets.OptionsTradingLevel.Disabled = 0 -> Alpaca.Markets.OptionsTradingLevel Alpaca.Markets.OptionsTradingLevel.LongCallPut = 2 -> Alpaca.Markets.OptionsTradingLevel +Alpaca.Markets.OptionStyle +Alpaca.Markets.OptionStyle.American = 0 -> Alpaca.Markets.OptionStyle +Alpaca.Markets.OptionStyle.European = 1 -> Alpaca.Markets.OptionStyle +Alpaca.Markets.OptionType +Alpaca.Markets.OptionType.Call = 0 -> Alpaca.Markets.OptionType +Alpaca.Markets.OptionType.Put = 1 -> Alpaca.Markets.OptionType diff --git a/Alpaca.Markets/WebSocket/StreamingClientBase.cs b/Alpaca.Markets/WebSocket/StreamingClientBase.cs index 10a18eed..a367eada 100644 --- a/Alpaca.Markets/WebSocket/StreamingClientBase.cs +++ b/Alpaca.Markets/WebSocket/StreamingClientBase.cs @@ -89,7 +89,7 @@ public void Dispose() protected virtual void OnOpened() => SocketOpened?.Invoke(); - [SuppressMessage("ReSharper", "VirtualMemberNeverOverridden.Global")] + // ReSharper disable once VirtualMemberNeverOverridden.Global protected virtual void OnClosed() => SocketClosed?.Invoke(); [ExcludeFromCodeCoverage] @@ -98,7 +98,7 @@ protected virtual void OnMessageReceived( { } - [SuppressMessage("ReSharper", "VirtualMemberNeverOverridden.Global")] + // ReSharper disable once VirtualMemberNeverOverridden.Global protected virtual void Dispose( Boolean disposing) { @@ -175,7 +175,9 @@ protected ValueTask SendAsJsonStringAsync( return _webSocket.SendAsync(textWriter.ToString(), cancellationToken); } +#pragma warning disable IDE1006 // Naming Styles private void onDataReceived( +#pragma warning restore IDE1006 // Naming Styles Byte[] binaryData) => OnMessageReceived(Encoding.UTF8.GetString(binaryData)); }