-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #719 - Added support for the options contract requesting:
- Added the new `IOptionContract` interface and two related enums: `OptionType` and `OptionStyle`. - Added the new `IAlpacaTradingClient.ListOptionContractsAsync` method and related `OptionContractsRequest` class. - Added the new `IAlpacaTradingClient.GetOptionContractByidAsync` and `IAlpacaTradingClient.GetOptionContractBySymbolAsync` methods.
- Loading branch information
Showing
11 changed files
with
584 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Alpaca.Markets; | ||
|
||
/// <summary> | ||
/// Supported option contract styles for Alpaca REST API. | ||
/// </summary> | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum OptionStyle | ||
{ | ||
/// <summary> | ||
/// American option contract execution style. | ||
/// </summary> | ||
[UsedImplicitly] | ||
[EnumMember(Value = "american")] | ||
American, | ||
|
||
/// <summary> | ||
/// European option contract execution style. | ||
/// </summary> | ||
[UsedImplicitly] | ||
[EnumMember(Value = "european")] | ||
European | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Alpaca.Markets; | ||
|
||
/// <summary> | ||
/// Supported option contract types for Alpaca REST API. | ||
/// </summary> | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum OptionType | ||
{ | ||
/// <summary> | ||
/// Call option contract. | ||
/// </summary> | ||
[UsedImplicitly] | ||
[EnumMember(Value = "call")] | ||
Call, | ||
|
||
/// <summary> | ||
/// Put option contract. | ||
/// </summary> | ||
[UsedImplicitly] | ||
[EnumMember(Value = "put")] | ||
Put | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
namespace Alpaca.Markets; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public interface IOptionContract | ||
{ | ||
/// <summary> | ||
/// Gets unique option contract identifier used by Alpaca. | ||
/// </summary> | ||
[UsedImplicitly] | ||
Guid ContractId { get; } | ||
|
||
/// <summary> | ||
/// Get option contract symbol. | ||
/// </summary> | ||
String Symbol { get; } | ||
|
||
/// <summary> | ||
/// Gets option contract name. | ||
/// </summary> | ||
[UsedImplicitly] | ||
String Name { get; } | ||
|
||
/// <summary> | ||
/// Get option contract status in API. | ||
/// </summary> | ||
[UsedImplicitly] | ||
AssetStatus Status { get; } | ||
|
||
/// <summary> | ||
/// Returns <c>true</c> if asset is tradable. | ||
/// </summary> | ||
[UsedImplicitly] | ||
Boolean IsTradable { get; } | ||
|
||
/// <summary> | ||
/// Get option contract size. | ||
/// </summary> | ||
[UsedImplicitly] | ||
Decimal Size { get; } | ||
|
||
/// <summary> | ||
/// Get option contract type. | ||
/// </summary> | ||
[UsedImplicitly] | ||
OptionType OptionType { get; } | ||
|
||
/// <summary> | ||
/// Get option contract strike price. | ||
/// </summary> | ||
[UsedImplicitly] | ||
Decimal StrikePrice { get; } | ||
|
||
/// <summary> | ||
/// Get option contract expiration date. | ||
/// </summary> | ||
[UsedImplicitly] | ||
DateOnly ExpirationDate { get; } | ||
|
||
/// <summary> | ||
/// Get option contract execution style. | ||
/// </summary> | ||
[UsedImplicitly] | ||
OptionStyle OptionStyle { get; } | ||
|
||
/// <summary> | ||
/// Get option contract root asset <see cref="IAsset.Symbol"/> property. | ||
/// </summary> | ||
[UsedImplicitly] | ||
String RootSymbol { get; } | ||
|
||
/// <summary> | ||
/// Get option contract underlying asset <see cref="IAsset.Symbol"/> property. | ||
/// </summary> | ||
[UsedImplicitly] | ||
String UnderlyingSymbol { get; } | ||
|
||
/// <summary> | ||
/// Get option contract underlying asset <see cref="IAsset.AssetId"/> property. | ||
/// </summary> | ||
[UsedImplicitly] | ||
Guid UnderlyingAssetId { get; } | ||
|
||
/// <summary> | ||
/// Get option contract open interest. | ||
/// </summary> | ||
[UsedImplicitly] | ||
Decimal? OpenInterest { get; } | ||
|
||
/// <summary> | ||
/// Get option contract open interest date. | ||
/// </summary> | ||
[UsedImplicitly] | ||
DateOnly? OpenInterestDate { get; } | ||
|
||
/// <summary> | ||
/// Get option contract close price. | ||
/// </summary> | ||
[UsedImplicitly] | ||
Decimal? ClosePrice { get; } | ||
|
||
/// <summary> | ||
/// Get option contract close price date. | ||
/// </summary> | ||
[UsedImplicitly] | ||
DateOnly? ClosePriceDate { get; } | ||
} |
Oops, something went wrong.