using System; using System.Text; namespace Krs.Ats.IBNet.Contracts { /// /// Option Class - uses default constructors for creating an option contract. /// /// [Serializable()] public class Option : Contract { /// /// Creates an Option Contract /// /// Symbol of the equity. See . /// Symbol of the option for the underlying equity. See . /// Option Expiration String. See . /// Option Right (Put or Call). See . /// Option Strike Price. See . public Option(string equitySymbol, string optionSymbol, string expiry, RightType right, decimal strike) : base(0, equitySymbol, SecurityType.Option, expiry, (double)strike, right, "100", "SMART", "USD", optionSymbol, "SMART", SecurityIdType.None, string.Empty) { } /// /// Creates an Option Contract /// /// Symbol of the equity. See . /// Symbol of the option for the underlying equity. See . /// Option Expiration Year. See . /// Option Expiration Month. See . /// Option Right (Put or Call). See . /// Option Strike Price. See . public Option(string equitySymbol, string optionSymbol, int year, int month, RightType right, decimal strike) : base(0, equitySymbol, SecurityType.Option, "", (double)strike, right, "100", "SMART", "USD", optionSymbol, "SMART", SecurityIdType.None, string.Empty) { StringBuilder ExpirationString = new StringBuilder(); ExpirationString.AppendFormat("{0:0000}{1:00}", year, month); Expiry = ExpirationString.ToString(); } /// /// Creates an Option Contract /// /// This is the symbol of the underlying asset. /// The order destination, such as Smart. /// This is the security type. /// Specifies the currency. /// The expiration date. Use the format YYYYMM. /// The strike price. /// Specifies a Put or Call. public Option(string symbol, string exchange, SecurityType securityType, string currency, string expiry, double strike, RightType right) : base(0, symbol, securityType, expiry, strike, right, null, exchange, currency, null, null, SecurityIdType.None, string.Empty) { } } }