public override int GetHashCode() { int hashCode = SecurityCode.GetHashCode() ^ StrikePrice.GetHashCode() ^ Expiry.GetHashCode() ^ PremiumMultiplier.GetHashCode(); return(hashCode); }
public override String ToString() { // C1250MAY10 1 1$ String result; result = OpType.ToString().Substring(0, 1) + StrikePrice.ToString() + Expiration.ToString("MMMyy", CultureInfo.InvariantCulture) + " " + Quantity.ToString() + " " + Premium.ToString() + "$"; return(result); }
public override String ToString() { // C1250MAY10 String result; result = OpType.ToString().Substring(0, 1) + StrikePrice.ToString() + Expiration.ToString("MMMyy", CultureInfo.InvariantCulture); return(result); }
public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 29 + Symbol.GetHashCode(); hash = hash * 29 + EquitySymbol.GetHashCode(); hash = hash * 29 + StrikePrice.GetHashCode(); hash = hash * 29 + Expiration.GetHashCode(); hash = hash * 29 + Side.GetHashCode(); return(hash); } }
public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } OptionPair other = (OptionPair)obj; bool equals = SecurityCode.IgnoreCaseEquals(other.SecurityCode) && StrikePrice.AlmostEqual(other.StrikePrice) && Expiry == other.Expiry && PremiumMultiplier == other.PremiumMultiplier; return(equals); }
private void ApplyClosedLogicIfApplicable(DateTimeOffset when, Guid eventId) { if (NumberOfContracts != 0) { return; } Closed = when; var profit = PremiumReceived - PremiumPaid; var description = $"${StrikePrice.ToString("0.00")} {OptionType.ToString()}"; Transactions.Add( Transaction.PLTx(Id, Ticker, description, PremiumPaid, PremiumReceived, when, true) ); }
/// <summary> /// Формат строки "[#fmt]#;newstype=option#;type=val#;style=val#;baseactive=val#;countdate=val#; /// dateexpiration=val#;strikeprice=val#;delta=val#;openinterest=val" /// </summary> /// <returns></returns> public override String ToString() { var opData = new string[12]; opData[0] = "[#fmt]"; opData[1] = "newstype=option"; opData[2] = "type=" + Type; opData[3] = "style=" + Style; opData[4] = "baseactive=" + BaseActive; opData[5] = "publishdate=" + DatePublished.ToStringUniform(); opData[6] = "dateexpiration=" + DateExpiration.ToStringUniform(); opData[7] = "strikeprice=" + StrikePrice.ToStringUniform(5); opData[8] = "high=" + ContractHigh.ToStringUniform(5); opData[9] = "low=" + ContractLow.ToStringUniform(5); opData[10] = "close=" + ContractClose.ToStringUniform(5); opData[11] = "oi=" + OpenInterest; opData[11] = "volume=" + Volume; return(String.Join(PartsSeparator, opData)); }
public string ToCsv() { return($"F,{Symbol},{ExchangeId},{PE.ToInvariantString()},{AverageVolume.ToInvariantString()},{FiftyTwoWeekHigh.ToInvariantString()}," + $"{FiftyTwoWeekLow.ToInvariantString()},{CalendarYearHigh.ToInvariantString()},{CalendarYearLow.ToInvariantString()},{DividendYield.ToInvariantString()}," + $"{DividendAmount.ToInvariantString()},{DividendRate.ToInvariantString()},{PayDate.ToInvariantString(FundamentalDateTimeFormat)}," + $"{ExDividendDate.ToInvariantString(FundamentalDateTimeFormat)}," + $"{CurrentYearEarningsPerShare.ToInvariantString()},{NextYearEarningsPerShare.ToInvariantString()},{FiveYearGrowthPercentage.ToInvariantString()}," + $"{FiscalYearEnd.ToInvariantString()},{CompanyName},{RootOptionSymbol},{PercentHeldByInstitutions.ToInvariantString()}," + $"{Beta.ToInvariantString()},{Leaps},{CurrentAssets.ToInvariantString()},{CurrentLiabilities.ToInvariantString()}," + $"{BalanceSheetDate.ToInvariantString(FundamentalDateTimeFormat)},{LongTermDebt.ToInvariantString()},{CommonSharesOutstanding.ToInvariantString()}," + $"{SplitFactor1},{SplitFactor2},{FormatCode},{Precision.ToInvariantString()},{SIC.ToInvariantString()}," + $"{HistoricalVolatility.ToInvariantString()},{SecurityType},{ListedMarket},{FiftyTwoWeekHighDate.ToInvariantString(FundamentalDateTimeFormat)}," + $"{FiftyTwoWeekLowDate.ToInvariantString(FundamentalDateTimeFormat)},{CalendarYearHighDate.ToInvariantString(FundamentalDateTimeFormat)}," + $"{CalendarYearLowDate.ToInvariantString(FundamentalDateTimeFormat)},{YearEndClose.ToInvariantString()},{MaturityDate.ToInvariantString(FundamentalDateTimeFormat)}," + $"{CouponRate.ToInvariantString()},{ExpirationDate.ToInvariantString(FundamentalDateTimeFormat)},{StrikePrice.ToInvariantString()}," + $"{NAICS.ToInvariantString()},{ExchangeRoot},{OptionsPremiumMultiplier.ToInvariantString()},{OptionsMultipleDeliverables.ToInvariantString()}," + $"{SessionOpenTime.ToInvariantString(FundamentalTimeSpanFormat)},{SessionCloseTime.ToInvariantString(FundamentalTimeSpanFormat)}," + $"{BaseCurrency},{ContractSize},{ContractMonths},{MinimumTickSize.ToInvariantString()},{FirstDeliveryDate.ToInvariantString(FundamentalDateTimeFormat)}," + $"{FIGI},{SecuritySubType.ToInvariantString()}"); }